From 410f50bd22b0889630d713b10d529fc8c632f19e Mon Sep 17 00:00:00 2001 From: Rajeev Ranjan Date: Fri, 17 May 2024 13:00:24 +0200 Subject: [PATCH] fixup! CMP: add support for requesting cert template using genm/genp --- apps/lib/cmp_mock_srv.c | 4 ++-- crypto/cmp/cmp_asn.c | 1 + test/recipes/80-test_cmp_http_data/test_commands.csv | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/lib/cmp_mock_srv.c b/apps/lib/cmp_mock_srv.c index 2b3522a025009..ce62af2b007aa 100644 --- a/apps/lib/cmp_mock_srv.c +++ b/apps/lib/cmp_mock_srv.c @@ -514,8 +514,8 @@ static OSSL_CMP_ITAV *process_genm_itav(mock_srv_ctx *ctx, int req_nid, eckeyalg = OSSL_CMP_ATAV_new_algId(keyalg); rsakeylen = OSSL_CMP_ATAV_new_rsaKeyLen(4096); - ok = (OSSL_CMP_ATAV_push1(&keyspec, eckeyalg) - && OSSL_CMP_ATAV_push1(&keyspec, rsakeylen)); + ok = OSSL_CMP_ATAV_push1(&keyspec, eckeyalg) + && OSSL_CMP_ATAV_push1(&keyspec, rsakeylen); OSSL_CMP_ATAV_free(eckeyalg); OSSL_CMP_ATAV_free(rsakeylen); X509_ALGOR_free(keyalg); diff --git a/crypto/cmp/cmp_asn.c b/crypto/cmp/cmp_asn.c index 4174f51a24401..3bdb3ce688def 100644 --- a/crypto/cmp/cmp_asn.c +++ b/crypto/cmp/cmp_asn.c @@ -413,6 +413,7 @@ int OSSL_CMP_ITAV_get1_certReqTemplate(const OSSL_CMP_ITAV *itav, return 0; } + *certTemplate = NULL; if (keySpec != NULL) *keySpec = NULL; diff --git a/test/recipes/80-test_cmp_http_data/test_commands.csv b/test/recipes/80-test_cmp_http_data/test_commands.csv index 65e23210fe429..26b985bf65d32 100644 --- a/test/recipes/80-test_cmp_http_data/test_commands.csv +++ b/test/recipes/80-test_cmp_http_data/test_commands.csv @@ -97,8 +97,7 @@ expected,description, -section,val, -cmd,val,val2, -cacertsout,val,val2, -infoty 0,genm crlStatusList with wrong cert and correct crl, -section,, -cmd,genm,, BLANK,,, -infotype,crlStatusList,, -crlcert, server.crt, -oldcrl, oldcrl.pem,,, -crlout, _RESULT_DIR/test.crlout.pem ,,,,,,,,,,,,,,,,,,,,,, 1,genm certReqTemplate, -section,, -cmd,genm,, -template,_RESULT_DIR/test.template.der, -keyspec,_RESULT_DIR/test.keyspec.der, -infotype,certReqTemplate,,BLANK,,BLANK,,BLANK,,, -expect_sender, """" -0,genm certReqTemplate missing template option, -section,, -cmd,genm,, -template,"""",, -infotype,certReqTemplate,,BLANK,,BLANK, -0,genm certReqTemplate without template option, -section,, -cmd,genm,,,, -keyspec,_RESULT_DIR/test.keyspec.der, -infotype,certReqTemplate,,BLANK,,BLANK, +0,genm certReqTemplate missing template option, -section,, -cmd,genm,, -template,"""", -keyspec,_RESULT_DIR/test.keyspec.der, -infotype,certReqTemplate,,BLANK,,BLANK, 1,genm certReqTemplate without optional keyspec option, -section,, -cmd,genm,, -template,_RESULT_DIR/test.template.der, -keyspec,"""",, -infotype,certReqTemplate,,BLANK,,BLANK, 0,genm certReqTemplate missing template arg , -section,, -cmd,genm,, -template,BLANK, -keyspec,_RESULT_DIR/test.keyspec.der, -infotype,certReqTemplate,,BLANK,,BLANK, 0,genm certReqTemplate template extra arg , -section,, -cmd,genm,, -template,_RESULT_DIR/test.template.der,_RESULT_DIR/test.template.der, -infotype,certReqTemplate,,BLANK,,BLANK,