From b3f16bd23df6966b1e3c619b9fb83466e13ca363 Mon Sep 17 00:00:00 2001 From: jsing Date: Tue, 11 Jan 2022 18:43:00 +0000 Subject: [PATCH] Simplify SSL_get_peer_certificate() ok inoguchi@ tb@ --- lib/libssl/ssl_lib.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index a90490ff55b..c66437e77db 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.285 2022/01/11 18:39:28 jsing Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.286 2022/01/11 18:43:00 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -865,19 +865,17 @@ SSL_pending(const SSL *s) X509 * SSL_get_peer_certificate(const SSL *s) { - X509 *r; + X509 *cert; - if ((s == NULL) || (s->session == NULL)) - r = NULL; - else - r = s->session->peer_cert; + if (s == NULL || s->session == NULL) + return NULL; - if (r == NULL) - return (r); + if ((cert = s->session->peer_cert) == NULL) + return NULL; - X509_up_ref(r); + X509_up_ref(cert); - return (r); + return cert; } STACK_OF(X509) * -- 2.20.1