summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-12-11 15:19:47 +0100
committerTomas Mraz <tomas@openssl.org>2023-12-15 12:56:21 +0100
commit7481cb4e0357e4ec80b4c9c281ae3a8307f432e2 (patch)
tree892361c19a590070acd07a0dc189838859a738c5
parentb69acce8fb74617b77aadfd7986445026881e482 (diff)
Fix provider compatibility check crash in evp_test
EVP_MAC_CTX_get_mac_size() cannot be called on older unfixed versions before EVP_MAC_init(). Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/23009)
-rw-r--r--test/evp_test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index ed555766c0..e81213e2f8 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -1408,7 +1408,7 @@ static int mac_test_run_mac(EVP_TEST *t)
EVP_MAC_CTX *ctx = NULL;
unsigned char *got = NULL;
size_t got_len = 0, size = 0;
- size_t size_before_init, size_after_init, size_val = 0;
+ size_t size_before_init = 0, size_after_init, size_val = 0;
int i, block_size = -1, output_size = -1;
OSSL_PARAM params[21], sizes[3], *psizes = sizes;
size_t params_n = 0;
@@ -1516,7 +1516,8 @@ static int mac_test_run_mac(EVP_TEST *t)
t->err = "MAC_CREATE_ERROR";
goto err;
}
- size_before_init = EVP_MAC_CTX_get_mac_size(ctx);
+ if (fips_provider_version_gt(libctx, 3, 0, 12))
+ size_before_init = EVP_MAC_CTX_get_mac_size(ctx);
if (!EVP_MAC_init(ctx, expected->key, expected->key_len, params)) {
t->err = "MAC_INIT_ERROR";
goto err;