diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-01-31 22:15:56 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-01-31 22:15:56 +0000 |
commit | 31a313501429e79c3cd64395103ea87cdf7701f5 (patch) | |
tree | ff62335a88f7838e3885f1b139e1478101c73fcc | |
parent | 0629bdb061766ea62b1f7fd732d3349945ed977e (diff) | |
download | php-git-31a313501429e79c3cd64395103ea87cdf7701f5.tar.gz |
Fixed bug #21986 (openssl test failure).
-rw-r--r-- | ext/openssl/openssl.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index dd125602b3..cde8e952b5 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1726,27 +1726,22 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * } } else { /* we want the private key */ + BIO *in; + if (filename) { - BIO *in; if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { return NULL; } in = BIO_new_file(filename, "r"); - if (in == NULL) { - return NULL; - } - key = PEM_read_bio_PrivateKey(in, NULL,NULL, passphrase); - BIO_free(in); } else { - BIO *b = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); - if (b == NULL) { - return NULL; - } - key = (EVP_PKEY *) PEM_ASN1_read_bio((char *(*)())d2i_PrivateKey, - PEM_STRING_EVP_PKEY, b, - NULL, NULL, passphrase); - BIO_free(b); + in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); + } + + if (in == NULL) { + return NULL; } + key = PEM_read_bio_PrivateKey(in, NULL,NULL, passphrase); + BIO_free(in); } } |