Re: OpenSSL version requirements
| From: | Jani Taskinen | Date: | Sun, 07 Jan 2001 02:59:20 +0000 |
| Subject: | Re: OpenSSL version requirements | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-43198@lists.php.net to get a copy of this message | ||
On Fri, 5 Jan 2001, Stig Venaas wrote:
>It's not so hard to make the OpenSSL extension work with 0.9.5a
>I think. The problem is that some functions return error codes
>in 0.9.6 (which PHP uses) while in 0.9.5a they don't. By making
>PHP not check for those, it should work.
Why not using this instead of #if 0:
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
And then we can remove the version check from configure?
Or change the required version to 0.9.5 ?
--Jani
>I made it work with the following change:
>
>--- /src/cvs/php4/ext/openssl/openssl.c Fri Nov 17 20:50:38 2000
>+++ ext/openssl/openssl.c Fri Jan 5 00:39:13 2001
>@@ -402,7 +402,7 @@
> zend_hash_move_forward_ex(pubkeysht, &pos);
> i++;
> }
>-
>+#if 0
> if (!EVP_EncryptInit(&ctx,EVP_rc4(),NULL,NULL)) {
> for (i=0; i<nkeys; i++) {
> efree(eks[i]);
>@@ -412,7 +412,9 @@
> efree(pkeys);
> RETURN_FALSE;
> }
>-
>+#else
>+ EVP_EncryptInit(&ctx,EVP_rc4(),NULL,NULL);
>+#endif
> #if 0
> /* Need this if allow ciphers that require initialization vector */
> ivlen = EVP_CIPHER_CTX_iv_length(&ctx);
>@@ -443,9 +445,7 @@
> RETURN_FALSE;
> }
>
>- if (!EVP_SealInit(&ctx, EVP_rc4(), eks, eksl, NULL, pkeys, nkeys) ||
>- !EVP_SealUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
>- Z_STRLEN_PP(data))) {
>+ if (!EVP_SealInit(&ctx, EVP_rc4(), eks, eksl, NULL, pkeys, nkeys)) {
> efree(buf);
> for (i=0; i<nkeys; i++) {
> efree(eks[i]);
>@@ -456,6 +456,8 @@
> RETURN_FALSE;
> }
>
>+ EVP_SealUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
>+ Z_STRLEN_PP(data));
> EVP_SealFinal(&ctx, buf + len1, &len2);
>
> efree(pkeys);
>@@ -537,11 +539,14 @@
> }
>
> if (!EVP_OpenInit(&ctx, EVP_rc4(), Z_STRVAL_PP(ekey),
>- Z_STRLEN_PP(ekey), NULL, pkey) ||
>- !EVP_OpenUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
>- Z_STRLEN_PP(data)) ||
>- !EVP_OpenFinal(&ctx, buf + len1, &len2) ||
>- (len1 + len2 == 0)) {
>+ Z_STRLEN_PP(ekey), NULL, pkey)) {
>+ efree(buf);
>+ RETURN_FALSE;
>+ }
>+ EVP_OpenUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
>+ Z_STRLEN_PP(data));
>+ EVP_OpenFinal(&ctx, buf + len1, &len2);
>+ if (len1 + len2 == 0) {
> efree(buf);
> RETURN_FALSE;
> }
>
>I didn't test that carefully, but think this should be okay. In
>addition you need to change the configure check.
>
>Stig
>
>