summaryrefslogtreecommitdiff
path: root/ext/openssl/openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/openssl.c')
-rw-r--r--ext/openssl/openssl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index ed7a516a1e..e27dd7c273 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4653,10 +4653,9 @@ PHP_FUNCTION(openssl_decrypt)
return;
}
- if (!raw_input) {
- base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len);
- data_len = base64_str_len;
- data = base64_str;
+ if (!method_len) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm");
+ RETURN_FALSE;
}
cipher_type = EVP_get_cipherbyname(method);
@@ -4665,6 +4664,12 @@ PHP_FUNCTION(openssl_decrypt)
RETURN_FALSE;
}
+ if (!raw_input) {
+ base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len);
+ data_len = base64_str_len;
+ data = base64_str;
+ }
+
keylen = EVP_CIPHER_key_length(cipher_type);
if (keylen > password_len) {
key = emalloc(keylen);