diff options
| author | jsing <> | 2014-04-18 13:14:31 +0000 |
|---|---|---|
| committer | jsing <> | 2014-04-18 13:14:31 +0000 |
| commit | 00bec8c2ad4913d82c5df6a17d0c65f42971782f (patch) | |
| tree | f569441b32f0a3293eba8921ed58e2489986006c /src/lib/libcrypto/asn1/t_crl.c | |
| parent | 5064fab03407f07740785d11f0aab5dd9ca06b28 (diff) | |
| download | openbsd-00bec8c2ad4913d82c5df6a17d0c65f42971782f.tar.gz openbsd-00bec8c2ad4913d82c5df6a17d0c65f42971782f.tar.bz2 openbsd-00bec8c2ad4913d82c5df6a17d0c65f42971782f.zip | |
More KNF.
Diffstat (limited to 'src/lib/libcrypto/asn1/t_crl.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/t_crl.c | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c index c665a26bce..cd1ed26174 100644 --- a/src/lib/libcrypto/asn1/t_crl.c +++ b/src/lib/libcrypto/asn1/t_crl.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -65,23 +65,25 @@ | |||
| 65 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 66 | 66 | ||
| 67 | #ifndef OPENSSL_NO_FP_API | 67 | #ifndef OPENSSL_NO_FP_API |
| 68 | int X509_CRL_print_fp(FILE *fp, X509_CRL *x) | 68 | int |
| 69 | X509_CRL_print_fp(FILE *fp, X509_CRL *x) | ||
| 69 | { | 70 | { |
| 70 | BIO *b; | 71 | BIO *b; |
| 71 | int ret; | 72 | int ret; |
| 72 | 73 | ||
| 73 | if ((b=BIO_new(BIO_s_file())) == NULL) { | 74 | if ((b = BIO_new(BIO_s_file())) == NULL) { |
| 74 | X509err(X509_F_X509_CRL_PRINT_FP,ERR_R_BUF_LIB); | 75 | X509err(X509_F_X509_CRL_PRINT_FP, ERR_R_BUF_LIB); |
| 75 | return(0); | 76 | return (0); |
| 76 | } | 77 | } |
| 77 | BIO_set_fp(b,fp,BIO_NOCLOSE); | 78 | BIO_set_fp(b, fp, BIO_NOCLOSE); |
| 78 | ret=X509_CRL_print(b, x); | 79 | ret = X509_CRL_print(b, x); |
| 79 | BIO_free(b); | 80 | BIO_free(b); |
| 80 | return(ret); | 81 | return (ret); |
| 81 | } | 82 | } |
| 82 | #endif | 83 | #endif |
| 83 | 84 | ||
| 84 | int X509_CRL_print(BIO *out, X509_CRL *x) | 85 | int |
| 86 | X509_CRL_print(BIO *out, X509_CRL *x) | ||
| 85 | { | 87 | { |
| 86 | STACK_OF(X509_REVOKED) *rev; | 88 | STACK_OF(X509_REVOKED) *rev; |
| 87 | X509_REVOKED *r; | 89 | X509_REVOKED *r; |
| @@ -91,38 +93,40 @@ int X509_CRL_print(BIO *out, X509_CRL *x) | |||
| 91 | 93 | ||
| 92 | BIO_printf(out, "Certificate Revocation List (CRL):\n"); | 94 | BIO_printf(out, "Certificate Revocation List (CRL):\n"); |
| 93 | l = X509_CRL_get_version(x); | 95 | l = X509_CRL_get_version(x); |
| 94 | BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l); | 96 | BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); |
| 95 | i = OBJ_obj2nid(x->sig_alg->algorithm); | 97 | i = OBJ_obj2nid(x->sig_alg->algorithm); |
| 96 | X509_signature_print(out, x->sig_alg, NULL); | 98 | X509_signature_print(out, x->sig_alg, NULL); |
| 97 | p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); | 99 | p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); |
| 98 | BIO_printf(out,"%8sIssuer: %s\n","",p); | 100 | BIO_printf(out, "%8sIssuer: %s\n", "", p); |
| 99 | free(p); | 101 | free(p); |
| 100 | BIO_printf(out,"%8sLast Update: ",""); | 102 | BIO_printf(out, "%8sLast Update: ", ""); |
| 101 | ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); | 103 | ASN1_TIME_print(out, X509_CRL_get_lastUpdate(x)); |
| 102 | BIO_printf(out,"\n%8sNext Update: ",""); | 104 | BIO_printf(out, "\n%8sNext Update: ", ""); |
| 103 | if (X509_CRL_get_nextUpdate(x)) | 105 | if (X509_CRL_get_nextUpdate(x)) |
| 104 | ASN1_TIME_print(out,X509_CRL_get_nextUpdate(x)); | 106 | ASN1_TIME_print(out, X509_CRL_get_nextUpdate(x)); |
| 105 | else BIO_printf(out,"NONE"); | 107 | else |
| 106 | BIO_printf(out,"\n"); | 108 | BIO_printf(out, "NONE"); |
| 109 | BIO_printf(out, "\n"); | ||
| 107 | 110 | ||
| 108 | X509V3_extensions_print(out, "CRL extensions", | 111 | X509V3_extensions_print(out, "CRL extensions", |
| 109 | x->crl->extensions, 0, 8); | 112 | x->crl->extensions, 0, 8); |
| 110 | 113 | ||
| 111 | rev = X509_CRL_get_REVOKED(x); | 114 | rev = X509_CRL_get_REVOKED(x); |
| 112 | 115 | ||
| 113 | if(sk_X509_REVOKED_num(rev) > 0) | 116 | if (sk_X509_REVOKED_num(rev) > 0) |
| 114 | BIO_printf(out, "Revoked Certificates:\n"); | 117 | BIO_printf(out, "Revoked Certificates:\n"); |
| 115 | else BIO_printf(out, "No Revoked Certificates.\n"); | 118 | else |
| 119 | BIO_printf(out, "No Revoked Certificates.\n"); | ||
| 116 | 120 | ||
| 117 | for(i = 0; i < sk_X509_REVOKED_num(rev); i++) { | 121 | for (i = 0; i < sk_X509_REVOKED_num(rev); i++) { |
| 118 | r = sk_X509_REVOKED_value(rev, i); | 122 | r = sk_X509_REVOKED_value(rev, i); |
| 119 | BIO_printf(out," Serial Number: "); | 123 | BIO_printf(out, " Serial Number: "); |
| 120 | i2a_ASN1_INTEGER(out,r->serialNumber); | 124 | i2a_ASN1_INTEGER(out, r->serialNumber); |
| 121 | BIO_printf(out,"\n Revocation Date: "); | 125 | BIO_printf(out, "\n Revocation Date: "); |
| 122 | ASN1_TIME_print(out,r->revocationDate); | 126 | ASN1_TIME_print(out, r->revocationDate); |
| 123 | BIO_printf(out,"\n"); | 127 | BIO_printf(out, "\n"); |
| 124 | X509V3_extensions_print(out, "CRL entry extensions", | 128 | X509V3_extensions_print(out, "CRL entry extensions", |
| 125 | r->extensions, 0, 8); | 129 | r->extensions, 0, 8); |
| 126 | } | 130 | } |
| 127 | X509_signature_print(out, x->sig_alg, x->signature); | 131 | X509_signature_print(out, x->sig_alg, x->signature); |
| 128 | 132 | ||
