Add "Title" directive to evp_test
authorRich Salz <rsalz@openssl.org>
Fri, 12 May 2017 14:03:09 +0000 (10:03 -0400)
committerRich Salz <rsalz@openssl.org>
Fri, 12 May 2017 18:20:01 +0000 (14:20 -0400)
Reviewed-by: Stephen Henson <steve@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3454)

test/evp_test.c
test/evpciph.txt
test/evpdigest.txt
test/evpencod.txt
test/evpkdf.txt
test/evpmac.txt
test/evppbe.txt
test/evppkey.txt
test/testutil/driver.c

index 685db4eebbd7b7a204eb0641cdbec2153bc04208..d042a4e8aecca051d7b5acd8598689628b597419 100644 (file)
@@ -564,8 +564,11 @@ static int parse_test_line(EVP_TEST *t, char *buf)
     }
     if (t->skip)
         return 1;
-    if (strcmp(keyword, "Result") == 0) {
-        if (t->expected_err) {
+    if (strcmp(keyword, "Title") == 0) {
+        TEST_info("Starting %s tests", value);
+        set_test_title(value);
+    } else if (strcmp(keyword, "Result") == 0) {
+        if (t->expected_err != NULL) {
             TEST_info("Line %d: multiple result lines", t->line);
             return 0;
         }
index 7dedd53eac7bb2c6c9a0d9296845bd0b4ae1a68d..f8ed3f1a43147156ff0687213f14a682af13f8e1 100644 (file)
@@ -19,6 +19,7 @@
 #   -K 000102030405060708090A0B0C0D0E0F1011121314151617 -iv 0001020304050607 |
 #  xxd -ps -u
 
+Title = DES EDE3 CFB1
 Cipher = DES-EDE3-CFB1
 Key = 000102030405060708090A0B0C0D0E0F1011121314151617
 IV = 0001020304050607
@@ -32,8 +33,7 @@ Operation = DECRYPT
 Plaintext = "Hello World"
 Ciphertext = 3CF55D656E9C0664513358
 
-# AES 128 ECB tests (from FIPS-197 test vectors, encrypt)
-
+Title = AES (from FIPS-197 test vectors)
 Cipher = AES-128-ECB
 Key = 000102030405060708090A0B0C0D0E0F
 Operation = ENCRYPT
@@ -94,6 +94,7 @@ Ciphertext = 8EA2B7CA516745BFEAFC49904B496089
 # For all ECB encrypts and decrypts, the transformed sequence is
 #   AES-bits-ECB:key::plaintext:ciphertext:encdec
 # ECB-AES128.Encrypt and ECB-AES128.Decrypt
+Title = AES tests from NIST document SP800-38A
 Cipher = AES-128-ECB
 Key = 2B7E151628AED2A6ABF7158809CF4F3C
 Plaintext = 6BC1BEE22E409F96E93D7E117393172A
index 897e69e9ca9e4f6520a49b511d804769018a5ce3..38ea7aca77df5fe335b4cc6fbacd4c8d6b98e88f 100644 (file)
@@ -17,6 +17,7 @@
 # Which is currently unsupported by OpenSSL.  They were generated using the
 # reference implementation.  RFC7693 also mentions the 616263 / "abc" values.
 
+Title = BLAKE2s256 Tests
 Digest = BLAKE2s256
 Input = 
 Output = 69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9
index 1bb869415615ae16eb71414f54641a706e0f32f1..c8bd84811dc86a5a0563ab4f105b3dc411ea25ba 100644 (file)
@@ -12,8 +12,7 @@
 # and continue until a blank line.  Lines starting with a pound sign,
 # like this prolog, are ignored.
 
-# Base64 tests
-
+Title = Base64 tests
 Encoding = canonical
 Input = ""
 Output = ""
index 9b4330f420059610619a7ff13c5a8918acc851aa..31fc355fd998d29a9269f14b0e3f1d9224b1b225 100644 (file)
@@ -12,8 +12,7 @@
 # and continue until a blank line.  Lines starting with a pound sign,
 # like this prolog, are ignored.
 
-# TLS1 PRF tests, from NIST test vectors
-
+Title = TLS1 PRF tests, from NIST test vectors
 KDF=TLS1-PRF
 Ctrl.md = md:MD5-SHA1
 Ctrl.Secret = hexsecret:bded7fa5c1699c010be23dd06ada3a48349f21e5f86263d512c0c5cc379f0e780ec55d9844b2f1db02a96453513568d0
index ba7bf0b2abc15c9f15c7456eb5ccdaf1eaf5c554..6467e1a6c4e95e4a719dfb44f42147c964305952 100644 (file)
@@ -15,6 +15,7 @@
 # SIPHASH tests - default values: 2,4 rounds, 16-byte mac
 # There are no official test vectors, they are simple vectors 1, 2, 3, etc
 
+Title = SIPHASH tests
 MAC = SipHash
 Key = 000102030405060708090A0B0C0D0E0F
 Input =
index 0eeefad51f50bb8f7d5ddd2bcfced56bc12e51ba..fd8424dc8f5a38ab180e4952589befd1a0a1dfe7 100644 (file)
@@ -12,7 +12,7 @@
 # and continue until a blank line.  Lines starting with a pound sign,
 # like this prolog, are ignored.
 
-# scrypt tests from draft-josefsson-scrypt-kdf-03
+Title = scrypt tests from draft-josefsson-scrypt-kdf-03
 PBE = scrypt
 Password = ""
 Salt = ""
@@ -51,8 +51,7 @@ Key = 2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4b
 #maxmem = 10000000000
 Result = SCRYPT_ERROR
 
-# PKCS#12 tests
-
+Title = PKCS#12 tests
 PBE = pkcs12
 id = 1
 iter = 1
@@ -101,7 +100,7 @@ Password = 007100750065006500670000
 Salt = 263216FCC2FAB31C
 Key = 5EC4C7A80DF652294C3925B6489A7AB857C83476
 
-# PBKDF2 tests
+Title = PBKDF2 tests
 PBE = pbkdf2
 Password = "password"
 Salt = "salt"
@@ -207,7 +206,7 @@ iter = 4096
 MD = sha512
 Key = 9d9e9c4cd21fe4be24d5b8244c759665
 
-# PBKDF2 tests for empty and NULL inputs
+Title = PBKDF2 tests for empty and NULL inputs
 PBE = pbkdf2
 Password = ""
 Salt = "salt"
index 050c57b604fcbf06ea3298a5376d4cf7e6eab24d..e49cb346ddff03eeee4307144e504db2c34462ae 100644 (file)
@@ -128,8 +128,7 @@ SzJw2oHciIOt+UU=
 PrivPubKeyPair = DSA-1024:DSA-1024-PUBLIC
 
 
-# RSA tests
-
+Title = RSA tests
 Sign = RSA-2048
 Ctrl = digest:SHA1
 Input = "0123456789ABCDEF1234"
@@ -377,15 +376,14 @@ Result = KEYOP_INIT_ERROR
 Function = EVP_PKEY_derive_init
 Reason = operation not supported for this keytype
 
-# Invalid ctrl
+Title = Invalid ctrl
 Sign = RSA-2048
 Ctrl = rsa_mgf1_md:sha1
 Result = PKEY_CTRL_INVALID
 Function = pkey_rsa_ctrl
 Reason = invalid mgf1 md
 
-# EC tests
-
+Title = EC tests
 Verify = P-256
 Ctrl = digest:SHA1
 Input = "0123456789ABCDEF1234"
index 7be6d2f66431864f5a31801494b1a0479388d5fb..8587304a7f22ba478608471587316be7ced28ce1 100644 (file)
@@ -121,11 +121,12 @@ static void finalize(int success)
         ERR_print_errors_cb(openssl_error_cb, NULL);
 }
 
-static const char *test_title = NULL;
+static char *test_title = NULL;
 
 void set_test_title(const char *title)
 {
-    test_title = title;
+    free(test_title);
+    test_title = title == NULL ? NULL : strdup(title);
 }
 
 int run_tests(const char *test_prog_name)