File 0689-ssl-Fix-Authority-to-not-become-empty-in-pre-TLS-1.3.patch of Package erlang
From 3e13dd7693334309648c5284c996aa5234684434 Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Wed, 13 Oct 2021 14:49:17 +0200
Subject: [PATCH 1/4] ssl: Fix Authority to not become empty in pre TLS-1.3
CertificateRequest
The Authority could become empty as it was not adopted to handle
the new #cert() record.
---
lib/ssl/src/ssl_handshake.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl
index e7bbea3591..6210240011 100644
--- a/lib/ssl/src/ssl_handshake.erl
+++ b/lib/ssl/src/ssl_handshake.erl
@@ -1887,14 +1887,14 @@ supported_cert_type_or_empty(Algo, Type) ->
end.
certificate_authorities(CertDbHandle, CertDbRef) ->
- Authorities = certificate_authorities_from_db(CertDbHandle, CertDbRef),
+ Authorities = [ Cert || #cert{otp = Cert} <- certificate_authorities_from_db(CertDbHandle, CertDbRef)],
Enc = fun(#'OTPCertificate'{tbsCertificate=TBSCert}) ->
OTPSubj = TBSCert#'OTPTBSCertificate'.subject,
DNEncodedBin = public_key:pkix_encode('Name', OTPSubj, otp),
DNEncodedLen = byte_size(DNEncodedBin),
<<?UINT16(DNEncodedLen), DNEncodedBin/binary>>
end,
- list_to_binary([Enc(Cert) || {_, Cert} <- Authorities]).
+ list_to_binary([Enc(Cert) || Cert <- Authorities]).
certificate_authorities_from_db(CertDbHandle, CertDbRef) when is_reference(CertDbRef) ->
ConnectionCerts = fun({{Ref, _, _}, Cert}, Acc) when Ref == CertDbRef ->
--
2.31.1