summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/x_algor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/x_algor.c')
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c
index a638337939..092ad80d2d 100644
--- a/src/lib/libcrypto/asn1/x_algor.c
+++ b/src/lib/libcrypto/asn1/x_algor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_algor.c,v 1.26 2023/10/11 12:51:07 tb Exp $ */ 1/* $OpenBSD: x_algor.c,v 1.27 2023/10/11 13:05:18 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -192,17 +192,25 @@ X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval,
192 } 192 }
193} 193}
194 194
195/* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */ 195int
196 196X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md)
197void
198X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
199{ 197{
198 ASN1_OBJECT *aobj;
200 int param_type = V_ASN1_NULL; 199 int param_type = V_ASN1_NULL;
201 200
202 if ((EVP_MD_flags(md) & EVP_MD_FLAG_DIGALGID_ABSENT) != 0) 201 if ((EVP_MD_flags(md) & EVP_MD_FLAG_DIGALGID_ABSENT) != 0)
203 param_type = V_ASN1_UNDEF; 202 param_type = V_ASN1_UNDEF;
204 203
205 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); 204 if ((aobj = OBJ_nid2obj(EVP_MD_type(md))) == NULL)
205 return 0;
206
207 return X509_ALGOR_set0(alg, aobj, param_type, NULL);
208}
209
210void
211X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
212{
213 (void)X509_ALGOR_set_evp_md(alg, md);
206} 214}
207 215
208int 216int