diff options
author | jsing <> | 2014-04-18 13:14:31 +0000 |
---|---|---|
committer | jsing <> | 2014-04-18 13:14:31 +0000 |
commit | 48839e33a53ed2d6e54cb31ec1a93635e0a4dc60 (patch) | |
tree | f569441b32f0a3293eba8921ed58e2489986006c /src/lib/libcrypto/asn1/t_spki.c | |
parent | 8a0112534d8764e81ead87d96bc29f9f7087f881 (diff) | |
download | openbsd-48839e33a53ed2d6e54cb31ec1a93635e0a4dc60.tar.gz openbsd-48839e33a53ed2d6e54cb31ec1a93635e0a4dc60.tar.bz2 openbsd-48839e33a53ed2d6e54cb31ec1a93635e0a4dc60.zip |
More KNF.
Diffstat (limited to 'src/lib/libcrypto/asn1/t_spki.c')
-rw-r--r-- | src/lib/libcrypto/asn1/t_spki.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/lib/libcrypto/asn1/t_spki.c b/src/lib/libcrypto/asn1/t_spki.c index f135754535..0265461b04 100644 --- a/src/lib/libcrypto/asn1/t_spki.c +++ b/src/lib/libcrypto/asn1/t_spki.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 |
@@ -70,38 +70,40 @@ | |||
70 | 70 | ||
71 | /* Print out an SPKI */ | 71 | /* Print out an SPKI */ |
72 | 72 | ||
73 | int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) | 73 | int |
74 | NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) | ||
74 | { | 75 | { |
75 | EVP_PKEY *pkey; | 76 | EVP_PKEY *pkey; |
76 | ASN1_IA5STRING *chal; | 77 | ASN1_IA5STRING *chal; |
77 | int i, n; | 78 | int i, n; |
78 | char *s; | 79 | char *s; |
80 | |||
79 | BIO_printf(out, "Netscape SPKI:\n"); | 81 | BIO_printf(out, "Netscape SPKI:\n"); |
80 | i=OBJ_obj2nid(spki->spkac->pubkey->algor->algorithm); | 82 | i = OBJ_obj2nid(spki->spkac->pubkey->algor->algorithm); |
81 | BIO_printf(out," Public Key Algorithm: %s\n", | 83 | BIO_printf(out, " Public Key Algorithm: %s\n", |
82 | (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); | 84 | (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); |
83 | pkey = X509_PUBKEY_get(spki->spkac->pubkey); | 85 | pkey = X509_PUBKEY_get(spki->spkac->pubkey); |
84 | if(!pkey) | 86 | if (!pkey) |
85 | BIO_printf(out, " Unable to load public key\n"); | 87 | BIO_printf(out, " Unable to load public key\n"); |
86 | else { | 88 | else { |
87 | EVP_PKEY_print_public(out, pkey, 4, NULL); | 89 | EVP_PKEY_print_public(out, pkey, 4, NULL); |
88 | EVP_PKEY_free(pkey); | 90 | EVP_PKEY_free(pkey); |
89 | } | 91 | } |
90 | chal = spki->spkac->challenge; | 92 | chal = spki->spkac->challenge; |
91 | if(chal->length) | 93 | if (chal->length) |
92 | BIO_printf(out, " Challenge String: %s\n", chal->data); | 94 | BIO_printf(out, " Challenge String: %s\n", chal->data); |
93 | i=OBJ_obj2nid(spki->sig_algor->algorithm); | 95 | i = OBJ_obj2nid(spki->sig_algor->algorithm); |
94 | BIO_printf(out," Signature Algorithm: %s", | 96 | BIO_printf(out, " Signature Algorithm: %s", |
95 | (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); | 97 | (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); |
96 | 98 | ||
97 | n=spki->signature->length; | 99 | n = spki->signature->length; |
98 | s=(char *)spki->signature->data; | 100 | s = (char *)spki->signature->data; |
99 | for (i=0; i<n; i++) { | 101 | for (i = 0; i < n; i++) { |
100 | if ((i%18) == 0) | 102 | if ((i % 18) == 0) |
101 | BIO_write(out,"\n ",7); | 103 | BIO_write(out, "\n ", 7); |
102 | BIO_printf(out,"%02x%s",(unsigned char)s[i], | 104 | BIO_printf(out, "%02x%s", (unsigned char)s[i], |
103 | ((i+1) == n)?"":":"); | 105 | ((i + 1) == n) ? "" : ":"); |
104 | } | 106 | } |
105 | BIO_write(out,"\n",1); | 107 | BIO_write(out, "\n", 1); |
106 | return 1; | 108 | return 1; |
107 | } | 109 | } |