Add an EVP_MD_CTX_md() test
authorMatt Caswell <matt@openssl.org>
Fri, 29 Mar 2019 16:29:54 +0000 (16:29 +0000)
committerMatt Caswell <matt@openssl.org>
Wed, 3 Apr 2019 14:44:36 +0000 (15:44 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8614)

test/evp_extra_test.c

index f07ae94ad31113d1b657a2cc81d5d3332bfb2812..f763bb5d2add013aec9ea6f24a86cb4c47f1dc02 100644 (file)
@@ -1083,7 +1083,8 @@ static int calculate_digest(const EVP_MD *md, const char *msg, size_t len,
             || !TEST_true(EVP_DigestUpdate(ctx, msg, len))
             || !TEST_true(EVP_DigestFinal_ex(ctx, out, NULL))
             || !TEST_mem_eq(out, SHA256_DIGEST_LENGTH, exptd,
             || !TEST_true(EVP_DigestUpdate(ctx, msg, len))
             || !TEST_true(EVP_DigestFinal_ex(ctx, out, NULL))
             || !TEST_mem_eq(out, SHA256_DIGEST_LENGTH, exptd,
-                            SHA256_DIGEST_LENGTH))
+                            SHA256_DIGEST_LENGTH)
+            || !TEST_true(md == EVP_MD_CTX_md(ctx)))
         goto err;
 
     ret = 1;
         goto err;
 
     ret = 1;