diff options
author | Pauli <paul.dale@oracle.com> | 2018-11-05 08:09:41 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2018-11-05 08:09:41 +1000 |
commit | afc580b9b0af0072233e9282915424fd55c366d0 (patch) | |
tree | 182a1eaa1f9a96656c05df13aa006b75ad2cd9c6 /test/evp_test.c | |
parent | 2aaa0b146b967397a6e61fa8df969e7847f82086 (diff) |
GMAC implementation
Remove GMAC demo program because it has been superceded by the EVP MAC one
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7548)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r-- | test/evp_test.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/evp_test.c b/test/evp_test.c index 25b10d3314..18b20af5ff 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -838,6 +838,9 @@ typedef struct mac_data_st { /* MAC key */ unsigned char *key; size_t key_len; + /* MAC IV (GMAC) */ + unsigned char *iv; + size_t iv_len; /* Input to MAC */ unsigned char *input; size_t input_len; @@ -925,6 +928,7 @@ static void mac_test_cleanup(EVP_TEST *t) sk_OPENSSL_STRING_pop_free(mdat->controls, openssl_free); OPENSSL_free(mdat->alg); OPENSSL_free(mdat->key); + OPENSSL_free(mdat->iv); OPENSSL_free(mdat->input); OPENSSL_free(mdat->output); } @@ -936,6 +940,8 @@ static int mac_test_parse(EVP_TEST *t, if (strcmp(keyword, "Key") == 0) return parse_bin(value, &mdata->key, &mdata->key_len); + if (strcmp(keyword, "IV") == 0) + return parse_bin(value, &mdata->iv, &mdata->iv_len); if (strcmp(keyword, "Algorithm") == 0) { mdata->alg = OPENSSL_strdup(value); if (!mdata->alg) @@ -1119,6 +1125,18 @@ static int mac_test_run_mac(EVP_TEST *t) goto err; } + if (expected->iv != NULL) { + rv = EVP_MAC_ctrl(ctx, EVP_MAC_CTRL_SET_IV, + expected->iv, expected->iv_len); + if (rv == -2) { + t->err = "MAC_CTRL_INVALID"; + goto err; + } else if (rv <= 0) { + t->err = "MAC_CTRL_ERROR"; + goto err; + } + } + if (!EVP_MAC_init(ctx)) { t->err = "MAC_INIT_ERROR"; goto err; |