aboutsummaryrefslogtreecommitdiff
path: root/test/hmactest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/hmactest.c')
-rw-r--r--test/hmactest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/hmactest.c b/test/hmactest.c
index 145c467..0f4348b 100644
--- a/test/hmactest.c
+++ b/test/hmactest.c
@@ -123,6 +123,11 @@ int main(int argc, char *argv[])
err++;
goto end;
}
+ if (HMAC_CTX_get_md(ctx) != NULL) {
+ printf("Message digest not NULL for HMAC (test 4)\n");
+ err++;
+ goto test5;
+ }
if (HMAC_Init_ex(ctx, NULL, 0, NULL, NULL)) {
printf("Should fail to initialise HMAC with empty MD and key (test 4)\n");
err++;
@@ -155,6 +160,11 @@ test5:
}
HMAC_CTX_reset(ctx);
+ if (HMAC_CTX_get_md(ctx) != NULL) {
+ printf("Message digest not NULL for HMAC (test 5)\n");
+ err++;
+ goto test6;
+ }
if (HMAC_Init_ex(ctx, test[4].key, test[4].key_len, NULL, NULL)) {
printf("Should fail to initialise HMAC with empty MD (test 5)\n");
err++;
@@ -202,6 +212,11 @@ test5:
err++;
goto test6;
}
+ if (HMAC_CTX_get_md(ctx) != EVP_sha256()) {
+ printf("Unexpected message digest for HMAC (test 5)\n");
+ err++;
+ goto test6;
+ }
if (!HMAC_Update(ctx, test[5].data, test[5].data_len)) {
printf("Error updating HMAC with data (sha256) (test 5)\n");
err++;