com php-src: Add an initial openssl decrypt GCM test: ext/openssl/tests/openssl_decrypt_gcm.phpt
| From: | Jakub Zelenka | Date: | Wed, 30 Dec 2015 18:18:05 +0000 |
| Subject: | com php-src: Add an initial openssl decrypt GCM test: ext/openssl/tests/openssl_decrypt_gcm.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92484@lists.php.net to get a copy of this message | ||
Commit: 74f2998212fee8bac7f50e9dfbbfab4d0941fa27
Author: Jakub Zelenka <bukka@php.net> Wed, 30 Dec 2015 18:18:05 +0000
Parents: 8070e04733e5ccb204914bbe63f8983f27a8f717
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=74f2998212fee8bac7f50e9dfbbfab4d0941fa27
Log:
Add an initial openssl decrypt GCM test
Changed paths:
A 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
new file mode 100644
index 0000000..3f2686e
--- /dev/null
+++ b/ext/openssl/tests/openssl_decrypt_gcm.phpt
@@ -0,0 +1,36 @@
+--TEST--
+openssl_decrypt() with GCM cipher algorithm tests
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl"))
+ die("skip");
+if (!in_array('aes-128-gcm', openssl_get_cipher_methods()))
+ die("skip: aes-128-gcm not available");
+?>
+--FILE--
+<?php
+require_once __DIR__ . "/cipher_tests.inc";
+$method = 'aes-128-gcm';
+$tests = openssl_get_cipher_tests($method);
+
+foreach ($tests as $idx => $test) {
+ echo "TEST $idx\n";
+ $pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
+ $test['iv'], $test['tag'], $test['aad']);
+ var_dump($test['pt'] === $pt);
+}
+
+?>
+--EXPECT--
+TEST 0
+bool(true)
+TEST 1
+bool(true)
+TEST 2
+bool(true)
+TEST 3
+bool(true)
+TEST 4
+bool(true)
+TEST 5
+bool(true)