diff options
author | Jakub Zelenka <bukka@php.net> | 2016-01-02 17:01:35 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2016-01-02 17:01:54 +0000 |
commit | a866503bca8e9164ddd946f6465cc52e95768cdf (patch) | |
tree | c518903b84cebbbdea6dc8a2c61e19a6b99d6478 | |
parent | 52ffdf9fc3a97f52760b10bc15d825a1c12986e5 (diff) | |
download | php-git-a866503bca8e9164ddd946f6465cc52e95768cdf.tar.gz |
Test invalid auth tag length in encryption
-rw-r--r-- | ext/openssl/tests/openssl_encrypt_gcm.phpt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/openssl/tests/openssl_encrypt_gcm.phpt b/ext/openssl/tests/openssl_encrypt_gcm.phpt index 79dad7ba34..6c55404b50 100644 --- a/ext/openssl/tests/openssl_encrypt_gcm.phpt +++ b/ext/openssl/tests/openssl_encrypt_gcm.phpt @@ -21,8 +21,11 @@ foreach ($tests as $idx => $test) { var_dump($test['tag'] === $tag); } -echo "ERROR: IV\n"; +// Empty IV error var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, '')); + +// Failing to retrieve tag (max is 16 bytes) +var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 32), $tag, '', 20)); ?> --EXPECTF-- TEST 0 @@ -43,7 +46,9 @@ bool(true) TEST 5 bool(true) bool(true) -ERROR: IV Warning: openssl_encrypt(): Setting of IV length for AEAD mode failed, the expected length is 12 bytes in %s on line %d bool(false) + +Warning: openssl_encrypt(): Retrieving verification tag failed in %s on line %d +string(8) "S6+N0w==" |