summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509
diff options
context:
space:
mode:
authortb <>2023-11-01 20:37:42 +0000
committertb <>2023-11-01 20:37:42 +0000
commit364f22e5455745dad2aad23f0d3abc0c7461edda (patch)
tree096fff81e30ca03dd34347beb2f73d664206a18b /src/lib/libcrypto/x509
parentde1587b78c4c5e44d3bf66cd6d9ceb8512074016 (diff)
downloadopenbsd-364f22e5455745dad2aad23f0d3abc0c7461edda.tar.gz
openbsd-364f22e5455745dad2aad23f0d3abc0c7461edda.tar.bz2
openbsd-364f22e5455745dad2aad23f0d3abc0c7461edda.zip
Add X509_ALGOR_set0_by_nid()
X509_ALGOR_set0() is annoyingly unergonomic since it takes an ASN1_OBJECT rather than a nid. This means that almost all callers call OBJ_obj2nid() and they often do this inline without error checking so that the resulting X509_ALGOR object is corrupted and may lead to incorrect encodings. Provide an internal alternative X509_ALGOR_set0_by_nid() that takes a nid instead of an ASN1_OBJECT and performs proper error checking. This will be used to convert callers of X509_ALGOR_set0() in the library. ok jsing
Diffstat (limited to 'src/lib/libcrypto/x509')
-rw-r--r--src/lib/libcrypto/x509/x509_local.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h
index 44fe6ad805..63082d1b19 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.10 2023/10/11 13:05:18 tb Exp $ */ 1/* $OpenBSD: x509_local.h,v 1.11 2023/11/01 20:37:42 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 */
@@ -380,6 +380,8 @@ int x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int quiet);
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); 382int X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md);
383int X509_ALGOR_set0_by_nid(X509_ALGOR *alg, int nid, int parameter_type,
384 void *parameter_value);
383 385
384int X509_policy_check(const STACK_OF(X509) *certs, 386int X509_policy_check(const STACK_OF(X509) *certs,
385 const STACK_OF(ASN1_OBJECT) *user_policies, unsigned long flags, 387 const STACK_OF(ASN1_OBJECT) *user_policies, unsigned long flags,