Skip to content

Commit

Permalink
Fix provider compatibility check crash in evp_test
Browse files Browse the repository at this point in the history
EVP_MAC_CTX_get_mac_size() cannot be called on older
unfixed versions before EVP_MAC_init().
  • Loading branch information
t8m committed Dec 11, 2023
1 parent 3cd209a commit 6966f62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/evp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,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;
Expand Down Expand Up @@ -1535,7 +1535,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, 1, 4))
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;
Expand Down

0 comments on commit 6966f62

Please sign in to comment.