summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/new.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/examples/new.c b/examples/new.c
index 2bbe675..7f223f5 100644
--- a/examples/new.c
+++ b/examples/new.c
@@ -839,6 +839,47 @@ struct hash_vectors_st {
.output_size = 16,
.op = NCR_OP_MAC,
},
+ /* from rfc4231 */
+ {
+ .algorithm = NCR_ALG_HMAC_SHA2_224,
+ .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ .key_size = 20,
+ .plaintext = "Hi There",
+ .plaintext_size = sizeof("Hi There")-1,
+ .output = "\x89\x6f\xb1\x12\x8a\xbb\xdf\x19\x68\x32\x10\x7c\xd4\x9d\xf3\x3f\x47\xb4\xb1\x16\x99\x12\xba\x4f\x53\x68\x4b\x22",
+ .output_size = 28,
+ .op = NCR_OP_MAC,
+ },
+ {
+ .algorithm = NCR_ALG_HMAC_SHA2_256,
+ .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ .key_size = 20,
+ .plaintext = "Hi There",
+ .plaintext_size = sizeof("Hi There")-1,
+ .output = "\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf\x0b\xf1\x2b\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32\xcf\xf7",
+ .output_size = 32,
+ .op = NCR_OP_MAC,
+ },
+ {
+ .algorithm = NCR_ALG_HMAC_SHA2_384,
+ .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ .key_size = 20,
+ .plaintext = "Hi There",
+ .plaintext_size = sizeof("Hi There")-1,
+ .output = "\xaf\xd0\x39\x44\xd8\x48\x95\x62\x6b\x08\x25\xf4\xab\x46\x90\x7f\x15\xf9\xda\xdb\xe4\x10\x1e\xc6\x82\xaa\x03\x4c\x7c\xeb\xc5\x9c\xfa\xea\x9e\xa9\x07\x6e\xde\x7f\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6",
+ .output_size = 48,
+ .op = NCR_OP_MAC,
+ },
+ {
+ .algorithm = NCR_ALG_HMAC_SHA2_512,
+ .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ .key_size = 20,
+ .plaintext = "Hi There",
+ .plaintext_size = sizeof("Hi There")-1,
+ .output = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54",
+ .output_size = 64,
+ .op = NCR_OP_MAC,
+ },
};
@@ -892,7 +933,7 @@ test_ncr_hash(int cfd)
fprintf(stdout, "Tests on AES Encryption\n");
- for (i=0;i<sizeof(aes_vectors)/sizeof(aes_vectors[0]);i++) {
+ for (i=0;i<sizeof(hash_vectors)/sizeof(hash_vectors[0]);i++) {
/* import key */
if (hash_vectors[i].key != NULL) {