diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/asn1/x_algor.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509_local.h | 4 |
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 */ | 195 | int |
| 196 | 196 | X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md) | |
| 197 | void | ||
| 198 | X509_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 | |||
| 210 | void | ||
| 211 | X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md) | ||
| 212 | { | ||
| 213 | (void)X509_ALGOR_set_evp_md(alg, md); | ||
| 206 | } | 214 | } |
| 207 | 215 | ||
| 208 | int | 216 | int |
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 | ||
| 380 | int name_cmp(const char *name, const char *cmp); | 380 | int name_cmp(const char *name, const char *cmp); |
| 381 | 381 | ||
| 382 | int X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md); | ||
| 383 | |||
| 382 | int X509_policy_check(const STACK_OF(X509) *certs, | 384 | int 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); |
