summaryrefslogtreecommitdiff
path: root/ext/openssl/tests/cipher_tests.inc
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2015-12-28 19:16:05 +0000
committerJakub Zelenka <bukka@php.net>2015-12-28 19:16:05 +0000
commita00d1eccc72ab116b30ffbab52f8fab86f27a851 (patch)
tree8ec0b29c670110958e8cd03072204b0ace172df5 /ext/openssl/tests/cipher_tests.inc
parent5e9540f77dc5fba67ee69e5a38b79ced28f42368 (diff)
downloadphp-git-a00d1eccc72ab116b30ffbab52f8fab86f27a851.tar.gz
Add an initial openssl encrypt GCM test
Diffstat (limited to 'ext/openssl/tests/cipher_tests.inc')
-rw-r--r--ext/openssl/tests/cipher_tests.inc32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/openssl/tests/cipher_tests.inc b/ext/openssl/tests/cipher_tests.inc
new file mode 100644
index 0000000000..41240a594c
--- /dev/null
+++ b/ext/openssl/tests/cipher_tests.inc
@@ -0,0 +1,32 @@
+<?php
+$php_openssl_cipher_tests = array(
+ 'aes-128-gcm' => array(
+ array(
+ 'key' => '00000000000000000000000000000000',
+ 'iv' => '000000000000000000000000',
+ 'tag' => 'ab6e47d42cec13bdf53a67b21257bddf',
+ 'pt' => '00000000000000000000000000000000',
+ 'ct' => '0388dace60b6a392f328c2b971b2fe78',
+ ),
+ )
+);
+
+function openssl_get_cipher_tests($method)
+{
+ global $php_openssl_cipher_tests;
+
+ $tests = array();
+
+ foreach ($php_openssl_cipher_tests[$method] as $instance) {
+ $test = array();
+ foreach ($instance as $field_name => $field_value) {
+ $test[$field_name] = pack("H*", $field_value);
+ }
+ if (!isset($test['aad'])) {
+ $test['aad'] = "";
+ }
+ $tests[] = $test;
+ }
+
+ return $tests;
+}