diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2022-09-14 17:37:27 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2022-11-25 09:19:34 +0100 |
commit | 1c04866c671db4a6db0a1784399b351ea061bc16 (patch) | |
tree | eaed7780bd1644a107b2eb44b151c777de475072 /crypto/cmp | |
parent | 7e3034939b40ee15013bdba9ff6178de6bcc26d4 (diff) |
OSSL_CMP_CTX_reinit(): fix missing reset of ctx->genm_ITAVs
Otherwise, further OSSL_CMP_exec_GENM_ses() calls will go wrong.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19216)
Diffstat (limited to 'crypto/cmp')
-rw-r--r-- | crypto/cmp/cmp_ctx.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c index fd71ba099b..d415877760 100644 --- a/crypto/cmp/cmp_ctx.c +++ b/crypto/cmp/cmp_ctx.c @@ -148,6 +148,13 @@ OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq) return NULL; } +#define OSSL_CMP_ITAVs_free(itavs) \ + sk_OSSL_CMP_ITAV_pop_free(itavs, OSSL_CMP_ITAV_free); +#define X509_EXTENSIONS_free(exts) \ + sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free) +#define OSSL_CMP_PKIFREETEXT_free(text) \ + sk_ASN1_UTF8STRING_pop_free(text, ASN1_UTF8STRING_free) + /* Prepare the OSSL_CMP_CTX for next use, partly re-initializing OSSL_CMP_CTX */ int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx) { @@ -164,6 +171,9 @@ int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx) ctx->status = OSSL_CMP_PKISTATUS_unspecified; ctx->failInfoCode = -1; + OSSL_CMP_ITAVs_free(ctx->genm_ITAVs); + ctx->genm_ITAVs = NULL; + return ossl_cmp_ctx_set0_statusString(ctx, NULL) && ossl_cmp_ctx_set0_newCert(ctx, NULL) && ossl_cmp_ctx_set1_newChain(ctx, NULL) @@ -175,13 +185,6 @@ int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx) && ossl_cmp_ctx_set1_recipNonce(ctx, NULL); } -#define OSSL_CMP_ITAVs_free(itavs) \ - sk_OSSL_CMP_ITAV_pop_free(itavs, OSSL_CMP_ITAV_free); -#define X509_EXTENSIONS_free(exts) \ - sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free) -#define OSSL_CMP_PKIFREETEXT_free(text) \ - sk_ASN1_UTF8STRING_pop_free(text, ASN1_UTF8STRING_free) - /* Frees OSSL_CMP_CTX variables allocated in OSSL_CMP_CTX_new() */ void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx) { |