diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-11-01 20:14:52 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-11-01 20:14:52 +0000 |
commit | 80b80e8b9c8337a0367f24856fccf4d837122fec (patch) | |
tree | 653b4a0109662065c6f0d4e08df16a0ad61bf8aa | |
parent | c0326962d19deb728e39f433f915ead4b435a3fa (diff) |
Split X509_ALGOR_set0_obj() out of X509_ALGOR_set0()
ok jsing
-rw-r--r-- | lib/libcrypto/asn1/x_algor.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libcrypto/asn1/x_algor.c b/lib/libcrypto/asn1/x_algor.c index 0a80b863dea..d91efe93237 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.31 2023/10/11 13:22:11 tb Exp $ */ +/* $OpenBSD: x_algor.c,v 1.32 2023/11/01 20:14:51 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -149,6 +149,15 @@ X509_ALGOR_dup(X509_ALGOR *x) return ASN1_item_dup(&X509_ALGOR_it, x); } +static int +X509_ALGOR_set0_obj(X509_ALGOR *alg, ASN1_OBJECT *aobj) +{ + ASN1_OBJECT_free(alg->algorithm); + alg->algorithm = aobj; + + return 1; +} + int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) { @@ -167,8 +176,8 @@ X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) ASN1_TYPE_set(alg->parameter, ptype, pval); } - ASN1_OBJECT_free(alg->algorithm); - alg->algorithm = aobj; + if (!X509_ALGOR_set0_obj(alg, aobj)) + return 0; return 1; } |