diff options
author | jsing <> | 2021-12-26 14:59:52 +0000 |
---|---|---|
committer | jsing <> | 2021-12-26 14:59:52 +0000 |
commit | 4d9688185fced2e3bb90ecfac76d461ac4ba4f87 (patch) | |
tree | 847bedf50fa08fd5c412462be452878d1906bb4e /src | |
parent | f3991a23718fe2fc0de808e49e6ccb3bb5c65a9c (diff) | |
download | openbsd-4d9688185fced2e3bb90ecfac76d461ac4ba4f87.tar.gz openbsd-4d9688185fced2e3bb90ecfac76d461ac4ba4f87.tar.bz2 openbsd-4d9688185fced2e3bb90ecfac76d461ac4ba4f87.zip |
Correct SSL_get_peer_cert_chain() when used with the TLSv1.3 stack.
Due to a wonderful API inconsistency, a client includes the peer's leaf
certificate in the stored certificate chain, while a server does not.
Found due to a haproxy test failure reported by Ilya Shipitsin.
ok tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/tls13_server.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c index 253c1fc208..f5066f958a 100644 --- a/src/lib/libssl/tls13_server.c +++ b/src/lib/libssl/tls13_server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_server.c,v 1.88 2021/10/31 16:37:25 tb Exp $ */ | 1 | /* $OpenBSD: tls13_server.c,v 1.89 2021/12/26 14:59:52 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> |
@@ -908,8 +908,11 @@ tls13_client_certificate_recv(struct tls13_ctx *ctx, CBS *cbs) | |||
908 | } | 908 | } |
909 | ERR_clear_error(); | 909 | ERR_clear_error(); |
910 | 910 | ||
911 | cert = sk_X509_value(certs, 0); | 911 | /* |
912 | X509_up_ref(cert); | 912 | * Achtung! Due to API inconsistency, a client includes the peer's leaf |
913 | * certificate in the stored certificate chain, while a server does not. | ||
914 | */ | ||
915 | cert = sk_X509_shift(certs); | ||
913 | 916 | ||
914 | if ((pkey = X509_get0_pubkey(cert)) == NULL) | 917 | if ((pkey = X509_get0_pubkey(cert)) == NULL) |
915 | goto err; | 918 | goto err; |