diff options
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index e346e3cf7f..9af1934dd6 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.300 2022/07/24 15:05:16 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.301 2022/08/17 07:39:19 jsing 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 | * |
@@ -880,14 +880,17 @@ SSL_get_peer_certificate(const SSL *s) | |||
880 | STACK_OF(X509) * | 880 | STACK_OF(X509) * |
881 | SSL_get_peer_cert_chain(const SSL *s) | 881 | SSL_get_peer_cert_chain(const SSL *s) |
882 | { | 882 | { |
883 | if (s == NULL || s->session == NULL) | 883 | if (s == NULL) |
884 | return NULL; | 884 | return NULL; |
885 | 885 | ||
886 | /* | 886 | /* |
887 | * If we are a client, cert_chain includes the peer's own | 887 | * Achtung! Due to API inconsistency, a client includes the peer's leaf |
888 | * certificate; if we are a server, it does not. | 888 | * certificate in the peer certificate chain, while a server does not. |
889 | */ | 889 | */ |
890 | return s->session->cert_chain; | 890 | if (!s->server) |
891 | return s->s3->hs.peer_certs; | ||
892 | |||
893 | return s->s3->hs.peer_certs_no_leaf; | ||
891 | } | 894 | } |
892 | 895 | ||
893 | STACK_OF(X509) * | 896 | STACK_OF(X509) * |