diff options
author | lteo <> | 2014-04-25 03:38:59 +0000 |
---|---|---|
committer | lteo <> | 2014-04-25 03:38:59 +0000 |
commit | 4f7c928b5b2004ef8163870e4dc3fb4cdefdfcc3 (patch) | |
tree | 18890da75b05dbe7cc8f20ea281e3f503654f98d /src/lib/libssl/ssl_txt.c | |
parent | b2e9d1eed3ec4424b18ce3ee98e78f0030ca2cf3 (diff) | |
download | openbsd-4f7c928b5b2004ef8163870e4dc3fb4cdefdfcc3.tar.gz openbsd-4f7c928b5b2004ef8163870e4dc3fb4cdefdfcc3.tar.bz2 openbsd-4f7c928b5b2004ef8163870e4dc3fb4cdefdfcc3.zip |
KNF fixes
Diffstat (limited to 'src/lib/libssl/ssl_txt.c')
-rw-r--r-- | src/lib/libssl/ssl_txt.c | 133 |
1 files changed, 69 insertions, 64 deletions
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c index 5538c57562..c6bfd68de6 100644 --- a/src/lib/libssl/ssl_txt.c +++ b/src/lib/libssl/ssl_txt.c | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -112,24 +112,24 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) | |||
112 | 112 | ||
113 | if (x == NULL) | 113 | if (x == NULL) |
114 | goto err; | 114 | goto err; |
115 | if (BIO_puts(bp, "SSL-Session:\n") | 115 | if (BIO_puts(bp, "SSL-Session:\n") <= 0) |
116 | <= 0) goto err; | 116 | goto err; |
117 | if (x->ssl_version == SSL3_VERSION) | 117 | if (x->ssl_version == SSL3_VERSION) |
118 | s="SSLv3"; | 118 | s = "SSLv3"; |
119 | else if (x->ssl_version == TLS1_2_VERSION) | 119 | else if (x->ssl_version == TLS1_2_VERSION) |
120 | s="TLSv1.2"; | 120 | s = "TLSv1.2"; |
121 | else if (x->ssl_version == TLS1_1_VERSION) | 121 | else if (x->ssl_version == TLS1_1_VERSION) |
122 | s="TLSv1.1"; | 122 | s = "TLSv1.1"; |
123 | else if (x->ssl_version == TLS1_VERSION) | 123 | else if (x->ssl_version == TLS1_VERSION) |
124 | s="TLSv1"; | 124 | s = "TLSv1"; |
125 | else if (x->ssl_version == DTLS1_VERSION) | 125 | else if (x->ssl_version == DTLS1_VERSION) |
126 | s="DTLSv1"; | 126 | s = "DTLSv1"; |
127 | else if (x->ssl_version == DTLS1_BAD_VER) | 127 | else if (x->ssl_version == DTLS1_BAD_VER) |
128 | s="DTLSv1-bad"; | 128 | s = "DTLSv1-bad"; |
129 | else | 129 | else |
130 | s="unknown"; | 130 | s = "unknown"; |
131 | if (BIO_printf(bp, " Protocol : %s\n", s) | 131 | if (BIO_printf(bp, " Protocol : %s\n", s) <= 0) |
132 | <= 0) goto err; | 132 | goto err; |
133 | 133 | ||
134 | if (x->cipher == NULL) { | 134 | if (x->cipher == NULL) { |
135 | if (((x->cipher_id) & 0xff000000) == 0x02000000) { | 135 | if (((x->cipher_id) & 0xff000000) == 0x02000000) { |
@@ -143,62 +143,63 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) | |||
143 | if (BIO_printf(bp, " Cipher : %s\n",((x->cipher == NULL)?"unknown":x->cipher->name)) <= 0) | 143 | if (BIO_printf(bp, " Cipher : %s\n",((x->cipher == NULL)?"unknown":x->cipher->name)) <= 0) |
144 | goto err; | 144 | goto err; |
145 | } | 145 | } |
146 | if (BIO_puts(bp, " Session-ID: ") | 146 | if (BIO_puts(bp, " Session-ID: ") <= 0) |
147 | <= 0) goto err; | 147 | goto err; |
148 | for (i = 0; i < x->session_id_length; i++) { | 148 | for (i = 0; i < x->session_id_length; i++) { |
149 | if (BIO_printf(bp, "%02X", x->session_id[i]) | 149 | if (BIO_printf(bp, "%02X", x->session_id[i]) <= 0) |
150 | <= 0) goto err; | 150 | goto err; |
151 | } | 151 | } |
152 | if (BIO_puts(bp, "\n Session-ID-ctx: ") | 152 | if (BIO_puts(bp, "\n Session-ID-ctx: ") <= 0) |
153 | <= 0) goto err; | 153 | goto err; |
154 | for (i = 0; i < x->sid_ctx_length; i++) { | 154 | for (i = 0; i < x->sid_ctx_length; i++) { |
155 | if (BIO_printf(bp, "%02X", x->sid_ctx[i]) <= 0) | 155 | if (BIO_printf(bp, "%02X", x->sid_ctx[i]) <= 0) |
156 | goto err; | 156 | goto err; |
157 | } | 157 | } |
158 | if (BIO_puts(bp, "\n Master-Key: ") | 158 | if (BIO_puts(bp, "\n Master-Key: ") <= 0) |
159 | <= 0) goto err; | 159 | goto err; |
160 | for (i = 0; i < (unsigned int)x->master_key_length; i++) { | 160 | for (i = 0; i < (unsigned int)x->master_key_length; i++) { |
161 | if (BIO_printf(bp, "%02X", x->master_key[i]) | 161 | if (BIO_printf(bp, "%02X", x->master_key[i]) <= 0) |
162 | <= 0) goto err; | 162 | goto err; |
163 | } | 163 | } |
164 | #ifndef OPENSSL_NO_KRB5 | 164 | #ifndef OPENSSL_NO_KRB5 |
165 | if (BIO_puts(bp, "\n Krb5 Principal: ") | 165 | if (BIO_puts(bp, "\n Krb5 Principal: ") <= 0) |
166 | <= 0) goto err; | 166 | goto err; |
167 | if (x->krb5_client_princ_len == 0) { | 167 | if (x->krb5_client_princ_len == 0) { |
168 | if (BIO_puts(bp, "None") | 168 | if (BIO_puts(bp, "None") <= 0) |
169 | <= 0) goto err; | 169 | goto err; |
170 | } else | 170 | } else { |
171 | for (i = 0; i < x->krb5_client_princ_len; i++) { | 171 | for (i = 0; i < x->krb5_client_princ_len; i++) { |
172 | if (BIO_printf(bp, "%02X", x->krb5_client_princ[i]) | 172 | if (BIO_printf(bp, "%02X", x->krb5_client_princ[i]) <= 0) |
173 | <= 0) goto err; | 173 | goto err; |
174 | } | ||
174 | } | 175 | } |
175 | #endif /* OPENSSL_NO_KRB5 */ | 176 | #endif /* OPENSSL_NO_KRB5 */ |
176 | #ifndef OPENSSL_NO_PSK | 177 | #ifndef OPENSSL_NO_PSK |
177 | if (BIO_puts(bp, "\n PSK identity: ") | 178 | if (BIO_puts(bp, "\n PSK identity: ") <= 0) |
178 | <= 0) goto err; | 179 | goto err; |
179 | if (BIO_printf(bp, "%s", x->psk_identity ? x->psk_identity : "None") | 180 | if (BIO_printf(bp, "%s", x->psk_identity ? x->psk_identity : "None") <= 0) |
180 | <= 0) goto err; | 181 | goto err; |
181 | if (BIO_puts(bp, "\n PSK identity hint: ") | 182 | if (BIO_puts(bp, "\n PSK identity hint: ") <= 0) |
182 | <= 0) goto err; | 183 | goto err; |
183 | if (BIO_printf(bp, "%s", x->psk_identity_hint ? x->psk_identity_hint : "None") | 184 | if (BIO_printf(bp, "%s", x->psk_identity_hint ? x->psk_identity_hint : "None") <= 0) |
184 | <= 0) goto err; | 185 | goto err; |
185 | #endif | 186 | #endif |
186 | #ifndef OPENSSL_NO_SRP | 187 | #ifndef OPENSSL_NO_SRP |
187 | if (BIO_puts(bp, "\n SRP username: ") | 188 | if (BIO_puts(bp, "\n SRP username: ") <= 0) |
188 | <= 0) goto err; | 189 | goto err; |
189 | if (BIO_printf(bp, "%s", x->srp_username ? x->srp_username : "None") | 190 | if (BIO_printf(bp, "%s", x->srp_username ? x->srp_username : "None") <= 0) |
190 | <= 0) goto err; | 191 | goto err; |
191 | #endif | 192 | #endif |
192 | #ifndef OPENSSL_NO_TLSEXT | 193 | #ifndef OPENSSL_NO_TLSEXT |
193 | if (x->tlsext_tick_lifetime_hint) { | 194 | if (x->tlsext_tick_lifetime_hint) { |
194 | if (BIO_printf(bp, | 195 | if (BIO_printf(bp, |
195 | "\n TLS session ticket lifetime hint: %ld (seconds)", | 196 | "\n TLS session ticket lifetime hint: %ld (seconds)", |
196 | x->tlsext_tick_lifetime_hint) <=0) | 197 | x->tlsext_tick_lifetime_hint) <= 0) |
197 | goto err; | 198 | goto err; |
198 | } | 199 | } |
199 | if (x->tlsext_tick) { | 200 | if (x->tlsext_tick) { |
200 | if (BIO_puts(bp, "\n TLS session ticket:\n") | 201 | if (BIO_puts(bp, "\n TLS session ticket:\n") <= 0) |
201 | <= 0) goto err; | 202 | goto err; |
202 | if (BIO_dump_indent(bp, (char *)x->tlsext_tick, x->tlsext_ticklen, 4) <= 0) | 203 | if (BIO_dump_indent(bp, (char *)x->tlsext_tick, x->tlsext_ticklen, 4) <= 0) |
203 | goto err; | 204 | goto err; |
204 | } | 205 | } |
@@ -210,27 +211,31 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) | |||
210 | 211 | ||
211 | ssl_cipher_get_evp(x, NULL, NULL, NULL, NULL, &comp); | 212 | ssl_cipher_get_evp(x, NULL, NULL, NULL, NULL, &comp); |
212 | if (comp == NULL) { | 213 | if (comp == NULL) { |
213 | if (BIO_printf(bp, "\n Compression: %d", x->compress_meth) | 214 | if (BIO_printf(bp, "\n Compression: %d", x->compress_meth) <= 0) |
214 | <= 0) goto err; | 215 | goto err; |
215 | } else { | 216 | } else { |
216 | if (BIO_printf(bp, "\n Compression: %d (%s)", comp->id, comp->method->name) <= 0) goto err; | 217 | if (BIO_printf(bp, "\n Compression: %d (%s)", comp->id, comp->method->name) <= 0) |
217 | } | 218 | goto err; |
219 | } | ||
218 | } | 220 | } |
219 | #endif | 221 | #endif |
220 | if (x->time != 0) { | 222 | if (x->time != 0) { |
221 | if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) | 223 | if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0) |
222 | <= 0) goto err; | 224 | goto err; |
223 | } | 225 | } |
224 | if (x->timeout != 0L) { | 226 | if (x->timeout != 0L) { |
225 | if (BIO_printf(bp, "\n Timeout : %ld (sec)", x->timeout) <= 0) goto err; | 227 | if (BIO_printf(bp, "\n Timeout : %ld (sec)", x->timeout) <= 0) |
226 | } | 228 | goto err; |
227 | if (BIO_puts(bp, "\n") | 229 | } |
228 | <= 0) goto err; | 230 | if (BIO_puts(bp, "\n") <= 0) |
231 | goto err; | ||
232 | |||
233 | if (BIO_puts(bp, " Verify return code: ") <= 0) | ||
234 | goto err; | ||
229 | 235 | ||
230 | if (BIO_puts(bp, " Verify return code: ") | ||
231 | <= 0) goto err; | ||
232 | if (BIO_printf(bp, "%ld (%s)\n", x->verify_result, | 236 | if (BIO_printf(bp, "%ld (%s)\n", x->verify_result, |
233 | X509_verify_cert_error_string(x->verify_result)) <= 0) goto err; | 237 | X509_verify_cert_error_string(x->verify_result)) <= 0) |
238 | goto err; | ||
234 | 239 | ||
235 | return (1); | 240 | return (1); |
236 | err: | 241 | err: |