diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_conf.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c index 50f5bb2e66..9f6b392b3c 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.13 2024/06/18 05:39:52 tb Exp $ */ | 1 | /* $OpenBSD: x509_conf.c,v 1.14 2024/06/18 05:56:37 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 | */ |
@@ -79,7 +79,7 @@ static char *conf_lhash_get_string(void *db, const char *section, | |||
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 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_struct); |
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); |
85 | 85 | ||
@@ -131,7 +131,7 @@ do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int nid, int crit, | |||
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_struct; |
135 | 135 | ||
136 | if (nid == NID_undef) { | 136 | if (nid == NID_undef) { |
137 | X509V3error(X509V3_R_UNKNOWN_EXTENSION_NAME); | 137 | X509V3error(X509V3_R_UNKNOWN_EXTENSION_NAME); |
@@ -157,36 +157,36 @@ do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int nid, int crit, | |||
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; |
159 | } | 159 | } |
160 | ext_struc = method->v2i(method, ctx, nval); | 160 | ext_struct = method->v2i(method, ctx, nval); |
161 | if (*value != '@') | 161 | if (*value != '@') |
162 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); | 162 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); |
163 | } else if (method->s2i) { | 163 | } else if (method->s2i) { |
164 | ext_struc = method->s2i(method, ctx, value); | 164 | ext_struct = method->s2i(method, ctx, value); |
165 | } else if (method->r2i) { | 165 | } else if (method->r2i) { |
166 | if (!ctx->db || !ctx->db_meth) { | 166 | if (!ctx->db || !ctx->db_meth) { |
167 | X509V3error(X509V3_R_NO_CONFIG_DATABASE); | 167 | X509V3error(X509V3_R_NO_CONFIG_DATABASE); |
168 | return NULL; | 168 | return NULL; |
169 | } | 169 | } |
170 | ext_struc = method->r2i(method, ctx, value); | 170 | ext_struct = 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(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_struct == NULL) |
177 | return NULL; | 177 | return NULL; |
178 | 178 | ||
179 | ext = do_ext_i2d(method, nid, crit, ext_struc); | 179 | ext = do_ext_i2d(method, nid, crit, ext_struct); |
180 | if (method->it) | 180 | if (method->it) |
181 | ASN1_item_free(ext_struc, method->it); | 181 | ASN1_item_free(ext_struct, method->it); |
182 | else | 182 | else |
183 | method->ext_free(ext_struc); | 183 | method->ext_free(ext_struct); |
184 | return ext; | 184 | return ext; |
185 | } | 185 | } |
186 | 186 | ||
187 | static X509_EXTENSION * | 187 | static X509_EXTENSION * |
188 | do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, int crit, | 188 | do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, int crit, |
189 | void *ext_struc) | 189 | void *ext_struct) |
190 | { | 190 | { |
191 | unsigned char *ext_der = NULL; | 191 | unsigned char *ext_der = NULL; |
192 | int ext_len; | 192 | int ext_len; |
@@ -196,18 +196,18 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, int crit, | |||
196 | /* Convert internal representation to DER */ | 196 | /* Convert internal representation to DER */ |
197 | if (method->it != NULL) { | 197 | if (method->it != NULL) { |
198 | ext_der = NULL; | 198 | ext_der = NULL; |
199 | ext_len = ASN1_item_i2d(ext_struc, &ext_der, method->it); | 199 | ext_len = ASN1_item_i2d(ext_struct, &ext_der, method->it); |
200 | if (ext_len < 0) | 200 | if (ext_len < 0) |
201 | goto merr; | 201 | goto merr; |
202 | } else { | 202 | } else { |
203 | unsigned char *p; | 203 | unsigned char *p; |
204 | 204 | ||
205 | if ((ext_len = method->i2d(ext_struc, NULL)) <= 0) | 205 | if ((ext_len = method->i2d(ext_struct, NULL)) <= 0) |
206 | goto merr; | 206 | goto merr; |
207 | if ((ext_der = calloc(1, ext_len)) == NULL) | 207 | if ((ext_der = calloc(1, ext_len)) == NULL) |
208 | goto merr; | 208 | goto merr; |
209 | p = ext_der; | 209 | p = ext_der; |
210 | if (method->i2d(ext_struc, &p) != ext_len) | 210 | if (method->i2d(ext_struct, &p) != ext_len) |
211 | goto merr; | 211 | goto merr; |
212 | } | 212 | } |
213 | if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL) | 213 | if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL) |
@@ -234,7 +234,7 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int 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 nid, int crit, void *ext_struc) | 237 | X509V3_EXT_i2d(int nid, int crit, void *ext_struct) |
238 | { | 238 | { |
239 | const X509V3_EXT_METHOD *method; | 239 | const X509V3_EXT_METHOD *method; |
240 | 240 | ||
@@ -242,7 +242,7 @@ X509V3_EXT_i2d(int nid, int crit, void *ext_struc) | |||
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, nid, crit, ext_struc); | 245 | return do_ext_i2d(method, nid, crit, ext_struct); |
246 | } | 246 | } |
247 | LCRYPTO_ALIAS(X509V3_EXT_i2d); | 247 | LCRYPTO_ALIAS(X509V3_EXT_i2d); |
248 | 248 | ||