From 4c3df036cdefb2caac7ade08cbb08eb9b1c93075 Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 1 Nov 2023 20:26:24 +0000 Subject: [PATCH] Explain the weird order of doing things in X509_ALGOR_set0() --- lib/libcrypto/asn1/x_algor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcrypto/asn1/x_algor.c b/lib/libcrypto/asn1/x_algor.c index 59e2adc9282..76b78028ad5 100644 --- a/lib/libcrypto/asn1/x_algor.c +++ b/lib/libcrypto/asn1/x_algor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_algor.c,v 1.35 2023/11/01 20:25:27 tb Exp $ */ +/* $OpenBSD: x_algor.c,v 1.36 2023/11/01 20:26:24 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -187,6 +187,7 @@ X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int parameter_type, if (alg == NULL) return 0; + /* Set parameter first to preserve public API behavior on failure. */ if (!X509_ALGOR_set0_parameter(alg, parameter_type, parameter_value)) return 0; -- 2.20.1