Support for libsodium?
Hi, given the new abstractions to support PolarSSL, what interest/resistance would there be to supporting libsodium?
https://github.com/jedisct1/libsodium
For reference, the NaCL library comes from Daniel Bernstein, and is a reference implementation of some crypto primitives in a kind of high level library format. The crypto support is deliberately constrained (elliptic curves, poly1305, salsa20), but the library is in turn quite high level which it is hoped reduces the possibility for coding and implementation errors. All of the choices are currently sensible and sane and the algorithms are peer reviewed
Libsodium is an attempt to take the NaCL library and make it generally available across a wide range of architectures.
Of particular interest is the use of curve25519 as public key algorithm, it has extremely short signatures/keys, no known patent issues, decent speed and of course elliptic curves have shown greater resistance to cryptanalysis over the last few decades.
The motivation would be an even simpler and easier to peer review crypto library than PolarSSL (plus it's fast and easy to code with, and I particularly like the very short public keys/sigs)
Thanks for your thoughts
Ed W
Hi,
Quoted 3 lines · Ed W
Hi, given the new abstractions to support PolarSSL, what interest/resistance would there be to supporting libsodium?
https://github.com/jedisct1/libsodium
It took us quite some effort to reach the point where a polarssl-compiled openvpn would be able to talk to a (default-configured) openssl-openvpn, and I don't really see us using a crypto library that has none of the algorithms that we need for interoperability.
But then, I'm not the crypto geek here, I'm just the janitor...
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 10 lines
From: Gert Doering [mailto:[email protected]...]
Sent: donderdag 18 april 2013 22:45Hi,
Quoted 3 lines · Ed W
Hi, given the new abstractions to support PolarSSL, what interest/resistance would there be to supporting libsodium?
https://github.com/jedisct1/libsodium
Quoted 7 lines
It took us quite some effort to reach the point where a polarssl- compiled openvpn would be able to talk to a (default-configured) openssl-openvpn, and I don't really see us using a crypto library that has none of the algorithms that we need for interoperability.
But then, I'm not the crypto geek here, I'm just the janitor...
As a (minor) crypto geek, I'd love to see support for NaCl. I'm personally very happy with PolarSSL, but it's good to have more options.
There's a few issues that we need to overcome though:
- Unfortunately as far as I know there's no TLS support in NaCl. I guess it could work as a crypto library for the data channel and TLS-Auth parts of OpenVPN though. The control channel could then still be managed by PolarSSL/OpenSSL.
- Maintenance is an issue, are you (or do you know someone :)) willing to take responsibility for writing the required patches and maintaining them?
- As Gert said, he default algorithm in OpenVPN is Blowfish with a SHA-1 HMAC. There's no support for auto-negotiation, so using NaCl will break compatibility with an OpenSSL/PolarSSL-based OpenVPN. This is minor though, as it's easy to work around this as an end-user by specifying the algorithms in the client and server config files.
I don't want to sound overly negative though, the crypto abstraction in OpenVPN is flexible enough to support this sort of hybrid multi-library implementation now. At first glance, it would just require some tweaks to the build system, and some glue for libsodium.
Adriaan
Hi
I think I'm missing some of the subtleties of your reply, please forgive probable ignorance!
Quoted 3 lines
There's a few issues that we need to overcome though:
- Unfortunately as far as I know there's no TLS support in NaCl. I guess it could work as a crypto library for the data channel and TLS-Auth parts of OpenVPN though. The control channel could then still be managed by PolarSSL/OpenSSL.
I don't understand what part of TLS you would miss here? The actual encryption and hmac protocol would be fixed (salsa20/poly1305). The key exchange would be done using elliptic curves (although in fact you would normally just use the crypto_box interface and it would handle key generation and authentication for you.
The magic of curve25519 is that there is nothing special about the choice of public/private keys. Any 32 byte random bytes are a valid key. This leads to very compact key exchanges (and easy key generation, pick 32 random bytes).
Sender and receiver can compute the same private session key from only the other side's public key and your own private key (you end up with the same key on both sides). This means there is a mechanism to implicitly exchange a shared secret key for the symmetric cipher.
Libsodium introduces signing, but the library itself is a little weak on handling of signed public keys, so it's certainly true that we have the bootstrapping problem of securing the public channel, that said I should think most users of openvpn are NOT currently using signed ssl certs? I guess we could introduce the idea of known/fixed server certificates to mitigate this, or at least a distributed signing key which is used to sign the certs (introducing traditional key signing brings back open/polarssl, so I propose we discount that?). I think this is workable though.
Finally, because the encryption algorithm is effectively stateless, an interesting option presents, which is to have a completely connectionless encrypted stream - this has some possible benefits with regards to multi-homing and disconnected clients, eg you could trivially pass your encrypted packets across multiple internet connections, as long as the server receives them via some interface, there is no reason to care which interface they came in on. This may have some useful applications?
Quoted 1 line
- Maintenance is an issue, are you (or do you know someone :)) willing to take responsibility for writing the required patches and maintaining them?
Tentatively...
Quoted 1 line
- As Gert said, he default algorithm in OpenVPN is Blowfish with a SHA-1 HMAC. There's no support for auto-negotiation, so using NaCl will break compatibility with an OpenSSL/PolarSSL-based OpenVPN. This is minor though, as it's easy to work around this as an end-user by specifying the algorithms in the client and server config files.
Yes, I see this as a completely fixed implementation choice for crypto algorithms.
Lets argue this quickly. The crypto *will* show signs of weakness at some future point, TLS allows dropping in some new algorithm and keeping the basic protocol the same... in theory... But in practice there have been a number of significant weakenesses found in TLS and SSL recently which has in turn forced a requirement to redeploy compiled code to clients.
So I would claim, in practice requiring an occasional redeployment of clients and servers with fixed implementation of crypto algorithms is probably workable for *many* users (not all). The choices made for the crypto are *probably* good choices with a multi-year view, so we aren't suggesting something with known reasons that regular redeployments would be required.
To me the tradeoff looks reasonable, simpler crypto code that should change less frequently, but in return any change will likely require a full redeployment of all servers and clients.
Quoted 1 line
I don't want to sound overly negative though, the crypto abstraction in OpenVPN is flexible enough to support this sort of hybrid multi-library implementation now. At first glance, it would just require some tweaks to the build system, and some glue for libsodium.
Yeah, hopefully, because crypto-box supplies almost all of the crypto needs, I'm hoping that it will be possible to compile out a significant chunk of openvpn.
Why even both with openvpn? Well there is curvetun, which is a simple tun implementation using exactly the nacl library. A quick look at the code shows that it's 90% handling the tun device, setting things up, handling udp negotiations, etc, ie boiler plate. Openvpn already has all that handling for fragmenting packets, MTU, session setup, it's control channel, etc, that it would be no fun re-implementing all of that.
OpenVPN with libsodium would create a kind of locked down implementation, with certain predefined crypto choices made for you. I think this has some potential benefits for many situations?
OK, so what big picture feature did I misunderstand that TLS is providing that I don't get from libsodium...?
Cheers
Ed W
Quoted 2 lines
Adriaan
Quoted 6 lines · Gert Doering
Hi,
Quoted 3 lines · Ed W
Hi, given the new abstractions to support PolarSSL, what interest/resistance would there be to supporting libsodium?
https://github.com/jedisct1/libsodium
Quoted 6 lines
It took us quite some effort to reach the point where a polarssl-compiled openvpn would be able to talk to a (default-configured) openssl-openvpn, and I don't really see us using a crypto library that has none of the algorithms that we need for interoperability.
But then, I'm not the crypto geek here, I'm just the janitor...
Just to be clear - the end result using libsodium would *not* speak to an openssl peer. Only libsodium to libsodium would be supported. Essentially, libsodium is a very simple API which defines restricted choices for crypto alorithms and signing algorithms. The choices are at least finalists at various crypto competitions and therefore sensible (ie they have had at least sensible amounts of peer review)
So basically there is no requirement to negotiate crypto protocols, there is just one choice... (but the hope is that it's a good one and worth the reduction in code quantity)
Cheers
Ed W
Quoted 22 lines
-----Original Message-----
From: Ed W [mailto:[email protected]...]
Sent: vrijdag 19 april 2013 11:50
To: Adriaan de Jong
Cc: Gert Doering; [email protected]
Subject: Re: [Openvpn-devel] Support for libsodium?Hi
I think I'm missing some of the subtleties of your reply, please forgive probable ignorance!
Quoted 3 lines
There's a few issues that we need to overcome though:
- Unfortunately as far as I know there's no TLS support in NaCl. I
guess it could work as a crypto library for the data channel and TLS- Auth parts of OpenVPN though. The control channel could then still be managed by PolarSSL/OpenSSL.
Quoted 7 lines
I don't understand what part of TLS you would miss here? The actual encryption and hmac protocol would be fixed (salsa20/poly1305). The key exchange would be done using elliptic curves (although in fact you would
normally just use thecrypto_boxinterface and it would handle key generation and authentication for you.
As far as I can see, what's missing is the TLS protocol itself :). This could use the primitives in libsodium, but is still not easy to implement (see my last comment).
Quoted 11 lines
The magic of curve25519 is that there is nothing special about the choice of public/private keys. Any 32 byte random bytes are a valid key.
This leads to very compact key exchanges (and easy key generation, pick 32 random bytes).Sender and receiver can compute the same private session key from only the other side's public key and your own private key (you end up with the same key on both sides). This means there is a mechanism to implicitly exchange a shared secret key for the symmetric cipher.
This isn't supported in TLS, as far as I know. You'd have to change the control channel to use a different protocol (see my last comment).
Quoted 4 lines
Libsodium introduces signing, but the library itself is a little weak on
handling of signed public keys, so it's certainly true that we have the bootstrapping problem of securing the public channel, that said I
Quoted 9 lines
should
think most users of openvpn are NOT currently using signed ssl certs? I guess we could introduce the idea of known/fixed server certificates to mitigate this, or at least a distributed signing key which is used to sign the certs (introducing traditional key signing brings back open/polarssl, so I propose we discount that?). I think this is workable
though.
Certs are always signed, but by a CA of their own making. This way, multi-client setups are made possible. They're just not signed by a central cert authority.
Some sort of PKI is probably a good idea for a hub-and-spoke VPN model.
Quoted 64 lines
Finally, because the encryption algorithm is effectively stateless, an interesting option presents, which is to have a completely connectionless encrypted stream - this has some possible benefits with regards to multi-homing and disconnected clients, eg you could trivially
pass your encrypted packets across multiple internet connections, as long as the server receives them via some interface, there is no reason to care which interface they came in on. This may have some useful applications?Quoted 1 line
- Maintenance is an issue, are you (or do you know someone :))
willing to take responsibility for writing the required patches and maintaining them?
Tentatively...
Quoted 1 line
- As Gert said, he default algorithm in OpenVPN is Blowfish with a
SHA-1 HMAC. There's no support for auto-negotiation, so using NaCl will break compatibility with an OpenSSL/PolarSSL-based OpenVPN. This is minor though, as it's easy to work around this as an end-user by specifying the algorithms in the client and server config files.
Yes, I see this as a completely fixed implementation choice for crypto algorithms.
Lets argue this quickly. The crypto *will* show signs of weakness at some future point, TLS allows dropping in some new algorithm and keeping
the basic protocol the same... in theory... But in practice there have been a number of significant weakenesses found in TLS and SSL recently which has in turn forced a requirement to redeploy compiled code to clients.So I would claim, in practice requiring an occasional redeployment of clients and servers with fixed implementation of crypto algorithms is probably workable for *many* users (not all). The choices made for the crypto are *probably* good choices with a multi-year view, so we aren't suggesting something with known reasons that regular redeployments would
be required.To me the tradeoff looks reasonable, simpler crypto code that should change less frequently, but in return any change will likely require a full redeployment of all servers and clients.
Quoted 1 line
I don't want to sound overly negative though, the crypto abstraction
in OpenVPN is flexible enough to support this sort of hybrid multi- library implementation now. At first glance, it would just require some tweaks to the build system, and some glue for libsodium.
Yeah, hopefully, because crypto-box supplies almost all of the crypto needs, I'm hoping that it will be possible to compile out a significant chunk of openvpn.
Why even both with openvpn? Well there is curvetun, which is a simple tun implementation using exactly the nacl library. A quick look at the code shows that it's 90% handling the tun device, setting things up, handling udp negotiations, etc, ie boiler plate. Openvpn already has all
that handling for fragmenting packets, MTU, session setup, it's control channel, etc, that it would be no fun re-implementing all of that.
Quoted 8 lines
OpenVPN with libsodium would create a kind of locked down implementation, with certain predefined crypto choices made for you. I think this has some potential benefits for many situations?
OK, so what big picture feature did I misunderstand that TLS is providing that I don't get from libsodium...?
I misunderstood your wish to completely get rid of TLS. That would require a major overhaul in the way the control channel in OpenVPN is handled. OpenVPN is completely centered around the idea of a TLS control channel across which data channel keys are negotiated. Although I'd love to see that kind of flexibility in OpenVPN, the code base is nowhere near ready for that. It's a nice challenge though :).
Another, more philosophical, question is whether the product is still OpenVPN after such a change. It's certainly not line-compatible with OpenVPN.
Adriaan
Quoted 3 lines · Adriaan de Jong
I misunderstood your wish to completely get rid of TLS. That would require a major overhaul in the way the control channel in OpenVPN is handled. OpenVPN is completely centered around the idea of a TLS control channel across which data channel keys are negotiated. Although I'd love to see that kind of flexibility in OpenVPN, the code base is nowhere near ready for that. It's a nice challenge though :).
Another, more philosophical, question is whether the product is still OpenVPN after such a change. It's certainly not line-compatible with OpenVPN.
Hmm, can you give me a pointer to relevant code so that I can get my hands dirty?
I'm still a bit unsure what you mean by "TLS" though? To my mind it's a protocol for negotiating parameters and implementing crypto. However, I *think* that what you might mean is that it's "an API which handles client session state, timeouts and creating packets to put on the network"?
Perhaps I need to get my hands dirty here... Sounds like we would need to introduce an abstraction for the TLS session handling so that this feels clean?
Note, I have a longer term interest here in multi-homing.
Cheers
Ed W
Quoted 18 lines
-----Original Message-----
From: Ed W [mailto:[email protected]...]
Sent: vrijdag 19 april 2013 12:35
To: Adriaan de Jong
Cc: Gert Doering; [email protected]
Subject: Re: [Openvpn-devel] Support for libsodium?Quoted 1 line · Adriaan de Jong
I misunderstood your wish to completely get rid of TLS. That would
require a major overhaul in the way the control channel in OpenVPN is handled. OpenVPN is completely centered around the idea of a TLS control channel across which data channel keys are negotiated. Although I'd love to see that kind of flexibility in OpenVPN, the code base is nowhere near ready for that. It's a nice challenge though :).
Quoted 1 line
Quoted 7 lines
Quoted 1 line
Another, more philosophical, question is whether the product is still
OpenVPN after such a change. It's certainly not line-compatible with OpenVPN.
Hmm, can you give me a pointer to relevant code so that I can get my hands dirty?
For documentation, you can generate the doxygen documentation. It's quite extensive, and should show you how things are handled.
At a very high level, OpenVPN has an external multiplexer that splits incoming packets into a control channel and data channel stream. The control channel is used to generate keys, negotiate sessions, and exchange parameters for the data channel. It has a reliability layer that ensures that packets arrive, even across a UDP connection. The data channel contains the actual network packets.
For the data channel, have a look at the crypto_* files. crypto_backend.h defines the interface that is expected from a crypto library. crypto_polarssl.* implements the polar version of this. You'll need to add detection and configuration options for libsodium to configure.ac too.
For the control channel, your starting point would be the ssl.h and ssl_backend.h files. I don't know how closely these match up to the cryptobox API... If we're lucky, you might be able to do something there. If not, have a look at the (external) multiplexer code, and see whether that can be refactored to your purposes.
Quoted 7 lines
I'm still a bit unsure what you mean by "TLS" though? To my mind it's a protocol for negotiating parameters and implementing crypto. However, I
*think* that what you might mean is that it's "an API which handles client session state, timeouts and creating packets to put on the network"?
It's used as the former in OpenVPN, as OpenVPN does packet handling, session state and timeouts itself. I have no idea how closely the whole API used in OpenVPN matches the cryptobox API, but it certainly isn't written for it.
Quoted 6 lines
Perhaps I need to get my hands dirty here... Sounds like we would need to introduce an abstraction for the TLS session handling so that this feels clean?
Note, I have a longer term interest here in multi-homing.
That's important, as all code in OpenVPN needs to be actively maintained, and there's only a small group of developers working on the project.
Hope that helps!
Adriaan