summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-08-28 08:50:41 +0000
committertb <>2024-08-28 08:50:41 +0000
commitcfeae5ca77e441b1a417004ca811135648ad3da4 (patch)
tree6c3efa754fe0e25eb5a5a4d2d4e273a267a2da48
parentabebdb0622c880c0c16ea2149519079244a0bb1c (diff)
downloadopenbsd-cfeae5ca77e441b1a417004ca811135648ad3da4.tar.gz
openbsd-cfeae5ca77e441b1a417004ca811135648ad3da4.tar.bz2
openbsd-cfeae5ca77e441b1a417004ca811135648ad3da4.zip
Remove a few obvious comments, unwrap a few lines and annotate some
functions for removal
-rw-r--r--src/lib/libcrypto/x509/x509_conf.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c
index 5e6f1d6262..d2f5afb065 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.20 2024/08/28 08:43:55 tb Exp $ */ 1/* $OpenBSD: x509_conf.c,v 1.21 2024/08/28 08:50:41 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,9 +79,6 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int nid,
79static unsigned char *generic_asn1(const char *value, X509V3_CTX *ctx, 79static unsigned char *generic_asn1(const char *value, X509V3_CTX *ctx,
80 long *ext_len); 80 long *ext_len);
81 81
82/* CONF *conf: Config file */
83/* char *name: Name */
84/* char *value: Value */
85X509_EXTENSION * 82X509_EXTENSION *
86X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, 83X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name,
87 const char *value) 84 const char *value)
@@ -102,11 +99,8 @@ X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name,
102} 99}
103LCRYPTO_ALIAS(X509V3_EXT_nconf); 100LCRYPTO_ALIAS(X509V3_EXT_nconf);
104 101
105/* CONF *conf: Config file */
106/* char *value: Value */
107X509_EXTENSION * 102X509_EXTENSION *
108X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int nid, 103X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int nid, const char *value)
109 const char *value)
110{ 104{
111 int crit; 105 int crit;
112 int ext_type; 106 int ext_type;
@@ -119,11 +113,8 @@ X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int nid,
119} 113}
120LCRYPTO_ALIAS(X509V3_EXT_nconf_nid); 114LCRYPTO_ALIAS(X509V3_EXT_nconf_nid);
121 115
122/* CONF *conf: Config file */
123/* char *value: Value */
124static X509_EXTENSION * 116static X509_EXTENSION *
125do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int nid, int crit, 117do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int nid, int crit, const char *value)
126 const char *value)
127{ 118{
128 const X509V3_EXT_METHOD *method; 119 const X509V3_EXT_METHOD *method;
129 X509_EXTENSION *ext; 120 X509_EXTENSION *ext;
@@ -228,7 +219,6 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, int crit,
228} 219}
229 220
230/* Given an internal structure, nid and critical flag create an extension */ 221/* Given an internal structure, nid and critical flag create an extension */
231
232X509_EXTENSION * 222X509_EXTENSION *
233X509V3_EXT_i2d(int nid, int crit, void *ext_struct) 223X509V3_EXT_i2d(int nid, int crit, void *ext_struct)
234{ 224{
@@ -343,7 +333,8 @@ generic_asn1(const char *value, X509V3_CTX *ctx, long *ext_len)
343 return ext_der; 333 return ext_der;
344} 334}
345 335
346/* This is the main function: add a bunch of extensions based on a config file 336/*
337 * This is the main function: add a bunch of extensions based on a config file
347 * section to an extension STACK. 338 * section to an extension STACK.
348 */ 339 */
349 340
@@ -370,8 +361,6 @@ X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section,
370} 361}
371LCRYPTO_ALIAS(X509V3_EXT_add_nconf_sk); 362LCRYPTO_ALIAS(X509V3_EXT_add_nconf_sk);
372 363
373/* Convenience functions to add extensions to a certificate, CRL and request */
374
375int 364int
376X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, 365X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
377 X509 *cert) 366 X509 *cert)
@@ -384,8 +373,6 @@ X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
384} 373}
385LCRYPTO_ALIAS(X509V3_EXT_add_nconf); 374LCRYPTO_ALIAS(X509V3_EXT_add_nconf);
386 375
387/* Same as above but for a CRL */
388
389int 376int
390X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, 377X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
391 X509_CRL *crl) 378 X509_CRL *crl)
@@ -398,8 +385,6 @@ X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
398} 385}
399LCRYPTO_ALIAS(X509V3_EXT_CRL_add_nconf); 386LCRYPTO_ALIAS(X509V3_EXT_CRL_add_nconf);
400 387
401/* Add extensions to certificate request */
402
403int 388int
404X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, 389X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
405 X509_REQ *req) 390 X509_REQ *req)
@@ -418,8 +403,6 @@ X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
418} 403}
419LCRYPTO_ALIAS(X509V3_EXT_REQ_add_nconf); 404LCRYPTO_ALIAS(X509V3_EXT_REQ_add_nconf);
420 405
421/* Config database functions */
422
423char * 406char *
424X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section) 407X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section)
425{ 408{
@@ -501,8 +484,6 @@ X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subj, X509_REQ *req,
501} 484}
502LCRYPTO_ALIAS(X509V3_set_ctx); 485LCRYPTO_ALIAS(X509V3_set_ctx);
503 486
504/* Old conf compatibility functions */
505
506X509_EXTENSION * 487X509_EXTENSION *
507X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, const char *name, 488X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, const char *name,
508 const char *value) 489 const char *value)
@@ -514,8 +495,6 @@ X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, const char *name,
514} 495}
515LCRYPTO_ALIAS(X509V3_EXT_conf); 496LCRYPTO_ALIAS(X509V3_EXT_conf);
516 497
517/* LHASH *conf: Config file */
518/* char *value: Value */
519X509_EXTENSION * 498X509_EXTENSION *
520X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, int nid, 499X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, int nid,
521 const char *value) 500 const char *value)
@@ -527,6 +506,10 @@ X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, int nid,
527} 506}
528LCRYPTO_ALIAS(X509V3_EXT_conf_nid); 507LCRYPTO_ALIAS(X509V3_EXT_conf_nid);
529 508
509/*
510 * XXX -remove everything below in the next bump.
511 */
512
530void 513void
531X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash) 514X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash)
532{ 515{