From: Dr. David von Oheimb Date: Mon, 19 Sep 2022 11:15:04 +0000 (+0200) Subject: add missing OSSL_CMP_CTX_reset_geninfo_ITAVs() function X-Git-Tag: openssl-3.2.0-alpha1~1665 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2ede0396addd13f7fe9a629b450a14892152a83;p=thirdparty%2Fopenssl.git add missing OSSL_CMP_CTX_reset_geninfo_ITAVs() function Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/19216) --- diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c index d415877760e..dcad9c89415 100644 --- a/crypto/cmp/cmp_ctx.c +++ b/crypto/cmp/cmp_ctx.c @@ -517,6 +517,17 @@ int OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav) return OSSL_CMP_ITAV_push0_stack_item(&ctx->geninfo_ITAVs, itav); } +int OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx) +{ + if (ctx == NULL) { + ERR_raise(ERR_LIB_CMP, CMP_R_NULL_ARGUMENT); + return 0; + } + OSSL_CMP_ITAVs_free(ctx->geninfo_ITAVs); + ctx->geninfo_ITAVs = NULL; + return 1; +} + /* Add an itav for the body of outgoing general messages */ int OSSL_CMP_CTX_push0_genm_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav) { diff --git a/doc/man3/OSSL_CMP_CTX_new.pod b/doc/man3/OSSL_CMP_CTX_new.pod index 1bdcf5fb6d5..de0267c10fd 100644 --- a/doc/man3/OSSL_CMP_CTX_new.pod +++ b/doc/man3/OSSL_CMP_CTX_new.pod @@ -38,6 +38,7 @@ OSSL_CMP_CTX_set1_referenceValue, OSSL_CMP_CTX_set1_secretValue, OSSL_CMP_CTX_set1_recipient, OSSL_CMP_CTX_push0_geninfo_ITAV, +OSSL_CMP_CTX_reset_geninfo_ITAVs, OSSL_CMP_CTX_set1_extraCertsOut, OSSL_CMP_CTX_set0_newPkey, OSSL_CMP_CTX_get0_newPkey, @@ -124,6 +125,7 @@ OSSL_CMP_CTX_set1_senderNonce /* CMP message header and extra certificates: */ int OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name); int OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav); + int OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx); int OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx, STACK_OF(X509) *extraCertsOut); @@ -530,6 +532,9 @@ OSSL_CMP_CTX_push0_geninfo_ITAV() adds I to the stack in the I to be added to the GeneralInfo field of the CMP PKIMessage header of a request message sent with this context. +OSSL_CMP_CTX_reset_geninfo_ITAVs() +clears any ITAVs that were added by OSSL_CMP_CTX_push0_geninfo_ITAV(). + OSSL_CMP_CTX_set1_extraCertsOut() sets the stack of extraCerts that will be sent to remote. @@ -732,7 +737,8 @@ OSSL_CMP_certConf_cb() returns I if it is not equal to 0, else 0 on successful validation, or else a bit field with the B bit set. -All other functions, including OSSL_CMP_CTX_reinit(), +All other functions, including OSSL_CMP_CTX_reinit() +and OSSL_CMP_CTX_reset_geninfo_ITAVs(), return 1 on success, 0 on error. =head1 EXAMPLES @@ -813,6 +819,8 @@ OSSL_CMP_CTX_set0_trustedStore() was renamed to OSSL_CMP_CTX_set0_trusted(), using macros, while keeping the old names for backward compatibility, in OpenSSL 3.2. +OSSL_CMP_CTX_reset_geninfo_ITAVs() was added in OpenSSL 3.0.8. + OSSL_CMP_CTX_get0_libctx(), OSSL_CMP_CTX_get0_propq(), and OSSL_CMP_CTX_get0_validatedSrvCert() were added in OpenSSL 3.2. diff --git a/include/openssl/cmp.h.in b/include/openssl/cmp.h.in index 79c9414e30d..ea45c60548e 100644 --- a/include/openssl/cmp.h.in +++ b/include/openssl/cmp.h.in @@ -334,6 +334,7 @@ int OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx, const unsigned char *sec, /* CMP message header and extra certificates: */ int OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name); int OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav); +int OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx); int OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx, STACK_OF(X509) *extraCertsOut); /* certificate template: */ diff --git a/util/libcrypto.num b/util/libcrypto.num index 139a5e1641b..72cdb4f7606 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -5446,6 +5446,7 @@ ASYNC_get_mem_functions ? 3_2_0 EXIST::FUNCTION: BIO_ADDR_dup ? 3_2_0 EXIST::FUNCTION:SOCK OSSL_CMP_CTX_get0_libctx ? 3_2_0 EXIST::FUNCTION:CMP OSSL_CMP_CTX_get0_propq ? 3_2_0 EXIST::FUNCTION:CMP +OSSL_CMP_CTX_reset_geninfo_ITAVs ? 3_0_8 EXIST::FUNCTION:CMP OSSL_CMP_CTX_get0_validatedSrvCert ? 3_2_0 EXIST::FUNCTION:CMP OSSL_CRMF_CERTTEMPLATE_get0_publicKey ? 3_2_0 EXIST::FUNCTION:CRMF CMS_final_digest ? 3_2_0 EXIST::FUNCTION:CMS