aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn_moid.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2002-02-22 14:07:35 +0000
committerDr. Stephen Henson <steve@openssl.org>2002-02-22 14:07:35 +0000
commit6707d22a40b8872aecae826943f6568b3e6343a9 (patch)
treeeb1fabe0527cef0cb0260cdee429208286904fb5 /crypto/asn1/asn_moid.c
parent3647bee263ebfef8694f7df07498a17b03ad883d (diff)
downloadopenssl-6707d22a40b8872aecae826943f6568b3e6343a9.tar.gz
Update from stable branch.
Diffstat (limited to 'crypto/asn1/asn_moid.c')
-rw-r--r--crypto/asn1/asn_moid.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/crypto/asn1/asn_moid.c b/crypto/asn1/asn_moid.c
index b033787988..be20db4bad 100644
--- a/crypto/asn1/asn_moid.c
+++ b/crypto/asn1/asn_moid.c
@@ -65,21 +65,31 @@
/* Simple ASN1 OID module: add all objects in a given section */
-/* NOTE: doesn't do anything other than print debug messages yet... */
static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
{
- fprintf(stderr, "Called oid_module_init: name %s, value %s\n",
- CONF_imodule_get_name(md), CONF_imodule_get_value(md));
+ int i;
+ const char *oid_section;
+ STACK_OF(CONF_VALUE) *sktmp;
+ CONF_VALUE *oval;
+ oid_section = CONF_imodule_get_value(md);
+ if(!(sktmp = NCONF_get_section(cnf, oid_section)))
+ {
+ ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ERROR_LOADING_SECTION);
+ return 0;
+ }
+ for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++)
+ {
+ oval = sk_CONF_VALUE_value(sktmp, i);
+ if(OBJ_create(oval->value, oval->name, oval->name) == NID_undef)
+ {
+ ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ADDING_OBJECT);
+ return 0;
+ }
+ }
return 1;
- }
-
-static void oid_module_finish(CONF_IMODULE *md)
- {
- fprintf(stderr, "Called oid_module_finish: name %s, value %s\n",
- CONF_imodule_get_name(md), CONF_imodule_get_value(md));
- }
+}
void ASN1_add_oid_module(void)
{
- CONF_module_add("oid_section", oid_module_init, oid_module_finish);
+ CONF_module_add("oid_section", oid_module_init, 0);
}