From nobody Thu Oct 19 18:36:42 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SBGdl0Xjnz4xkkL; Thu, 19 Oct 2023 18:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SBGdl04bQz3Vlx; Thu, 19 Oct 2023 18:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697740603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=270yDVKUP7yfmdq55+iiH+i22zK3yMYgsfyUjTSMs5g=; b=ZvARRnklgc+WiBaQ5gnA0P78zEmzLjDsyeCTt5svXhuvdqFqJAd1OjKyQg0rhTyXp1n+y6 vFSwr2dS0AJgKDMdyE8FMDh6S2fxdwRZQv3ZXLrb4YuBoehKHoFDIZ8Laiq+Cu1KuAuUfo fjLOqofyVqLEnBkY7m7+2sLIzsV08VWxxJs5hcKDH5rPE1aJ68oLgXazBTZ/I/nNzlN225 ZeF9/UAGc0nMzUkQ7UzMFwdA2GN5+s7a5QK1IimzQZgPM1toAVWwVoTbUXhTKktwzKQzVN e2RekPvfq21JtphK/lnKr9komghcYB4Htm8b6ahq6u60ohNDv244+nf/IMAe4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697740603; a=rsa-sha256; cv=none; b=kvRXNPkRPr6mv9cHljSwfp8t0VbW+shnDGLwL/NWBbna9ax2oi9d1vO9pYolpaivb+6Pze W0ts5b4lAf610zurd+GvaPgCyFjvpWuq8ADsXGkVupql1GQM5vHMrx/o7mEITYfX8KlqHH 5CZmPnqv8pRlZEHnxh4n/4d5jaQQgLanWVucxtgW3ubA/ENxU19Xmch5zFknLJ/1UWzbh4 eT1H4CeamO++tlW5KdImSjSXy/wVjAN4Vqe0jkVBH21+3NM1C2zIpwDcY9YL4ksI6YZCGC uaBW1wjN3ylhG7FLZ63WmqwopUSDoYrStrlRGKxOlKpiXGFIDA2PuT6Ts6U9fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697740603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=270yDVKUP7yfmdq55+iiH+i22zK3yMYgsfyUjTSMs5g=; b=gS9meMzdxg4ar6gSZc8Tk3nOnn07rZxkNEKqV08QWtwME9BWrFby2OCuwkOph4XWGo0jC6 UpfBi+x2UtdqkldxHdR6ZwXqNLqYfE6HWbbaIakCudDL/+JsVSHcmHzoNEveHSsMVvd5Xg uehlS8rHJq8r4eouvwHyxUym6U4s6LQKIoKOUfEFq88+3Rk5m+fAKq1EnLLbdCbZxchHSJ m5d0xZiLhJ9Mj/FqkYxT7b6S/w5QfHUGzgzxZljs1edHkyWHz0vIjt21/w3hfQkvgBAcXd lgqzc9VaxNgPvHVm/slYmGRKmwMtO/TnoI9AY5q/7kzkYeGeH3nXcBliLuZfcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SBGdk6F8Kz10tb; Thu, 19 Oct 2023 18:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39JIags6094142; Thu, 19 Oct 2023 18:36:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39JIagVX094139; Thu, 19 Oct 2023 18:36:42 GMT (envelope-from git) Date: Thu, 19 Oct 2023 18:36:42 GMT Message-Id: <202310191836.39JIagVX094139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3de4f78d46c5 - main - Add support for Chacha20-Poly1305 to kernel TLS on FreeBSD. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3de4f78d46c58f23017942967ec74cbc3d2e175d Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3de4f78d46c58f23017942967ec74cbc3d2e175d commit 3de4f78d46c58f23017942967ec74cbc3d2e175d Author: John Baldwin AuthorDate: 2020-12-23 22:09:51 +0000 Commit: John Baldwin CommitDate: 2023-10-19 18:34:58 +0000 Add support for Chacha20-Poly1305 to kernel TLS on FreeBSD. FreeBSD's kernel TLS supports Chacha20 for both TLS 1.2 and TLS 1.3. Obtained from: OpenSSL commit 77f3936928068bee9d7e0c6939709ac179cb1059 --- crypto/openssl/include/internal/ktls.h | 5 +++++ crypto/openssl/ssl/ktls.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/crypto/openssl/include/internal/ktls.h b/crypto/openssl/include/internal/ktls.h index 95492fd0659f..3c82cae26b47 100644 --- a/crypto/openssl/include/internal/ktls.h +++ b/crypto/openssl/include/internal/ktls.h @@ -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; diff --git a/crypto/openssl/ssl/ktls.c b/crypto/openssl/ssl/ktls.c index ddbfd1447c54..daa758294a4c 100644 --- a/crypto/openssl/ssl/ktls.c +++ b/crypto/openssl/ssl/ktls.c @@ -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) @@ -74,6 +78,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) {