Added ChaCha20+Poly1305 support (stand-alone, cipher suites).

This commit is contained in:
Thomas Pornin 2016-12-13 20:01:19 +01:00
parent 9e71c0673a
commit b42bd5972f
26 changed files with 1952 additions and 523 deletions

View file

@ -202,7 +202,7 @@ static const unsigned char TA1_EC_Q[] = {
static const br_x509_trust_anchor TAs[2] = {
{
(unsigned char *)TA0_DN, sizeof TA0_DN,
{ (unsigned char *)TA0_DN, sizeof TA0_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
@ -213,7 +213,7 @@ static const br_x509_trust_anchor TAs[2] = {
}
},
{
(unsigned char *)TA1_DN, sizeof TA1_DN,
{ (unsigned char *)TA1_DN, sizeof TA1_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_EC,

View file

@ -46,6 +46,22 @@
*
* The macros below define which chain is selected. This impacts the list
* of supported cipher suites.
*
* Other macros, which can be defined (with a non-zero value):
*
* SERVER_PROFILE_MIN_FS
* Select a "minimal" profile with forward security (ECDHE cipher
* suite).
*
* SERVER_PROFILE_MIN_NOFS
* Select a "minimal" profile without forward security (RSA or ECDH
* cipher suite, but not ECDHE).
*
* SERVER_CHACHA20
* If SERVER_PROFILE_MIN_FS is selected, then this macro selects
* a cipher suite with ChaCha20+Poly1305; otherwise, AES/GCM is
* used. This macro has no effect otherwise, since there is no
* non-forward secure cipher suite that uses ChaCha20+Poly1305.
*/
#if !(SERVER_RSA || SERVER_EC || SERVER_MIXED)
@ -322,7 +338,11 @@ main(int argc, char *argv[])
*/
#if SERVER_RSA
#if SERVER_PROFILE_MIN_FS
#if SERVER_CHACHA20
br_ssl_server_init_mine2c(&sc, CHAIN, CHAIN_LEN, &SKEY);
#else
br_ssl_server_init_mine2g(&sc, CHAIN, CHAIN_LEN, &SKEY);
#endif
#elif SERVER_PROFILE_MIN_NOFS
br_ssl_server_init_minr2g(&sc, CHAIN, CHAIN_LEN, &SKEY);
#else
@ -330,7 +350,11 @@ main(int argc, char *argv[])
#endif
#elif SERVER_EC
#if SERVER_PROFILE_MIN_FS
#if SERVER_CHACHA20
br_ssl_server_init_minf2c(&sc, CHAIN, CHAIN_LEN, &SKEY);
#else
br_ssl_server_init_minf2g(&sc, CHAIN, CHAIN_LEN, &SKEY);
#endif
#elif SERVER_PROFILE_MIN_NOFS
br_ssl_server_init_minv2g(&sc, CHAIN, CHAIN_LEN, &SKEY);
#else
@ -339,7 +363,11 @@ main(int argc, char *argv[])
#endif
#else /* SERVER_MIXED */
#if SERVER_PROFILE_MIN_FS
#if SERVER_CHACHA20
br_ssl_server_init_minf2c(&sc, CHAIN, CHAIN_LEN, &SKEY);
#else
br_ssl_server_init_minf2g(&sc, CHAIN, CHAIN_LEN, &SKEY);
#endif
#elif SERVER_PROFILE_MIN_NOFS
br_ssl_server_init_minu2g(&sc, CHAIN, CHAIN_LEN, &SKEY);
#else