com php-src: Wrap pkey id and rsa getters: ext/openssl/openssl.c ext/openssl/php_openssl.h

From: Date: Sun, 17 Jul 2016 16:33:42 +0000
Subject: com php-src: Wrap pkey id and rsa getters: ext/openssl/openssl.c ext/openssl/php_openssl.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93257@lists.php.net to get a copy of this message
Commit: 84a291d4dac1a666dd961f68f87554ab37824c7e Author: Jakub Zelenka <bukka@php.net> Mon, 29 Feb 2016 20:07:03 +0000 Parents: fd9142a64744958997f7c9611ef6277c57172933 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=84a291d4dac1a666dd961f68f87554ab37824c7e Log: Wrap pkey id and rsa getters Changed paths: M ext/openssl/openssl.c M ext/openssl/php_openssl.h Diff: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 7b687e1..e794908 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -5048,13 +5048,13 @@ PHP_FUNCTION(openssl_private_encrypt) cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = zend_string_alloc(cryptedlen, 0); - switch (pkey->type) { + switch (EVP_PKEY_id(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_private_encrypt((int)data_len, (unsigned char *)data, (unsigned char *)ZSTR_VAL(cryptedbuf), - pkey->pkey.rsa, + EVP_PKEY_get0_RSA(pkey), (int)padding) == cryptedlen); break; default: @@ -5110,13 +5110,13 @@ PHP_FUNCTION(openssl_private_decrypt) cryptedlen = EVP_PKEY_size(pkey); crypttemp = emalloc(cryptedlen + 1); - switch (pkey->type) { + switch (EVP_PKEY_id(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: cryptedlen = RSA_private_decrypt((int)data_len, (unsigned char *)data, crypttemp, - pkey->pkey.rsa, + EVP_PKEY_get0_RSA(pkey), (int)padding); if (cryptedlen != -1) { cryptedbuf = zend_string_alloc(cryptedlen, 0); @@ -5178,13 +5178,13 @@ PHP_FUNCTION(openssl_public_encrypt) cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = zend_string_alloc(cryptedlen, 0); - switch (pkey->type) { + switch (EVP_PKEY_id(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_public_encrypt((int)data_len, (unsigned char *)data, (unsigned char *)ZSTR_VAL(cryptedbuf), - pkey->pkey.rsa, + EVP_PKEY_get0_RSA(pkey), (int)padding) == cryptedlen); break; default: @@ -5241,13 +5241,13 @@ PHP_FUNCTION(openssl_public_decrypt) cryptedlen = EVP_PKEY_size(pkey); crypttemp = emalloc(cryptedlen + 1); - switch (pkey->type) { + switch (EVP_PKEY_id(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: cryptedlen = RSA_public_decrypt((int)data_len, (unsigned char *)data, crypttemp, - pkey->pkey.rsa, + EVP_PKEY_get0_RSA(pkey), (int)padding); if (cryptedlen != -1) { cryptedbuf = zend_string_alloc(cryptedlen, 0); diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 03f8953..9407e50 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -132,6 +132,10 @@ PHP_FUNCTION(openssl_get_cert_locations); #endif +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#define EVP_PKEY_get0_RSA(_pkey) _pkey->pkey.rsa +#endif + #endif /*

« previous php.cvs (#93257) next »