From 10ef080fc7bb7acbbd074582d1b8df755eccbbd6 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 1 Nov 2023 20:19:16 +0000 Subject: Split X509_ALGOR_set0_parameter() out of X509_ALGOR_set0() ok jsing --- src/lib/libcrypto/asn1/x_algor.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/lib/libcrypto/asn1') diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c index d91efe9323..869625036a 100644 --- a/src/lib/libcrypto/asn1/x_algor.c +++ b/src/lib/libcrypto/asn1/x_algor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_algor.c,v 1.32 2023/11/01 20:14:51 tb Exp $ */ +/* $OpenBSD: x_algor.c,v 1.33 2023/11/01 20:19:16 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -158,12 +158,9 @@ X509_ALGOR_set0_obj(X509_ALGOR *alg, ASN1_OBJECT *aobj) return 1; } -int -X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) +static int +X509_ALGOR_set0_parameter(X509_ALGOR *alg, int ptype, void *pval) { - if (alg == NULL) - return 0; - if (ptype == V_ASN1_UNDEF) { ASN1_TYPE_free(alg->parameter); alg->parameter = NULL; @@ -176,6 +173,18 @@ X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) ASN1_TYPE_set(alg->parameter, ptype, pval); } + return 1; +} + +int +X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) +{ + if (alg == NULL) + return 0; + + if (!X509_ALGOR_set0_parameter(alg, ptype, pval)) + return 0; + if (!X509_ALGOR_set0_obj(alg, aobj)) return 0; -- cgit v1.2.3-55-g6feb