Skip to content

Commit

Permalink
Revert "make inability to dup/clone ciphers an error"
Browse files Browse the repository at this point in the history
This reverts commit d739b3e.
  • Loading branch information
t8m committed Sep 12, 2023
1 parent 28c4f35 commit 2cdd8a1
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions test/evp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,6 @@ static int cipher_test_enc(EVP_TEST *t, int enc,
int ok = 0, tmplen, chunklen, tmpflen, i;
EVP_CIPHER_CTX *ctx_base = NULL;
EVP_CIPHER_CTX *ctx = NULL, *duped;
int fips_dupctx_supported = (fips_provider_version_ge(libctx, 3, 0, 11)
&& fips_provider_version_lt(libctx, 3, 1, 0))
|| fips_provider_version_ge(libctx, 3, 1, 3);

t->err = "TEST_FAILURE";
if (!TEST_ptr(ctx_base = EVP_CIPHER_CTX_new()))
Expand Down Expand Up @@ -842,30 +839,18 @@ static int cipher_test_enc(EVP_TEST *t, int enc,

/* Test that the cipher dup functions correctly if it is supported */
ERR_set_mark();
if (!EVP_CIPHER_CTX_copy(ctx, ctx_base)) {
if (fips_dupctx_supported) {
TEST_info("Doing a copy of Cipher %s Fails!\n",
EVP_CIPHER_get0_name(expected->cipher));
ERR_print_errors_fp(stderr);
goto err;
} else {
TEST_info("Allowing copy fail as an old fips provider is in use.");
}
if (EVP_CIPHER_CTX_copy(ctx, ctx_base)) {
EVP_CIPHER_CTX_free(ctx_base);
ctx_base = NULL;
} else {
EVP_CIPHER_CTX_free(ctx);
ctx = ctx_base;
}
/* Likewise for dup */
duped = EVP_CIPHER_CTX_dup(ctx);
if (duped != NULL) {
EVP_CIPHER_CTX_free(ctx);
ctx = duped;
} else {
if (fips_dupctx_supported) {
TEST_info("Doing a dup of Cipher %s Fails!\n",
EVP_CIPHER_get0_name(expected->cipher));
ERR_print_errors_fp(stderr);
goto err;
} else {
TEST_info("Allowing dup fail as an old fips provider is in use.");
}
}
ERR_pop_to_mark();

Expand Down Expand Up @@ -1050,7 +1035,6 @@ static int cipher_test_run(EVP_TEST *t)
int rv, frag = 0;
size_t out_misalign, inp_misalign;

TEST_info("RUNNING TEST FOR CIPHER %s\n", EVP_CIPHER_get0_name(cdat->cipher));
if (!cdat->key) {
t->err = "NO_KEY";
return 0;
Expand Down

0 comments on commit 2cdd8a1

Please sign in to comment.