]> granicus.if.org Git - php/commitdiff
Skip failing tests when EC unavailable (RHEL)
authorDaniel Lowrey <rdlowrey@php.net>
Wed, 19 Feb 2014 10:57:37 +0000 (03:57 -0700)
committerDaniel Lowrey <rdlowrey@php.net>
Wed, 19 Feb 2014 10:57:37 +0000 (03:57 -0700)
ext/openssl/openssl.c
ext/openssl/tests/bug64802.phpt
ext/openssl/tests/bug66501.phpt

index 3e60cd505b9ce8c716e5adf1ab7c77035f7157d3..d20ca83e854ae1cfee3d4b4b9cbf6c54933a37cc 100755 (executable)
 #endif
 #define DEBUG_SMIME    0
 
+#if !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC)
+#define HAVE_EVP_PKEY_EC 1
+#endif
+
 /* FIXME: Use the openssl constants instead of
  * enum. It is now impossible to match real values
  * against php constants. Also sorry to break the
@@ -88,7 +92,7 @@ enum php_openssl_key_type {
        OPENSSL_KEYTYPE_DSA,
        OPENSSL_KEYTYPE_DH,
        OPENSSL_KEYTYPE_DEFAULT = OPENSSL_KEYTYPE_RSA,
-#ifdef EVP_PKEY_EC
+#ifdef HAVE_EVP_PKEY_EC
        OPENSSL_KEYTYPE_EC = OPENSSL_KEYTYPE_DH +1
 #endif
 };
@@ -1116,7 +1120,7 @@ PHP_MINIT_FUNCTION(openssl)
        REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT);
 #endif
        REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT);
-#ifdef EVP_PKEY_EC
+#ifdef HAVE_EVP_PKEY_EC
        REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT);
 #endif
 
@@ -3014,7 +3018,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
                        }
                        break;
 #endif
-#if OPENSSL_VERSION_NUMBER >= 0x0090800fL && !defined(OPENSSL_NO_EC) && defined(EVP_PKEY_EC)
+#ifdef HAVE_EVP_PKEY_EC
                case EVP_PKEY_EC:
                        assert(pkey->pkey.ec != NULL);
 
@@ -3423,7 +3427,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
                        }
 
                        break;
-#ifdef EVP_PKEY_EC
+#ifdef HAVE_EVP_PKEY_EC
                case EVP_PKEY_EC:
                        ktype = OPENSSL_KEYTYPE_EC;
                        break;
index 9a59701494ecc1e5d07993cf4d382c164ba36135..be0b5f9b5b08728ba20e162e3e81df63224016e8 100644 (file)
@@ -3,6 +3,7 @@ Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
 --SKIPIF--
 <?php
 if (!extension_loaded("openssl")) die("skip");
+if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
 ?>
 --FILE--
 <?php
index 5c57f2117fc6ab5faa05215c9a7499cc455626f9..cd0da1f289cb7f0d60bbc5d8fb4995f7e3487c92 100644 (file)
@@ -3,6 +3,7 @@ Bug #66501: EC private key support in openssl_sign
 --SKIPIF--\r
 <?php \r
 if (!extension_loaded("openssl")) die("skip");\r
+if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);\r
 --FILE--\r
 <?php\r
 $pkey = 'ASN1 OID: prime256v1\r