Skip to content

Commit

Permalink
evp_libctx_test.c: remove OSSL_LIB_CTX_set0_default
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeev-0 committed Dec 7, 2023
1 parent aabec18 commit 8c4bfa9
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions test/evp_libctx_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ static int test_cipher_reinit(int test_id)
int out1_len = 0, out2_len = 0, out3_len = 0;
EVP_CIPHER *cipher = NULL;
EVP_CIPHER_CTX *ctx = NULL;
OSSL_LIB_CTX *prev_libctx = NULL;
unsigned char out1[256];
unsigned char out2[256];
unsigned char out3[256];
Expand Down Expand Up @@ -369,11 +368,6 @@ static int test_cipher_reinit(int test_id)
/* DES3-WRAP uses random every update - so it will give a different value */
diff = EVP_CIPHER_is_a(cipher, "DES3-WRAP");

/* eNULL-HMAC- use implicit fetching of digest algo */
if (EVP_CIPHER_is_a(cipher, "eNULL-HMAC-SHA256")
|| EVP_CIPHER_is_a(cipher, "eNULL-HMAC-SHA384"))
prev_libctx = OSSL_LIB_CTX_set0_default(libctx);

if (!TEST_true(EVP_EncryptInit_ex(ctx, cipher, NULL, key, iv))
|| !TEST_true(EVP_EncryptUpdate(ctx, out1, &out1_len, in, sizeof(in)))
|| !TEST_true(EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv))
Expand All @@ -399,9 +393,6 @@ static int test_cipher_reinit(int test_id)
}
ret = 1;
err:
/* restore the old libctx */
if (prev_libctx != NULL)
OSSL_LIB_CTX_set0_default(prev_libctx);
EVP_CIPHER_free(cipher);
EVP_CIPHER_CTX_free(ctx);
return ret;
Expand All @@ -419,7 +410,6 @@ static int test_cipher_reinit_partialupdate(int test_id)
int out1_len = 0, out2_len = 0, out3_len = 0;
EVP_CIPHER *cipher = NULL;
EVP_CIPHER_CTX *ctx = NULL;
OSSL_LIB_CTX *prev_libctx = NULL;
unsigned char out1[256];
unsigned char out2[256];
unsigned char out3[256];
Expand Down Expand Up @@ -456,11 +446,6 @@ static int test_cipher_reinit_partialupdate(int test_id)
if (!TEST_ptr(cipher = EVP_CIPHER_fetch(libctx, name, NULL)))
goto err;

/* eNULL-HMAC- use implicit fetching of digest algo */
if (EVP_CIPHER_is_a(cipher, "eNULL-HMAC-SHA256")
|| EVP_CIPHER_is_a(cipher, "eNULL-HMAC-SHA384"))
prev_libctx = OSSL_LIB_CTX_set0_default(libctx);

in_len = EVP_CIPHER_get_block_size(cipher) / 2;

/* skip any ciphers that don't allow partial updates */
Expand Down Expand Up @@ -492,9 +477,6 @@ static int test_cipher_reinit_partialupdate(int test_id)
}
ret = 1;
err:
/* restore the old libctx */
if (prev_libctx != NULL)
OSSL_LIB_CTX_set0_default(prev_libctx);
EVP_CIPHER_free(cipher);
EVP_CIPHER_CTX_free(ctx);
return ret;
Expand Down

0 comments on commit 8c4bfa9

Please sign in to comment.