<div dir="ltr"><div class="gmail_extra">Hi!<br><div class="gmail_quote"><br></div><div class="gmail_quote">2016-04-08 16:13 GMT+02:00 Nicolas Thauvin <span dir="ltr"><<a href="mailto:nthauvin@gmail.com" target="_blank">nthauvin@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
 We've been trying to restrict SSL ciphers to a secure set in Yaws / OTP R18, but only a few of them were actually taken into account (leading to connection issues from old browsers).<br>
<br>
According to the documentation, one can list the availables ciphers with ssl:cipher_suites().<br>
For example:<br>
<br>
[...<br>
 {rsa,aes_256_gcm,null,sha384},<br>
 {rsa,aes_256_cbc,sha256},<br>
...]<br>
<br>
Note there are 3-tuples and 4-tuples in the result.<br>
<br>
Now, when the customised 'ciphers' SSL option is set, its content is processed by ssl:binary_cipher_suites/2<br>
<br>
(Beam you up : <a href="https://github.com/erlang/otp/blob/maint-18/lib/ssl/src/ssl.erl#L1092" rel="noreferrer" target="_blank">https://github.com/erlang/otp/blob/maint-18/lib/ssl/src/ssl.erl#L1092</a>)<br>
<br>
There comes the issue : this function expects all the entries to be the same tuple size (3 or 4) according to a matching on the first element, losing entries from the list when they don't match the tuple size.<br>
<br>
The patch for ssl:binary_cipher_suites/2 is trivial, but why does ssl_cipher:suite() still returns a mixed-size of tuples since 4-tuples seems to be considered as backward compatible according to the comments ?<br>
<br></blockquote><div><br></div><div><br></div><div>As of TLS-1.2 ciphersuites are a set of 4 algorithms. In earlier versions the set was three algorithms and the forth was implicitly hardcoded. So all cipher suites</div><div>are represented as 4-tuples internaly but for backwards compatibility we need to be able to input old cipher suites as 3-tuples.</div><div><br></div><div>However I thought the comment was a bit percuiler (it suggests its the other way around), and I looked into it and it turns out a very long time ago the cipher suites had a different forth element 'no_export', but then we did decide not to implement any export ciphers and the tuples became 3-tuples.  And much later came TLS-1.2.  So we need to fix that bug and remove that comment.</div><div><br></div><div>Acctualy I reasently fixed the  ssl:cipher_suites(), as it wrongly filtered the new 4-tuple ciphers so it returned always 3-tuples, and I do not think that will worked out greatly either. <br></div><div><br></div><div>Regards Ingela Erlang/OTP team - Ericsson AB</div><div><br></div><div><br></div><div><br></div></div></div></div>