Skip to content

Commit

Permalink
evp_test: add a ctx dup operation to the KDF tests
Browse files Browse the repository at this point in the history
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from #17572)
  • Loading branch information
paulidale committed Feb 1, 2022
1 parent 5b030ec commit c8adf19
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/evp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2690,6 +2690,7 @@ static int kdf_test_run(EVP_TEST *t)
KDF_DATA *expected = t->data;
unsigned char *got = NULL;
size_t got_len = expected->output_len;
EVP_KDF_CTX *ctx;

if (!EVP_KDF_CTX_set_params(expected->ctx, expected->params)) {
t->err = "KDF_CTRL_ERROR";
Expand All @@ -2699,6 +2700,10 @@ static int kdf_test_run(EVP_TEST *t)
t->err = "INTERNAL_ERROR";
goto err;
}
if ((ctx = EVP_KDF_CTX_dup(expected->ctx)) != NULL) {
EVP_KDF_CTX_free(expected->ctx);
expected->ctx = ctx;
}
if (EVP_KDF_derive(expected->ctx, got, got_len, NULL) <= 0) {
t->err = "KDF_DERIVE_ERROR";
goto err;
Expand Down

0 comments on commit c8adf19

Please sign in to comment.