@@ -10,15 +10,17 @@ if (!in_array('aes-256-ccm', openssl_get_cipher_methods()))
1010--FILE--
1111<?php
1212require_once __DIR__ . "/cipher_tests.inc " ;
13- $ method = 'aes-256-ccm ' ;
14- $ tests = openssl_get_cipher_tests ($ method );
13+ $ methods = ['aes-128-ccm ' , 'aes-256-ccm ' ];
1514
16- foreach ($ tests as $ idx => $ test ) {
17- echo "TEST $ idx \n" ;
18- $ ct = openssl_encrypt ($ test ['pt ' ], $ method , $ test ['key ' ], OPENSSL_RAW_DATA ,
19- $ test ['iv ' ], $ tag , $ test ['aad ' ], strlen ($ test ['tag ' ]));
20- var_dump ($ test ['ct ' ] === $ ct );
21- var_dump ($ test ['tag ' ] === $ tag );
15+ foreach ($ methods as $ method ) {
16+ $ tests = openssl_get_cipher_tests ($ method );
17+ foreach ($ tests as $ idx => $ test ) {
18+ echo "$ method - TEST $ idx \n" ;
19+ $ ct = openssl_encrypt ($ test ['pt ' ], $ method , $ test ['key ' ], OPENSSL_RAW_DATA ,
20+ $ test ['iv ' ], $ tag , $ test ['aad ' ], strlen ($ test ['tag ' ]));
21+ var_dump ($ test ['ct ' ] === $ ct );
22+ var_dump ($ test ['tag ' ] === $ tag );
23+ }
2224}
2325
2426// Empty IV error
@@ -32,7 +34,13 @@ var_dump(strlen($tag));
3234var_dump (openssl_encrypt ('data ' , $ method , 'password ' , 0 , str_repeat ('x ' , 16 ), $ tag , '' , 1024 ));
3335?>
3436--EXPECTF--
35- TEST 0
37+ aes-128-ccm - TEST 0
38+ bool(true)
39+ bool(true)
40+ aes-128-ccm - TEST 1
41+ bool(true)
42+ bool(true)
43+ aes-256-ccm - TEST 0
3644bool(true)
3745bool(true)
3846
0 commit comments