aboutsummaryrefslogtreecommitdiff
path: root/test/hmactest.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-06-20 09:08:10 +0100
committerMatt Caswell <matt@openssl.org>2016-06-24 13:22:40 +0100
commita6211814c4c6f29358f29f639d468387b01518f8 (patch)
treefff1531b407a571af5431c53c0f17cea6248b95a /test/hmactest.c
parentd6079a87db58ad17550b5d00a74512464e6a029e (diff)
downloadopenssl-a6211814c4c6f29358f29f639d468387b01518f8.zip
openssl-a6211814c4c6f29358f29f639d468387b01518f8.tar.gz
openssl-a6211814c4c6f29358f29f639d468387b01518f8.tar.bz2
Add a getter to obtain the HMAC_CTX md
As a result of opaque HMAC_CTX apps need a getter for the HMAC_CTX md. GitHub Issue #1152 Reviewed-by: Tim Hudson <tjh@openssl.org>
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++;