diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_conf.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c index 454b80937c..50f5bb2e66 100644 --- a/src/lib/libcrypto/x509/x509_conf.c +++ b/src/lib/libcrypto/x509/x509_conf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_conf.c,v 1.12 2024/06/18 05:37:24 tb Exp $ */ | 1 | /* $OpenBSD: x509_conf.c,v 1.13 2024/06/18 05:39:52 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -70,7 +70,7 @@ | |||
70 | 70 | ||
71 | static int v3_check_critical(const char **value); | 71 | static int v3_check_critical(const char **value); |
72 | static int v3_check_generic(const char **value); | 72 | static int v3_check_generic(const char **value); |
73 | static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, | 73 | static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int nid, |
74 | int crit, const char *value); | 74 | int crit, const char *value); |
75 | static X509_EXTENSION *v3_generic_extension(const char *ext, const char *value, | 75 | static X509_EXTENSION *v3_generic_extension(const char *ext, const char *value, |
76 | int crit, int type, X509V3_CTX *ctx); | 76 | int crit, int type, X509V3_CTX *ctx); |
@@ -78,7 +78,7 @@ static char *conf_lhash_get_string(void *db, const char *section, | |||
78 | const char *value); | 78 | const char *value); |
79 | static STACK_OF(CONF_VALUE) *conf_lhash_get_section(void *db, | 79 | static STACK_OF(CONF_VALUE) *conf_lhash_get_section(void *db, |
80 | const char *section); | 80 | const char *section); |
81 | static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, | 81 | static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, |
82 | int crit, void *ext_struc); | 82 | int crit, void *ext_struc); |
83 | static unsigned char *generic_asn1(const char *value, X509V3_CTX *ctx, | 83 | static unsigned char *generic_asn1(const char *value, X509V3_CTX *ctx, |
84 | long *ext_len); | 84 | long *ext_len); |
@@ -109,7 +109,7 @@ LCRYPTO_ALIAS(X509V3_EXT_nconf); | |||
109 | /* CONF *conf: Config file */ | 109 | /* CONF *conf: Config file */ |
110 | /* char *value: Value */ | 110 | /* char *value: Value */ |
111 | X509_EXTENSION * | 111 | X509_EXTENSION * |
112 | X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, | 112 | X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int nid, |
113 | const char *value) | 113 | const char *value) |
114 | { | 114 | { |
115 | int crit; | 115 | int crit; |
@@ -117,27 +117,27 @@ X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, | |||
117 | 117 | ||
118 | crit = v3_check_critical(&value); | 118 | crit = v3_check_critical(&value); |
119 | if ((ext_type = v3_check_generic(&value))) | 119 | if ((ext_type = v3_check_generic(&value))) |
120 | return v3_generic_extension(OBJ_nid2sn(ext_nid), | 120 | return v3_generic_extension(OBJ_nid2sn(nid), |
121 | value, crit, ext_type, ctx); | 121 | value, crit, ext_type, ctx); |
122 | return do_ext_nconf(conf, ctx, ext_nid, crit, value); | 122 | return do_ext_nconf(conf, ctx, nid, crit, value); |
123 | } | 123 | } |
124 | LCRYPTO_ALIAS(X509V3_EXT_nconf_nid); | 124 | LCRYPTO_ALIAS(X509V3_EXT_nconf_nid); |
125 | 125 | ||
126 | /* CONF *conf: Config file */ | 126 | /* CONF *conf: Config file */ |
127 | /* char *value: Value */ | 127 | /* char *value: Value */ |
128 | static X509_EXTENSION * | 128 | static X509_EXTENSION * |
129 | do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, int crit, | 129 | do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int nid, int crit, |
130 | const char *value) | 130 | const char *value) |
131 | { | 131 | { |
132 | const X509V3_EXT_METHOD *method; | 132 | const X509V3_EXT_METHOD *method; |
133 | X509_EXTENSION *ext; | 133 | X509_EXTENSION *ext; |
134 | void *ext_struc; | 134 | void *ext_struc; |
135 | 135 | ||
136 | if (ext_nid == NID_undef) { | 136 | if (nid == NID_undef) { |
137 | X509V3error(X509V3_R_UNKNOWN_EXTENSION_NAME); | 137 | X509V3error(X509V3_R_UNKNOWN_EXTENSION_NAME); |
138 | return NULL; | 138 | return NULL; |
139 | } | 139 | } |
140 | if (!(method = X509V3_EXT_get_nid(ext_nid))) { | 140 | if (!(method = X509V3_EXT_get_nid(nid))) { |
141 | X509V3error(X509V3_R_UNKNOWN_EXTENSION); | 141 | X509V3error(X509V3_R_UNKNOWN_EXTENSION); |
142 | return NULL; | 142 | return NULL; |
143 | } | 143 | } |
@@ -152,7 +152,7 @@ do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, int crit, | |||
152 | if (sk_CONF_VALUE_num(nval) <= 0) { | 152 | if (sk_CONF_VALUE_num(nval) <= 0) { |
153 | X509V3error(X509V3_R_INVALID_EXTENSION_STRING); | 153 | X509V3error(X509V3_R_INVALID_EXTENSION_STRING); |
154 | ERR_asprintf_error_data("name=%s,section=%s", | 154 | ERR_asprintf_error_data("name=%s,section=%s", |
155 | OBJ_nid2sn(ext_nid), value); | 155 | OBJ_nid2sn(nid), value); |
156 | if (*value != '@') | 156 | if (*value != '@') |
157 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); | 157 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); |
158 | return NULL; | 158 | return NULL; |
@@ -170,13 +170,13 @@ do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, int crit, | |||
170 | ext_struc = method->r2i(method, ctx, value); | 170 | ext_struc = method->r2i(method, ctx, value); |
171 | } else { | 171 | } else { |
172 | X509V3error(X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED); | 172 | X509V3error(X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED); |
173 | ERR_asprintf_error_data("name=%s", OBJ_nid2sn(ext_nid)); | 173 | ERR_asprintf_error_data("name=%s", OBJ_nid2sn(nid)); |
174 | return NULL; | 174 | return NULL; |
175 | } | 175 | } |
176 | if (ext_struc == NULL) | 176 | if (ext_struc == NULL) |
177 | return NULL; | 177 | return NULL; |
178 | 178 | ||
179 | ext = do_ext_i2d(method, ext_nid, crit, ext_struc); | 179 | ext = do_ext_i2d(method, nid, crit, ext_struc); |
180 | if (method->it) | 180 | if (method->it) |
181 | ASN1_item_free(ext_struc, method->it); | 181 | ASN1_item_free(ext_struc, method->it); |
182 | else | 182 | else |
@@ -185,7 +185,7 @@ do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, int crit, | |||
185 | } | 185 | } |
186 | 186 | ||
187 | static X509_EXTENSION * | 187 | static X509_EXTENSION * |
188 | do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, int crit, | 188 | do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, int crit, |
189 | void *ext_struc) | 189 | void *ext_struc) |
190 | { | 190 | { |
191 | unsigned char *ext_der = NULL; | 191 | unsigned char *ext_der = NULL; |
@@ -216,7 +216,7 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, int crit, | |||
216 | ext_der = NULL; | 216 | ext_der = NULL; |
217 | ext_len = 0; | 217 | ext_len = 0; |
218 | 218 | ||
219 | ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct); | 219 | ext = X509_EXTENSION_create_by_NID(NULL, nid, crit, ext_oct); |
220 | if (ext == NULL) | 220 | if (ext == NULL) |
221 | goto merr; | 221 | goto merr; |
222 | ASN1_OCTET_STRING_free(ext_oct); | 222 | ASN1_OCTET_STRING_free(ext_oct); |
@@ -234,15 +234,15 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, int crit, | |||
234 | /* Given an internal structure, nid and critical flag create an extension */ | 234 | /* Given an internal structure, nid and critical flag create an extension */ |
235 | 235 | ||
236 | X509_EXTENSION * | 236 | X509_EXTENSION * |
237 | X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc) | 237 | X509V3_EXT_i2d(int nid, int crit, void *ext_struc) |
238 | { | 238 | { |
239 | const X509V3_EXT_METHOD *method; | 239 | const X509V3_EXT_METHOD *method; |
240 | 240 | ||
241 | if (!(method = X509V3_EXT_get_nid(ext_nid))) { | 241 | if (!(method = X509V3_EXT_get_nid(nid))) { |
242 | X509V3error(X509V3_R_UNKNOWN_EXTENSION); | 242 | X509V3error(X509V3_R_UNKNOWN_EXTENSION); |
243 | return NULL; | 243 | return NULL; |
244 | } | 244 | } |
245 | return do_ext_i2d(method, ext_nid, crit, ext_struc); | 245 | return do_ext_i2d(method, nid, crit, ext_struc); |
246 | } | 246 | } |
247 | LCRYPTO_ALIAS(X509V3_EXT_i2d); | 247 | LCRYPTO_ALIAS(X509V3_EXT_i2d); |
248 | 248 | ||
@@ -520,13 +520,13 @@ LCRYPTO_ALIAS(X509V3_EXT_conf); | |||
520 | /* LHASH *conf: Config file */ | 520 | /* LHASH *conf: Config file */ |
521 | /* char *value: Value */ | 521 | /* char *value: Value */ |
522 | X509_EXTENSION * | 522 | X509_EXTENSION * |
523 | X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, int ext_nid, | 523 | X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, int nid, |
524 | const char *value) | 524 | const char *value) |
525 | { | 525 | { |
526 | CONF ctmp; | 526 | CONF ctmp; |
527 | 527 | ||
528 | CONF_set_nconf(&ctmp, conf); | 528 | CONF_set_nconf(&ctmp, conf); |
529 | return X509V3_EXT_nconf_nid(&ctmp, ctx, ext_nid, value); | 529 | return X509V3_EXT_nconf_nid(&ctmp, ctx, nid, value); |
530 | } | 530 | } |
531 | LCRYPTO_ALIAS(X509V3_EXT_conf_nid); | 531 | LCRYPTO_ALIAS(X509V3_EXT_conf_nid); |
532 | 532 | ||