Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1729720pxu; Tue, 24 Nov 2020 07:35:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNLE8LYvLElPx7H582KSuewGgOnrDTeLx/zFY8MCnzNVNVe2ludAe7MU3KmvrrJ+8b1xfx X-Received: by 2002:a17:906:ccd3:: with SMTP id ot19mr4998009ejb.44.1606232128800; Tue, 24 Nov 2020 07:35:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606232128; cv=none; d=google.com; s=arc-20160816; b=QDiuZecHQVjfqdnHjvCTjozX8d5VTlSi1rYGmLxVNQzFcCwSGX5YBB+gwdysbgXmFP ZhQBGnd8Wn2mkGZ6xZbkns80UQrzX6o+jTzMWU1vdhphRJ+GmoW2gy4aW64kaaRJAZX4 v0F+dAbUfOuvYVglsu+XAu4eie3jlIg1ZUbnLTxrptVD8jHQwYslZ/EZOe8ZuerUdrAo zrzmGdea97h/leD8seCjrAxY8c/jB//uyxADg8auElqt5JbR5qPEeiOSoPDDcPAY8LaB 2cwgarOjZMcqqF/s96wTJWQQ5tvyzM1EHP1UGGPW4y4guEkDI11goQhzfGSYe5SwqbOp M6AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=0fAtiSHhQsXxT1qMidFjQzjM9vJVVXE3/LCiAKxOShA=; b=J6Nqi0TEpgagpbLiXuk0bdtLhZZbOhY8bPb0WwbeXRN2WwGK/XKALfHrqY3coRJWkg wGAEU0xEdIV7w3LGZoEiwh5z0g8OBEaHVGAkmEunQSNd8DSsbMP2vn8IGQC/9+Mdh0bN Ad2/ej+UNQc4CdnhY+a9OhcDnpaPJx8TobUxWjyh7N6ImXaAQv2CZs1HlURurKfvi/fV sv10h95qZ5bJf0zQjjhIXnXza32iceuHNhakCTltIN7cVKI04pKWV0Ro7+PZoQM9xSSQ QhvAI5RLLQCaAy8TaP7r7Frtgg+/Or7fFpmTrM2dxlAIfcqNnd8zlLlIByWFm7nCiAkS lKPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@novek.ru header.s=mail header.b=wN9g57E9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si8750425edx.69.2020.11.24.07.35.00; Tue, 24 Nov 2020 07:35:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@novek.ru header.s=mail header.b=wN9g57E9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389670AbgKXPdI (ORCPT + 99 others); Tue, 24 Nov 2020 10:33:08 -0500 Received: from novek.ru ([213.148.174.62]:47474 "EHLO novek.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730900AbgKXPdH (ORCPT ); Tue, 24 Nov 2020 10:33:07 -0500 X-Greylist: delayed 475 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Nov 2020 10:33:06 EST Received: from nat1.ooonet.ru (gw.zelenaya.net [91.207.137.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by novek.ru (Postfix) with ESMTPSA id 8C4845030CA; Tue, 24 Nov 2020 18:25:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 novek.ru 8C4845030CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=novek.ru; s=mail; t=1606231534; bh=dCPVZa/fEtN9rhac85+KpaJ3wXE+OOenM3dWYEYPgXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wN9g57E98mWzblPLYDYFGv8X4CHe6tMeJylcl3rVlMCM3QcWiWSBA3NrKfQQ3qi7P nxgXxgUdI0y3/sXMo0JgBH+/iCGM/9iX0K3hS51oiZE/PPZ2IT8Ufm/jSwBy0OVFfV 0pk14w9T3PLcN46/OddCfVie8x7Er5xWH3ac94Xw= From: Vadim Fedorenko To: Jakub Kicinski , Boris Pismenny , Aviad Yehezkel Cc: Vadim Fedorenko , netdev@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [net-next v2 4/5] net/tls: add CHACHA20-POLY1305 configuration Date: Tue, 24 Nov 2020 18:24:49 +0300 Message-Id: <1606231490-653-5-git-send-email-vfedorenko@novek.ru> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1606231490-653-1-git-send-email-vfedorenko@novek.ru> References: <1606231490-653-1-git-send-email-vfedorenko@novek.ru> X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gate.novek.ru Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Add ChaCha-Poly specific configuration code. Signed-off-by: Vadim Fedorenko --- net/tls/tls_main.c | 3 +++ net/tls/tls_sw.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 8d93cea..47b7c53 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -521,6 +521,9 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval, case TLS_CIPHER_AES_CCM_128: optsize = sizeof(struct tls12_crypto_info_aes_ccm_128); break; + case TLS_CIPHER_CHACHA20_POLY1305: + optsize = sizeof(struct tls12_crypto_info_chacha20_poly1305); + break; default: rc = -EINVAL; goto err_crypto_info; diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index b4eefdb..53106f0 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2290,6 +2290,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) struct tls12_crypto_info_aes_gcm_128 *gcm_128_info; struct tls12_crypto_info_aes_gcm_256 *gcm_256_info; struct tls12_crypto_info_aes_ccm_128 *ccm_128_info; + struct tls12_crypto_info_chacha20_poly1305 *chacha20_poly1305_info; struct tls_sw_context_tx *sw_ctx_tx = NULL; struct tls_sw_context_rx *sw_ctx_rx = NULL; struct cipher_context *cctx; @@ -2402,6 +2403,21 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) cipher_name = "ccm(aes)"; break; } + case TLS_CIPHER_CHACHA20_POLY1305: { + chacha20_poly1305_info = (void *)crypto_info; + nonce_size = 0; + tag_size = TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE; + iv_size = TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE; + iv = chacha20_poly1305_info->iv; + rec_seq_size = TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE; + rec_seq = chacha20_poly1305_info->rec_seq; + keysize = TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE; + key = chacha20_poly1305_info->key; + salt = chacha20_poly1305_info->salt; + salt_size = TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE; + cipher_name = "rfc7539(chacha20,poly1305)"; + break; + } default: rc = -EINVAL; goto free_priv; -- 1.8.3.1