Skip to content

Commit

Permalink
Add support for Chacha20-Poly1305 to kernel TLS on FreeBSD.
Browse files Browse the repository at this point in the history
FreeBSD's kernel TLS supports Chacha20 for both TLS 1.2 and TLS 1.3.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #13752)
  • Loading branch information
bsdjhb authored and t8m committed Feb 4, 2022
1 parent 8e012cd commit 77f3936
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/internal/ktls.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
# define OPENSSL_KTLS_AES_GCM_128
# define OPENSSL_KTLS_AES_GCM_256
# define OPENSSL_KTLS_TLS13
# ifdef TLS_CHACHA20_IV_LEN
# ifndef OPENSSL_NO_CHACHA
# define OPENSSL_KTLS_CHACHA20_POLY1305
# endif
# endif

typedef struct tls_enable ktls_crypto_info_t;

Expand Down
10 changes: 10 additions & 0 deletions ssl/ktls.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ int ktls_check_supported_cipher(const SSL *s, const EVP_CIPHER *c,
case SSL_AES128GCM:
case SSL_AES256GCM:
return 1;
# ifdef OPENSSL_KTLS_CHACHA20_POLY1305
case SSL_CHACHA20POLY1305:
return 1;
# endif
case SSL_AES128:
case SSL_AES256:
if (s->ext.use_etm)
Expand Down Expand Up @@ -71,6 +75,12 @@ int ktls_configure_crypto(const SSL *s, const EVP_CIPHER *c, EVP_CIPHER_CTX *dd,
else
crypto_info->iv_len = EVP_GCM_TLS_FIXED_IV_LEN;
break;
# ifdef OPENSSL_KTLS_CHACHA20_POLY1305
case SSL_CHACHA20POLY1305:
crypto_info->cipher_algorithm = CRYPTO_CHACHA20_POLY1305;
crypto_info->iv_len = EVP_CIPHER_CTX_get_iv_length(dd);
break;
# endif
case SSL_AES128:
case SSL_AES256:
switch (s->s3.tmp.new_cipher->algorithm_mac) {
Expand Down

0 comments on commit 77f3936

Please sign in to comment.