From e7c1cbcdcf161216e0333fef5d62ba0284705e3b Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 3 Feb 2022 18:40:34 +0000 Subject: [PATCH] Unindent and unwrap lines. Pull up a NULL check. No functional change. --- usr.bin/openssl/s_cb.c | 54 ++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/usr.bin/openssl/s_cb.c b/usr.bin/openssl/s_cb.c index 18bb6c033c1..12a6c308fb3 100644 --- a/usr.bin/openssl/s_cb.c +++ b/usr.bin/openssl/s_cb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_cb.c,v 1.17 2022/02/03 18:35:24 tb Exp $ */ +/* $OpenBSD: s_cb.c,v 1.18 2022/02/03 18:40:34 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -202,35 +202,33 @@ verify_callback(int ok, X509_STORE_CTX * ctx) int set_cert_stuff(SSL_CTX * ctx, char *cert_file, char *key_file) { - if (cert_file != NULL) { - if (SSL_CTX_use_certificate_file(ctx, cert_file, - SSL_FILETYPE_PEM) <= 0) { - BIO_printf(bio_err, - "unable to get certificate from '%s'\n", cert_file); - ERR_print_errors(bio_err); - return (0); - } - if (key_file == NULL) - key_file = cert_file; - if (SSL_CTX_use_PrivateKey_file(ctx, key_file, - SSL_FILETYPE_PEM) <= 0) { - BIO_printf(bio_err, - "unable to get private key from '%s'\n", key_file); - ERR_print_errors(bio_err); - return (0); - } + if (cert_file == NULL) + return 1; - /* - * Now we know that a key and cert have been set against the - * SSL context - */ - if (!SSL_CTX_check_private_key(ctx)) { - BIO_printf(bio_err, - "Private key does not match the certificate public key\n"); - return (0); - } + if (key_file == NULL) + key_file = cert_file; + + if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) { + BIO_printf(bio_err, + "unable to get certificate from '%s'\n", cert_file); + ERR_print_errors(bio_err); + return 0; } - return (1); + if (SSL_CTX_use_PrivateKey_file(ctx, key_file, SSL_FILETYPE_PEM) <= 0) { + BIO_printf(bio_err, "unable to get private key from '%s'\n", + key_file); + ERR_print_errors(bio_err); + return 0; + } + + /* Now we know that a key and cert have been set against the context. */ + if (!SSL_CTX_check_private_key(ctx)) { + BIO_printf(bio_err, + "Private key does not match the certificate public key\n"); + return 0; + } + + return 1; } int -- 2.20.1