com php-src: Test error cases in openssl_decrypt for GCM mode: ext/openssl/tests/openssl_decrypt_gcm.phpt
| From: | Jakub Zelenka | Date: | Sun, 03 Jan 2016 17:25:59 +0000 |
| Subject: | com php-src: Test error cases in openssl_decrypt for GCM mode: ext/openssl/tests/openssl_decrypt_gcm.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92478@lists.php.net to get a copy of this message | ||
Commit: 8daecc59eb62516e2f6b703150c4d3e78ab55b75
Author: Jakub Zelenka <bukka@php.net> Sun, 3 Jan 2016 17:25:59 +0000
Parents: 651e6b628b9588674367b892106c76eeb11f4353
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8daecc59eb62516e2f6b703150c4d3e78ab55b75
Log:
Test error cases in openssl_decrypt for GCM mode
Changed paths:
M ext/openssl/tests/openssl_decrypt_gcm.phpt
Diff:
diff --git a/ext/openssl/tests/openssl_decrypt_gcm.phpt b/ext/openssl/tests/openssl_decrypt_gcm.phpt
index 3f2686e..0202e64 100644
--- a/ext/openssl/tests/openssl_decrypt_gcm.phpt
+++ b/ext/openssl/tests/openssl_decrypt_gcm.phpt
@@ -20,8 +20,15 @@ foreach ($tests as $idx => $test) {
var_dump($test['pt'] === $pt);
}
+// no IV
+var_dump(openssl_decrypt($test['ct'], $method, $test['key'], 0, NULL,
$test['tag'], $test['aad']));
+// failed because no AAD
+var_dump(openssl_decrypt($test['ct'], $method, $test['key'], 0,
$test['iv'], $test['tag']));
+// failed because wrong tag
+var_dump(openssl_decrypt($test['ct'], $method, $test['key'], 0,
$test['iv'], str_repeat('x', 16), $test['aad']));
+
?>
---EXPECT--
+--EXPECTF--
TEST 0
bool(true)
TEST 1
@@ -34,3 +41,8 @@ TEST 4
bool(true)
TEST 5
bool(true)
+
+Warning: openssl_decrypt(): Setting of IV length for AEAD mode failed, the expected length is 12
bytes in %s on line %d
+bool(false)
+bool(false)
+bool(false)