diff options
author | jsing <> | 2014-04-21 17:02:33 +0000 |
---|---|---|
committer | jsing <> | 2014-04-21 17:02:33 +0000 |
commit | 99afdfe5ba7757a5ea5051f8881b3fe1ac016ece (patch) | |
tree | 643695fdb9ba102ffa4879182b0dd9c297d8c0f3 /src/lib/libcrypto/x509v3/v3prin.c | |
parent | 1d74853fd0a51591b1a5915391aee920ef15e5eb (diff) | |
download | openbsd-99afdfe5ba7757a5ea5051f8881b3fe1ac016ece.tar.gz openbsd-99afdfe5ba7757a5ea5051f8881b3fe1ac016ece.tar.bz2 openbsd-99afdfe5ba7757a5ea5051f8881b3fe1ac016ece.zip |
KNF.
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3prin.c')
-rw-r--r-- | src/lib/libcrypto/x509v3/v3prin.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/libcrypto/x509v3/v3prin.c b/src/lib/libcrypto/x509v3/v3prin.c index d5ff268296..da701de132 100644 --- a/src/lib/libcrypto/x509v3/v3prin.c +++ b/src/lib/libcrypto/x509v3/v3prin.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 |
@@ -56,31 +56,31 @@ | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | |||
60 | |||
61 | #include <stdio.h> | 59 | #include <stdio.h> |
62 | #include <openssl/asn1.h> | 60 | #include <openssl/asn1.h> |
63 | #include <openssl/conf.h> | 61 | #include <openssl/conf.h> |
64 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
65 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
66 | 64 | ||
67 | int main(int argc, char **argv) | 65 | int |
66 | main(int argc, char **argv) | ||
68 | { | 67 | { |
69 | X509 *cert; | 68 | X509 *cert; |
70 | FILE *inf; | 69 | FILE *inf; |
71 | int i, count; | 70 | int i, count; |
72 | X509_EXTENSION *ext; | 71 | X509_EXTENSION *ext; |
72 | |||
73 | X509V3_add_standard_extensions(); | 73 | X509V3_add_standard_extensions(); |
74 | ERR_load_crypto_strings(); | 74 | ERR_load_crypto_strings(); |
75 | if(!argv[1]) { | 75 | if (!argv[1]) { |
76 | fprintf(stderr, "Usage v3prin cert.pem\n"); | 76 | fprintf(stderr, "Usage v3prin cert.pem\n"); |
77 | exit(1); | 77 | exit(1); |
78 | } | 78 | } |
79 | if(!(inf = fopen(argv[1], "r"))) { | 79 | if (!(inf = fopen(argv[1], "r"))) { |
80 | fprintf(stderr, "Can't open %s\n", argv[1]); | 80 | fprintf(stderr, "Can't open %s\n", argv[1]); |
81 | exit(1); | 81 | exit(1); |
82 | } | 82 | } |
83 | if(!(cert = PEM_read_X509(inf, NULL, NULL))) { | 83 | if (!(cert = PEM_read_X509(inf, NULL, NULL))) { |
84 | fprintf(stderr, "Can't read certificate %s\n", argv[1]); | 84 | fprintf(stderr, "Can't read certificate %s\n", argv[1]); |
85 | ERR_print_errors_fp(stderr); | 85 | ERR_print_errors_fp(stderr); |
86 | exit(1); | 86 | exit(1); |
@@ -88,12 +88,13 @@ int main(int argc, char **argv) | |||
88 | fclose(inf); | 88 | fclose(inf); |
89 | count = X509_get_ext_count(cert); | 89 | count = X509_get_ext_count(cert); |
90 | printf("%d extensions\n", count); | 90 | printf("%d extensions\n", count); |
91 | for(i = 0; i < count; i++) { | 91 | for (i = 0; i < count; i++) { |
92 | ext = X509_get_ext(cert, i); | 92 | ext = X509_get_ext(cert, i); |
93 | printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object))); | 93 | printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object))); |
94 | if(!X509V3_EXT_print_fp(stdout, ext, 0, 0)) ERR_print_errors_fp(stderr); | 94 | if (!X509V3_EXT_print_fp(stdout, ext, 0, 0)) |
95 | ERR_print_errors_fp(stderr); | ||
95 | printf("\n"); | 96 | printf("\n"); |
96 | 97 | ||
97 | } | 98 | } |
98 | return 0; | 99 | return 0; |
99 | } | 100 | } |