-/* $OpenBSD: x_algor.c,v 1.36 2023/11/01 20:26:24 tb Exp $ */
+/* $OpenBSD: x_algor.c,v 1.37 2023/11/01 20:37:42 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
return 1;
}
+static int
+X509_ALGOR_set_obj_by_nid(X509_ALGOR *alg, int nid)
+{
+ ASN1_OBJECT *aobj;
+
+ if ((aobj = OBJ_nid2obj(nid)) == NULL)
+ return 0;
+ if (!X509_ALGOR_set0_obj(alg, aobj))
+ return 0;
+
+ return 1;
+}
+
static int
X509_ALGOR_set0_parameter(X509_ALGOR *alg, int parameter_type,
void *parameter_value)
return 1;
}
+int
+X509_ALGOR_set0_by_nid(X509_ALGOR *alg, int nid, int parameter_type,
+ void *parameter_value)
+{
+ if (alg == NULL)
+ return 0;
+
+ if (!X509_ALGOR_set_obj_by_nid(alg, nid))
+ return 0;
+
+ if (!X509_ALGOR_set0_parameter(alg, parameter_type, parameter_value))
+ return 0;
+
+ return 1;
+}
+
int
X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int parameter_type,
void *parameter_value)
-/* $OpenBSD: x509_local.h,v 1.10 2023/10/11 13:05:18 tb Exp $ */
+/* $OpenBSD: x509_local.h,v 1.11 2023/11/01 20:37:42 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2013.
*/
int name_cmp(const char *name, const char *cmp);
int X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md);
+int X509_ALGOR_set0_by_nid(X509_ALGOR *alg, int nid, int parameter_type,
+ void *parameter_value);
int X509_policy_check(const STACK_OF(X509) *certs,
const STACK_OF(ASN1_OBJECT) *user_policies, unsigned long flags,