summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c20
-rw-r--r--src/lib/libcrypto/x509/x509_local.h4
2 files changed, 17 insertions, 7 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
diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h
index f00a55bac8..44fe6ad805 100644
--- a/src/lib/libcrypto/x509/x509_local.h
+++ b/src/lib/libcrypto/x509/x509_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_local.h,v 1.9 2023/05/28 05:25:24 tb Exp $ */ 1/* $OpenBSD: x509_local.h,v 1.10 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 2013. 3 * project 2013.
4 */ 4 */
@@ -379,6 +379,8 @@ int x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int quiet);
379 379
380int name_cmp(const char *name, const char *cmp); 380int name_cmp(const char *name, const char *cmp);
381 381
382int X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md);
383
382int X509_policy_check(const STACK_OF(X509) *certs, 384int X509_policy_check(const STACK_OF(X509) *certs,
383 const STACK_OF(ASN1_OBJECT) *user_policies, unsigned long flags, 385 const STACK_OF(ASN1_OBJECT) *user_policies, unsigned long flags,
384 X509 **out_current_cert); 386 X509 **out_current_cert);