From ff1c10d920379854a80d43b69a58e20f1e76e76c Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 17 Mar 2021 08:52:36 +0100 Subject: [PATCH] TEST: Modify test/endecode_test.c to give the decoder callback the structure Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14314) --- test/endecode_test.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/endecode_test.c b/test/endecode_test.c index c3a86e38d5..6f69172623 100644 --- a/test/endecode_test.c +++ b/test/endecode_test.c @@ -112,8 +112,8 @@ typedef int (encoder)(void **encoded, long *encoded_len, const char *output_type, const char *output_structure, const char *pass, const char *pcipher); typedef int (decoder)(void **object, void *encoded, long encoded_len, - const char *keytype, const char *input_type, - int selection, const char *pass); + const char *input_type, const char *structure_type, + const char *keytype, int selection, const char *pass); typedef int (tester)(const void *data1, size_t data1_len, const void *data2, size_t data2_len); typedef int (checker)(const char *type, const void *data, size_t data_len); @@ -145,8 +145,9 @@ static int test_encode_decode(const char *type, EVP_PKEY *pkey, output_type, output_structure, pass, pcipher)) || !TEST_true(check_cb(type, encoded, encoded_len)) || !TEST_true(decode_cb((void **)&pkey2, encoded, encoded_len, + output_type, output_structure, (flags & FLAG_DECODE_WITH_TYPE ? type : NULL), - output_type, selection, pass)) + selection, pass)) || !TEST_true(encode_cb(&encoded2, &encoded2_len, pkey2, selection, output_type, output_structure, pass, pcipher))) goto end; @@ -226,8 +227,10 @@ static int encode_EVP_PKEY_prov(void **encoded, long *encoded_len, } static int decode_EVP_PKEY_prov(void **object, void *encoded, long encoded_len, - const char *keytype, const char *input_type, - int selection, const char *pass) + const char *input_type, + const char *structure_type, + const char *keytype, int selection, + const char *pass) { EVP_PKEY *pkey = NULL, *testpkey = NULL; OSSL_DECODER_CTX *dctx = NULL; @@ -258,7 +261,7 @@ static int decode_EVP_PKEY_prov(void **object, void *encoded, long encoded_len, if (!TEST_ptr(dctx = OSSL_DECODER_CTX_new_for_pkey(&testpkey, testtype, - NULL, + structure_type, keytype, selection, NULL, NULL))