]> granicus.if.org Git - php/commitdiff
Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell.
authorScott MacVicar <scottmac@php.net>
Mon, 11 Jun 2012 19:38:54 +0000 (12:38 -0700)
committerScott MacVicar <scottmac@php.net>
Mon, 11 Jun 2012 22:41:41 +0000 (15:41 -0700)
Summary:
Stas pointed out that this is named pretty poorly. Go for openssl_pbkdf2()

ext/openssl/CREDITS
ext/openssl/openssl.c
ext/openssl/php_openssl.h
ext/openssl/tests/openssl_pbkdf2.phpt [new file with mode: 0644]
ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt [deleted file]

index c2f50d63089ef1a0cf35fc2d3b4680267e4e0155..b685ce13e5cbfe9a4107fac34e558c0b41528cfb 100644 (file)
@@ -1,2 +1,2 @@
 OpenSSL
-Stig Venaas, Wez Furlong, Sascha Kettler
+Stig Venaas, Wez Furlong, Sascha Kettler, Scott MacVicar
index 28f76184f4947e72e92a8d99189c7980fa5cbbbc..4d482e8a279a8fbf1ba568f1249a57759bf6d30f 100644 (file)
@@ -243,7 +243,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0)
 ZEND_END_ARG_INFO()
 
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4)
     ZEND_ARG_INFO(0, password)
     ZEND_ARG_INFO(0, salt)
     ZEND_ARG_INFO(0, key_length)
@@ -439,7 +439,7 @@ const zend_function_entry openssl_functions[] = {
        PHP_FE(openssl_open,                            arginfo_openssl_open)
 
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
-       PHP_FE(openssl_pkcs5_pbkdf2_hmac,       arginfo_openssl_pkcs5_pbkdf2_hmac)
+       PHP_FE(openssl_pbkdf2,  arginfo_openssl_pbkdf2)
 #endif
 
 /* for S/MIME handling */
@@ -3333,9 +3333,9 @@ PHP_FUNCTION(openssl_pkey_get_details)
 
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
 
-/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"])
+/* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"])
    Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */
-PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac)
+PHP_FUNCTION(openssl_pbkdf2)
 {
        long key_length = 0, iterations = 0;
        char *password; int password_len;
index 0dbe7d288730273a37284b1981341eca427be93a..2de211a64cfbce8346ec756e17994bc824dd039c 100644 (file)
@@ -52,7 +52,7 @@ PHP_FUNCTION(openssl_private_decrypt);
 PHP_FUNCTION(openssl_public_encrypt);
 PHP_FUNCTION(openssl_public_decrypt);
 
-PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac);
+PHP_FUNCTION(openssl_pbkdf2);
 
 PHP_FUNCTION(openssl_pkcs7_verify);
 PHP_FUNCTION(openssl_pkcs7_decrypt);
diff --git a/ext/openssl/tests/openssl_pbkdf2.phpt b/ext/openssl/tests/openssl_pbkdf2.phpt
new file mode 100644 (file)
index 0000000..3ec4dce
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+openssl_pbkdf2() tests
+--SKIPIF--
+<?php if (!extension_loaded("openssl") || !function_exists("openssl_pbkdf2")) print "skip"; ?>
+--FILE--
+<?php
+// official test vectors
+var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 1)));
+var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 2)));
+var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 4096)));
+
+/* really slow but should be:
+string(40) "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"
+var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 16777216)));
+*/
+
+var_dump(bin2hex(openssl_pbkdf2('passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 25, 4096)));
+var_dump(bin2hex(openssl_pbkdf2("pass\0word", "sa\0lt", 16, 4096)));
+
+?>
+--EXPECTF--
+string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6"
+string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"
+string(40) "4b007901b765489abead49d926f721d065a429c1"
+string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"
+string(32) "56fa6aa75548099dcc37d7f03425e0c3"
diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt
deleted file mode 100644 (file)
index af1fcb1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-openssl_pkcs5_pbkdf2_hmac() tests
---SKIPIF--
-<?php if (!extension_loaded("openssl") || !function_exists("openssl_pkcs5_pbkdf2_hmac")) print "skip"; ?>
---FILE--
-<?php
-// official test vectors
-var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 1)));
-var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 2)));
-var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 4096)));
-
-/* really slow but should be:
-string(40) "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"
-var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 16777216)));
-*/
-
-var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 25, 4096)));
-var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac("pass\0word", "sa\0lt", 16, 4096)));
-
-?>
---EXPECTF--
-string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6"
-string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"
-string(40) "4b007901b765489abead49d926f721d065a429c1"
-string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"
-string(32) "56fa6aa75548099dcc37d7f03425e0c3"