summaryrefslogtreecommitdiffstats
path: root/test/endecode_test.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-03-17 08:52:36 +0100
committerRichard Levitte <levitte@openssl.org>2021-03-19 16:46:39 +0100
commitff1c10d920379854a80d43b69a58e20f1e76e76c (patch)
treeacf705051af22d99f2573fc2595bcb71b20ebfb8 /test/endecode_test.c
parentf4e46b817d587c300faa04fd061ddcdea3dd64c9 (diff)
TEST: Modify test/endecode_test.c to give the decoder callback the structure
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14314)
Diffstat (limited to 'test/endecode_test.c')
-rw-r--r--test/endecode_test.c15
1 files 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))