diff options
author | tb <> | 2022-02-03 18:40:34 +0000 |
---|---|---|
committer | tb <> | 2022-02-03 18:40:34 +0000 |
commit | eb9284b949eb0170748115a210715c9899e1b1ea (patch) | |
tree | 45b74edf6c7bb0eeb110f9a82886a59cd94a7583 /src | |
parent | 7023871724f8c989dcb3316b7f3a29e1b8ca20d5 (diff) | |
download | openbsd-eb9284b949eb0170748115a210715c9899e1b1ea.tar.gz openbsd-eb9284b949eb0170748115a210715c9899e1b1ea.tar.bz2 openbsd-eb9284b949eb0170748115a210715c9899e1b1ea.zip |
Unindent and unwrap lines. Pull up a NULL check. No functional change.
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/s_cb.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/usr.bin/openssl/s_cb.c b/src/usr.bin/openssl/s_cb.c index 18bb6c033c..12a6c308fb 100644 --- a/src/usr.bin/openssl/s_cb.c +++ b/src/usr.bin/openssl/s_cb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_cb.c,v 1.17 2022/02/03 18:35:24 tb Exp $ */ | 1 | /* $OpenBSD: s_cb.c,v 1.18 2022/02/03 18:40:34 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -202,35 +202,33 @@ verify_callback(int ok, X509_STORE_CTX * ctx) | |||
202 | int | 202 | int |
203 | set_cert_stuff(SSL_CTX * ctx, char *cert_file, char *key_file) | 203 | set_cert_stuff(SSL_CTX * ctx, char *cert_file, char *key_file) |
204 | { | 204 | { |
205 | if (cert_file != NULL) { | 205 | if (cert_file == NULL) |
206 | if (SSL_CTX_use_certificate_file(ctx, cert_file, | 206 | return 1; |
207 | SSL_FILETYPE_PEM) <= 0) { | ||
208 | BIO_printf(bio_err, | ||
209 | "unable to get certificate from '%s'\n", cert_file); | ||
210 | ERR_print_errors(bio_err); | ||
211 | return (0); | ||
212 | } | ||
213 | if (key_file == NULL) | ||
214 | key_file = cert_file; | ||
215 | if (SSL_CTX_use_PrivateKey_file(ctx, key_file, | ||
216 | SSL_FILETYPE_PEM) <= 0) { | ||
217 | BIO_printf(bio_err, | ||
218 | "unable to get private key from '%s'\n", key_file); | ||
219 | ERR_print_errors(bio_err); | ||
220 | return (0); | ||
221 | } | ||
222 | 207 | ||
223 | /* | 208 | if (key_file == NULL) |
224 | * Now we know that a key and cert have been set against the | 209 | key_file = cert_file; |
225 | * SSL context | 210 | |
226 | */ | 211 | if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) { |
227 | if (!SSL_CTX_check_private_key(ctx)) { | 212 | BIO_printf(bio_err, |
228 | BIO_printf(bio_err, | 213 | "unable to get certificate from '%s'\n", cert_file); |
229 | "Private key does not match the certificate public key\n"); | 214 | ERR_print_errors(bio_err); |
230 | return (0); | 215 | return 0; |
231 | } | ||
232 | } | 216 | } |
233 | return (1); | 217 | if (SSL_CTX_use_PrivateKey_file(ctx, key_file, SSL_FILETYPE_PEM) <= 0) { |
218 | BIO_printf(bio_err, "unable to get private key from '%s'\n", | ||
219 | key_file); | ||
220 | ERR_print_errors(bio_err); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | /* Now we know that a key and cert have been set against the context. */ | ||
225 | if (!SSL_CTX_check_private_key(ctx)) { | ||
226 | BIO_printf(bio_err, | ||
227 | "Private key does not match the certificate public key\n"); | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | return 1; | ||
234 | } | 232 | } |
235 | 233 | ||
236 | int | 234 | int |