summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/apps/crl.c
diff options
context:
space:
mode:
authorjsing <>2014-04-22 13:34:56 +0000
committerjsing <>2014-04-22 13:34:56 +0000
commitb0c6f3011c1eccab2b05e36128c7ecbb4b936347 (patch)
tree468184c9852593e23a48a157459b2d32fd9f6ac1 /src/lib/libssl/src/apps/crl.c
parent299dcf26d8cde0c0d112b4b1973ba03b87541f48 (diff)
downloadopenbsd-b0c6f3011c1eccab2b05e36128c7ecbb4b936347.tar.gz
openbsd-b0c6f3011c1eccab2b05e36128c7ecbb4b936347.tar.bz2
openbsd-b0c6f3011c1eccab2b05e36128c7ecbb4b936347.zip
More KNF.
Diffstat (limited to 'src/lib/libssl/src/apps/crl.c')
-rw-r--r--src/lib/libssl/src/apps/crl.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/lib/libssl/src/apps/crl.c b/src/lib/libssl/src/apps/crl.c
index 07fb1fbcdc..60ce43df22 100644
--- a/src/lib/libssl/src/apps/crl.c
+++ b/src/lib/libssl/src/apps/crl.c
@@ -110,7 +110,7 @@ crl_main(int argc, char **argv)
110 int informat, outformat; 110 int informat, outformat;
111 char *infile = NULL, *outfile = NULL; 111 char *infile = NULL, *outfile = NULL;
112 int hash = 0, issuer = 0, lastupdate = 0, nextupdate = 0, noout = 0, 112 int hash = 0, issuer = 0, lastupdate = 0, nextupdate = 0, noout = 0,
113 text = 0; 113 text = 0;
114#ifndef OPENSSL_NO_MD5 114#ifndef OPENSSL_NO_MD5
115 int hash_old = 0; 115 int hash_old = 0;
116#endif 116#endif
@@ -235,13 +235,15 @@ bad:
235 if (lookup == NULL) 235 if (lookup == NULL)
236 goto end; 236 goto end;
237 if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) 237 if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM))
238 X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT); 238 X509_LOOKUP_load_file(lookup, NULL,
239 X509_FILETYPE_DEFAULT);
239 240
240 lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); 241 lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
241 if (lookup == NULL) 242 if (lookup == NULL)
242 goto end; 243 goto end;
243 if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM)) 244 if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM))
244 X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT); 245 X509_LOOKUP_add_dir(lookup, NULL,
246 X509_FILETYPE_DEFAULT);
245 ERR_clear_error(); 247 ERR_clear_error();
246 248
247 if (!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) { 249 if (!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) {
@@ -275,12 +277,13 @@ bad:
275 if (num) { 277 if (num) {
276 for (i = 1; i <= num; i++) { 278 for (i = 1; i <= num; i++) {
277 if (issuer == i) { 279 if (issuer == i) {
278 print_name(bio_out, "issuer=", X509_CRL_get_issuer(x), nmflag); 280 print_name(bio_out, "issuer=",
281 X509_CRL_get_issuer(x), nmflag);
279 } 282 }
280 if (crlnumber == i) { 283 if (crlnumber == i) {
281 ASN1_INTEGER *crlnum; 284 ASN1_INTEGER *crlnum;
282 crlnum = X509_CRL_get_ext_d2i(x, NID_crl_number, 285 crlnum = X509_CRL_get_ext_d2i(x,
283 NULL, NULL); 286 NID_crl_number, NULL, NULL);
284 BIO_printf(bio_out, "crlNumber="); 287 BIO_printf(bio_out, "crlNumber=");
285 if (crlnum) { 288 if (crlnum) {
286 i2a_ASN1_INTEGER(bio_out, crlnum); 289 i2a_ASN1_INTEGER(bio_out, crlnum);
@@ -296,8 +299,7 @@ bad:
296#ifndef OPENSSL_NO_MD5 299#ifndef OPENSSL_NO_MD5
297 if (hash_old == i) { 300 if (hash_old == i) {
298 BIO_printf(bio_out, "%08lx\n", 301 BIO_printf(bio_out, "%08lx\n",
299 X509_NAME_hash_old( 302 X509_NAME_hash_old(X509_CRL_get_issuer(x)));
300 X509_CRL_get_issuer(x)));
301 } 303 }
302#endif 304#endif
303 if (lastupdate == i) { 305 if (lastupdate == i) {
@@ -328,7 +330,7 @@ bad:
328 OBJ_nid2sn(EVP_MD_type(digest))); 330 OBJ_nid2sn(EVP_MD_type(digest)));
329 for (j = 0; j < (int) n; j++) { 331 for (j = 0; j < (int) n; j++) {
330 BIO_printf(bio_out, "%02X%c", md[j], 332 BIO_printf(bio_out, "%02X%c", md[j],
331 (j + 1 == (int) n) ? '\n' : ':'); 333 (j + 1 == (int)n) ? '\n' : ':');
332 } 334 }
333 } 335 }
334 } 336 }
@@ -359,7 +361,8 @@ bad:
359 else if (outformat == FORMAT_PEM) 361 else if (outformat == FORMAT_PEM)
360 i = PEM_write_bio_X509_CRL(out, x); 362 i = PEM_write_bio_X509_CRL(out, x);
361 else { 363 else {
362 BIO_printf(bio_err, "bad output format specified for outfile\n"); 364 BIO_printf(bio_err,
365 "bad output format specified for outfile\n");
363 goto end; 366 goto end;
364 } 367 }
365 if (!i) { 368 if (!i) {
@@ -405,7 +408,8 @@ load_crl(char *infile, int format)
405 else if (format == FORMAT_PEM) 408 else if (format == FORMAT_PEM)
406 x = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL); 409 x = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL);
407 else { 410 else {
408 BIO_printf(bio_err, "bad input format specified for input crl\n"); 411 BIO_printf(bio_err,
412 "bad input format specified for input crl\n");
409 goto end; 413 goto end;
410 } 414 }
411 if (x == NULL) { 415 if (x == NULL) {
@@ -413,6 +417,7 @@ load_crl(char *infile, int format)
413 ERR_print_errors(bio_err); 417 ERR_print_errors(bio_err);
414 goto end; 418 goto end;
415 } 419 }
420
416end: 421end:
417 BIO_free(in); 422 BIO_free(in);
418 return (x); 423 return (x);