<div dir="ltr"><div><div>Hi!<br><br></div>Thank you for the example <br><br></div>I did find one bug, the patch is here:<br><div><br>diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl<br>index 0956d35..dd3dc54 100644<br>--- a/lib/ssl/src/ssl_cipher.erl<br>+++ b/lib/ssl/src/ssl_cipher.erl<br>@@ -2837,7 +2837,7 @@ key_uses(OtpCert) -><br>     Extensions = ssl_certificate:extensions_list(TBSExtensions),<br>     case ssl_certificate:select_extension(?'id-ce-keyUsage', Extensions) of<br>     undefined -><br>-        undefined;<br>+        [];<br>     #'Extension'{extnValue = KeyUses} -><br>             KeyUses<br>     end.<br><br><br></div><div>my other sslv2 issue seems not to be related. (Probably a OpenSSL issue) Your example does however not work perfect <br></div><div>so I am continuing to look into this!<br><br></div><div>Regards Ingela Erlang/OTP team - Ericsson AB<br></div><div><br><br><br><br><div><div><div class="gmail_extra"><br><div class="gmail_quote">2018-05-04 12:25 GMT+02:00 Roger Lipscombe <span dir="ltr"><<a href="mailto:roger@differentpla.net" target="_blank">roger@differentpla.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 4 May 2018 at 08:32, Ingela Andin <<a href="mailto:ingela.andin@gmail.com">ingela.andin@gmail.com</a>> wrote:<br>
> This error is consistent with one of the errors I am seeing in the nightly<br>
> builds when running OpenSSL with only default parameters so I suspect<br>
> something is off in combination<br>
> version negotiation and cipher suite selection checks. I am looking in to<br>
> it!<br>
<br>
</span>I'm seeing the same, if it helps to reproduce. I generated my certificates with:<br>
<br>
#!/bin/sh<br>
<br>
# Create the CA key and certificate.<br>
openssl genrsa -out ca.key 2048<br>
openssl req -new -x509 -nodes -key ca.key -days 3653 -out ca.pem -subj<br>
"/CN=Test CA"<br>
<br>
# Create the server key and CSR.<br>
openssl genrsa -out server.key 2048<br>
openssl req -new -key server.key -out server.csr -subj "/CN=localhost"<br>
<br>
# Sign the CSR with the CA key.<br>
serial=$(date +"%s")<br>
openssl x509 -req -days 3563 -CA ca.pem -CAserial $serial<br>
-CAcreateserial -CAkey ca.key -in server.csr -out server.pem<br>
rm $serial<br>
<br>
I tested with:<br>
<br>
% Server<br>
{ok, _} = application:ensure_all_<wbr>started(ssl).<br>
Port = 11002.<br>
LOpts = [{certfile, "server.pem"}, {keyfile, "server.key"}].<br>
{ok, LSock} = ssl:listen(Port, LOpts).<br>
{ok, CSock} = ssl:transport_accept(LSock).<br>
ok = ssl:ssl_accept(CSock).<br>
<br>
% Client<br>
{ok, _} = application:ensure_all_<wbr>started(ssl).<br>
Port = 11002.<br>
COpts = [{verify, verify_peer}, {cacertfile, "ca.pem"}].<br>
{ok, Sock} = ssl:connect("localhost", Port, COpts).<br>
<br>
The server reports:<br>
<br>
=INFO REPORT==== 4-May-2018::11:22:20.971130 ===<br>
<span class="gmail-">TLS server: In state hello at tls_handshake.erl:130 generated SERVER<br>
ALERT: Fatal - Handshake Failure - malformed_handshake_data<br>
<br>
</span>** exception error: no match of right hand side value<br>
{error,{tls_alert,"handshake failure"}}<br>
<br>
The client reports:<br>
<br>
=INFO REPORT==== 4-May-2018::11:22:20.981524 ===<br>
<span class="gmail-">TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure<br>
<br>
</span>** exception error: no match of right hand side value<br>
{error,{tls_alert,"handshake failure"}}<br>
<br>
The same code works fine with 20.3.1<br>
<br>
Thanks,<br>
Roger.<br>
</blockquote></div><br></div></div></div></div></div>