Rename OSSL_ENCODER_CTX_new_by_EVP_PKEY and OSSL_DECODER_CTX_new_by_EVP_PKEY
Additional renames done in encoder and decoder implementation
to follow the style.
Fixes #13622
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14155)
diff --git a/test/endecode_test.c b/test/endecode_test.c
index 178d0ca..b5da47d 100644
--- a/test/endecode_test.c
+++ b/test/endecode_test.c
@@ -198,10 +198,10 @@
const unsigned char *upass = (const unsigned char *)pass;
int ok = 0;
- if (!TEST_ptr(ectx = OSSL_ENCODER_CTX_new_by_EVP_PKEY(pkey, selection,
- output_type,
- output_structure,
- NULL))
+ if (!TEST_ptr(ectx = OSSL_ENCODER_CTX_new_for_pkey(pkey, selection,
+ output_type,
+ output_structure,
+ NULL))
|| !TEST_int_gt(OSSL_ENCODER_CTX_get_num_encoders(ectx), 0)
|| (pass != NULL
&& !TEST_true(OSSL_ENCODER_CTX_set_passphrase(ectx, upass,
@@ -256,12 +256,12 @@
const char *testtype = (i == 0) ? input_type
: ((i == 1) ? NULL : badtype);
- if (!TEST_ptr(dctx = OSSL_DECODER_CTX_new_by_EVP_PKEY(&testpkey,
- testtype,
- NULL,
- keytype,
- selection,
- NULL, NULL))
+ if (!TEST_ptr(dctx = OSSL_DECODER_CTX_new_for_pkey(&testpkey,
+ testtype,
+ NULL,
+ keytype,
+ selection,
+ NULL, NULL))
|| (pass != NULL
&& !OSSL_DECODER_CTX_set_passphrase(dctx, upass, strlen(pass)))
|| !TEST_int_gt(BIO_reset(encoded_bio), 0)
diff --git a/test/endecoder_legacy_test.c b/test/endecoder_legacy_test.c
index ffaa25d..64bbea0 100644
--- a/test/endecoder_legacy_test.c
+++ b/test/endecoder_legacy_test.c
@@ -317,9 +317,9 @@
goto end;
if (!TEST_ptr(ectx =
- OSSL_ENCODER_CTX_new_by_EVP_PKEY(provided_pkey, selection,
- "PEM", structure,
- NULL))
+ OSSL_ENCODER_CTX_new_for_pkey(provided_pkey, selection,
+ "PEM", structure,
+ NULL))
|| !TEST_true(OSSL_ENCODER_to_bio(ectx, membio_provided))
|| !TEST_true(pem_write_bio(membio_legacy, legacy_key,
NULL, NULL, 0, NULL, NULL))
@@ -331,10 +331,10 @@
if (!TEST_ptr(decoded_legacy_pkey = EVP_PKEY_new())
|| !TEST_ptr(dctx =
- OSSL_DECODER_CTX_new_by_EVP_PKEY(&decoded_provided_pkey,
- "PEM", structure,
- keytype, selection,
- NULL, NULL))
+ OSSL_DECODER_CTX_new_for_pkey(&decoded_provided_pkey,
+ "PEM", structure,
+ keytype, selection,
+ NULL, NULL))
|| !TEST_true(OSSL_DECODER_from_bio(dctx, membio_provided))
|| !TEST_ptr(decoded_legacy_key =
pem_read_bio(membio_legacy, NULL, NULL, NULL))
@@ -385,9 +385,9 @@
goto end;
if (!TEST_ptr(ectx =
- OSSL_ENCODER_CTX_new_by_EVP_PKEY(provided_pkey, selection,
- "PEM", structure,
- NULL))
+ OSSL_ENCODER_CTX_new_for_pkey(provided_pkey, selection,
+ "PEM", structure,
+ NULL))
|| !TEST_true(OSSL_ENCODER_to_bio(ectx, membio_provided))
|| !TEST_true(pem_write_bio(membio_legacy, legacy_key))
|| !test_membio_str_eq(membio_provided, membio_legacy))
@@ -398,10 +398,10 @@
if (!TEST_ptr(decoded_legacy_pkey = EVP_PKEY_new())
|| !TEST_ptr(dctx =
- OSSL_DECODER_CTX_new_by_EVP_PKEY(&decoded_provided_pkey,
- "PEM", structure,
- keytype, selection,
- NULL, NULL))
+ OSSL_DECODER_CTX_new_for_pkey(&decoded_provided_pkey,
+ "PEM", structure,
+ keytype, selection,
+ NULL, NULL))
|| !TEST_true(OSSL_DECODER_from_bio(dctx, membio_provided))
|| !TEST_ptr(decoded_legacy_key =
pem_read_bio(membio_legacy, NULL, NULL, NULL))
@@ -450,9 +450,9 @@
EVP_PKEY *decoded_provided_pkey = NULL;
if (!TEST_ptr(ectx =
- OSSL_ENCODER_CTX_new_by_EVP_PKEY(provided_pkey, selection,
- "DER", structure,
- NULL))
+ OSSL_ENCODER_CTX_new_for_pkey(provided_pkey, selection,
+ "DER", structure,
+ NULL))
|| !TEST_true(OSSL_ENCODER_to_data(ectx,
&der_provided, &der_provided_len))
|| !TEST_size_t_gt(der_legacy_len = i2d(legacy_key, &der_legacy), 0)
@@ -465,10 +465,10 @@
if (!TEST_ptr(decoded_legacy_pkey = EVP_PKEY_new())
|| !TEST_ptr(dctx =
- OSSL_DECODER_CTX_new_by_EVP_PKEY(&decoded_provided_pkey,
- "DER", structure,
- keytype, selection,
- NULL, NULL))
+ OSSL_DECODER_CTX_new_for_pkey(&decoded_provided_pkey,
+ "DER", structure,
+ keytype, selection,
+ NULL, NULL))
|| !TEST_true((pder_provided = der_provided,
tmp_size = der_provided_len,
OSSL_DECODER_from_data(dctx, &pder_provided,
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index b3f2ec6..2d32eb9 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -419,8 +419,8 @@
const unsigned char **pdata = &data;
EVP_PKEY *pkey = NULL;
OSSL_DECODER_CTX *dctx =
- OSSL_DECODER_CTX_new_by_EVP_PKEY(&pkey, "DER", NULL, keytype, 0,
- testctx, NULL);
+ OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, keytype, 0,
+ testctx, NULL);
/* |pkey| will be NULL on error */
(void)OSSL_DECODER_from_data(dctx, pdata, &data_len);
diff --git a/test/evp_libctx_test.c b/test/evp_libctx_test.c
index 0b8ea1c..302ec2c 100644
--- a/test/evp_libctx_test.c
+++ b/test/evp_libctx_test.c
@@ -474,10 +474,10 @@
|| !TEST_true(EVP_PKEY_CTX_set_rsa_keygen_bits(keygen_ctx, bits))
|| !TEST_int_gt(EVP_PKEY_keygen(keygen_ctx, priv), 0)
|| !TEST_ptr(ectx =
- OSSL_ENCODER_CTX_new_by_EVP_PKEY(*priv,
- EVP_PKEY_PUBLIC_KEY,
- "DER", "type-specific",
- NULL))
+ OSSL_ENCODER_CTX_new_for_pkey(*priv,
+ EVP_PKEY_PUBLIC_KEY,
+ "DER", "type-specific",
+ NULL))
|| !TEST_true(OSSL_ENCODER_to_data(ectx, &pub_der, &len)))
goto err;
pp = pub_der;
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c
index 85ae542..62a9346 100644
--- a/test/evp_pkey_provided_test.c
+++ b/test/evp_pkey_provided_test.c
@@ -219,10 +219,10 @@
/* Make a context, it's valid for several prints */
TEST_note("Setting up a OSSL_ENCODER context with passphrase");
- if (!TEST_ptr(ctx = OSSL_ENCODER_CTX_new_by_EVP_PKEY(pk, selection,
- output_type,
- output_structure,
- NULL))
+ if (!TEST_ptr(ctx = OSSL_ENCODER_CTX_new_for_pkey(pk, selection,
+ output_type,
+ output_structure,
+ NULL))
/* Check that this operation is supported */
|| !TEST_int_ne(OSSL_ENCODER_CTX_get_num_encoders(ctx), 0))
goto err;