summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-03-29 15:38:10 +0000
committerMatt Caswell <matt@openssl.org>2019-04-03 15:50:13 +0100
commit64f4fff7967057ba2b963bd0a6ad5cdc64f27417 (patch)
treea4b247969fc35c9d2d85d6386366f7b712b9592c /test
parent7556b9df597ce43c1c31b294512d5146560f37c6 (diff)
Add a test for EVP_MD_block_size()
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8604)
Diffstat (limited to 'test')
-rw-r--r--test/evp_extra_test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index f763bb5d2a..d09eb31d58 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -1126,8 +1126,11 @@ static int test_EVP_MD_fetch(int tst)
/* Implicit fetching of the MD should produce the expected result */
if (!TEST_true(calculate_digest(EVP_sha256(), testmsg, sizeof(testmsg),
- exptd)))
+ exptd))
+ || !TEST_int_eq(EVP_MD_size(EVP_sha256()), SHA256_DIGEST_LENGTH)
+ || !TEST_int_eq(EVP_MD_block_size(EVP_sha256()), SHA256_CBLOCK))
goto err;
+
/*
* Test that without loading any providers or specifying any properties we
* can get a sha256 md from the default provider.
@@ -1135,7 +1138,9 @@ static int test_EVP_MD_fetch(int tst)
if (!TEST_ptr(md = EVP_MD_fetch(ctx, "SHA256", NULL))
|| !TEST_ptr(md)
|| !TEST_int_eq(EVP_MD_nid(md), NID_sha256)
- || !TEST_true(calculate_digest(md, testmsg, sizeof(testmsg), exptd)))
+ || !TEST_true(calculate_digest(md, testmsg, sizeof(testmsg), exptd))
+ || !TEST_int_eq(EVP_MD_size(md), SHA256_DIGEST_LENGTH)
+ || !TEST_int_eq(EVP_MD_block_size(md), SHA256_CBLOCK))
goto err;
/* Also test EVP_MD_upref() while we're doing this */
@@ -1156,7 +1161,9 @@ static int test_EVP_MD_fetch(int tst)
/* Explicitly asking for the default implementation should succeeed */
if (!TEST_ptr(md = EVP_MD_fetch(ctx, "SHA256", "default=yes"))
|| !TEST_int_eq(EVP_MD_nid(md), NID_sha256)
- || !TEST_true(calculate_digest(md, testmsg, sizeof(testmsg), exptd)))
+ || !TEST_true(calculate_digest(md, testmsg, sizeof(testmsg), exptd))
+ || !TEST_int_eq(EVP_MD_size(md), SHA256_DIGEST_LENGTH)
+ || !TEST_int_eq(EVP_MD_block_size(md), SHA256_CBLOCK))
goto err;
EVP_MD_meth_free(md);