Friday, May 6, 2016

opmsg chacha20-poly1305 trickery...


... and a lot of hassle checking out the new OpenSSL 1.1.0 API 

Support for chacha20-poly1305 stream cipher with AAD (poly1305)
thats causing erection to so many cryptographers recently
has been added to opmsg.Its only available to > OpenSSL 1.1.0,
so be sure your peer is also using it when you send
op messages like that.

The more tricky part is the new API that comes with
OpenSSL 1.1.0. Despite fixing a lot of issues in their
TLS implementation, the OpenSSL project still seems to
have enough time breaking their own API by:

1. Making structures opaquewhich means you cant longer
   declare EVP_MD_CTX and other types on the stack. So you are
   forced to use EVP_MD_CTX_create()/EVP_MD_CTX_destroy()
   since the type is forward declared now.

2. At the same time, removing the EVP_MD_CTX_destroy()
   function and adding _new()/_free() functions which do
   the same (!).

3. Declaring macros for EVP_MD_CTX_destroy(xxx) (with braces!)
   so that unique_ptr<> deleters eventually also break.
   1-3. alltogether make sure that no matter how you declared
   your variables, the OpenSSL team decided to throw your
   code to trash.

4. As if this isnt enough, EVP_PKEY_type() has been removed,
   even if its usage has been encouraged by various code
   examples in their manpage.

So OpenSSL decided to open a wiki to track the amount of
open source projects they offended by causing quite good
amount of time thats needed to rework the code.
Theres definitely more to be added there in future.

Nevertheless, opmsg is now OpenSSL 1.1.0 ready and still
works fine with lower versions and LibreSSL.

If its possible for you, you should consider switching to
LibreSSL , as everything is more smooth and straight there.
(But I think LibreSSL project should also offer https:// :)






No comments: