Permalink
Browse files

Merge branch 'PHp-5.4'

* PHp-5.4:
  news for bug #61421
  commit for php bug 61421 enabling SHA2 and RMD160 for openssl signature verification
  • Loading branch information...
2 parents 80b29dc + 56425ee commit 088640adb206361ea8e6d5705d7434c6e3d3e25c @smalyshev smalyshev committed Sep 16, 2012
Showing with 31 additions and 1 deletion.
  1. +31 −1 ext/openssl/openssl.c
View
@@ -65,7 +65,13 @@
#define OPENSSL_ALGO_MD2 4
#endif
#define OPENSSL_ALGO_DSS1 5
-
+#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
+#define OPENSSL_ALGO_SHA224 6
+#define OPENSSL_ALGO_SHA256 7
+#define OPENSSL_ALGO_SHA384 8
+#define OPENSSL_ALGO_SHA512 9
+#define OPENSSL_ALGO_RMD160 10
+#endif
#define DEBUG_SMIME 0
/* FIXME: Use the openssl constants instead of
@@ -964,6 +970,23 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */
case OPENSSL_ALGO_DSS1:
mdtype = (EVP_MD *) EVP_dss1();
break;
+#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
+ case OPENSSL_ALGO_SHA224:
+ mdtype = (EVP_MD *) EVP_sha224();
+ break;
+ case OPENSSL_ALGO_SHA256:
+ mdtype = (EVP_MD *) EVP_sha256();
+ break;
+ case OPENSSL_ALGO_SHA384:
+ mdtype = (EVP_MD *) EVP_sha384();
+ break;
+ case OPENSSL_ALGO_SHA512:
+ mdtype = (EVP_MD *) EVP_sha512();
+ break;
+ case OPENSSL_ALGO_RMD160:
+ mdtype = (EVP_MD *) EVP_ripemd160();
+ break;
+#endif
default:
return NULL;
break;
@@ -1058,6 +1081,13 @@ PHP_MINIT_FUNCTION(openssl)
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
#endif
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
+#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT);
+#endif
/* flags for S/MIME */
REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT);

0 comments on commit 088640a

Please sign in to comment.