Skip to content

Commit a2bfad0

Browse files
committed
Revert "Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell."
This reverts commit bccd1e6. Looks like we don't have agreement yet on this for 5.4. Let's keep it in 5.5 for now.
1 parent f8cc363 commit a2bfad0

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

ext/openssl/CREDITS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
OpenSSL
2-
Stig Venaas, Wez Furlong, Sascha Kettler, Scott MacVicar
2+
Stig Venaas, Wez Furlong, Sascha Kettler

ext/openssl/openssl.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0)
243243
ZEND_END_ARG_INFO()
244244

245245
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
246-
ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4)
246+
ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4)
247247
ZEND_ARG_INFO(0, password)
248248
ZEND_ARG_INFO(0, salt)
249249
ZEND_ARG_INFO(0, key_length)
@@ -439,7 +439,7 @@ const zend_function_entry openssl_functions[] = {
439439
PHP_FE(openssl_open, arginfo_openssl_open)
440440

441441
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
442-
PHP_FE(openssl_pbkdf2, arginfo_openssl_pbkdf2)
442+
PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac)
443443
#endif
444444

445445
/* for S/MIME handling */
@@ -3333,9 +3333,9 @@ PHP_FUNCTION(openssl_pkey_get_details)
33333333

33343334
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
33353335

3336-
/* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"])
3336+
/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"])
33373337
Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */
3338-
PHP_FUNCTION(openssl_pbkdf2)
3338+
PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac)
33393339
{
33403340
long key_length = 0, iterations = 0;
33413341
char *password; int password_len;

ext/openssl/php_openssl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ PHP_FUNCTION(openssl_private_decrypt);
5252
PHP_FUNCTION(openssl_public_encrypt);
5353
PHP_FUNCTION(openssl_public_decrypt);
5454

55-
PHP_FUNCTION(openssl_pbkdf2);
55+
PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac);
5656

5757
PHP_FUNCTION(openssl_pkcs7_verify);
5858
PHP_FUNCTION(openssl_pkcs7_decrypt);

ext/openssl/tests/openssl_pbkdf2.phpt

-26
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
openssl_pkcs5_pbkdf2_hmac() tests
3+
--SKIPIF--
4+
<?php if (!extension_loaded("openssl") || !function_exists("openssl_pkcs5_pbkdf2_hmac")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
// official test vectors
8+
var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 1)));
9+
var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 2)));
10+
var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 4096)));
11+
12+
/* really slow but should be:
13+
string(40) "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"
14+
var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('password', 'salt', 20, 16777216)));
15+
*/
16+
17+
var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac('passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 25, 4096)));
18+
var_dump(bin2hex(openssl_pkcs5_pbkdf2_hmac("pass\0word", "sa\0lt", 16, 4096)));
19+
20+
?>
21+
--EXPECTF--
22+
string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6"
23+
string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"
24+
string(40) "4b007901b765489abead49d926f721d065a429c1"
25+
string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"
26+
string(32) "56fa6aa75548099dcc37d7f03425e0c3"

0 commit comments

Comments
 (0)