From patchwork Fri Jan 26 14:00:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 125992 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp364264ljd; Fri, 26 Jan 2018 06:13:18 -0800 (PST) X-Google-Smtp-Source: AH8x224cNoh8s8y7Z1vrJTEZFf7LQTcgXzlmlc5Jqyn0xCMOGQ5ViCS7uL0rtO5rpWOejCAoLmTR X-Received: by 10.37.172.79 with SMTP id r15mr2220660ybd.386.1516975998292; Fri, 26 Jan 2018 06:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516975998; cv=none; d=google.com; s=arc-20160816; b=to69uz1ymko7GHtRWNtnFttA6k2vkbiPTyoOldYPsGpXrjOGiWVmjSM2ydEZoFdFMY W6VV5kQi0p5xEXqMpeUUf3mzSQN7RklrLf6iyi8gDseV/oglv2caB3xKF63xn9kBzwkX 8LTDweE/SqdgpFRiJ66EyIPPJnhSTLi1AdCSr08scF+2sOVqVXGQsS61Qt+1Bandnujq 8UYm1ohPsazfh0DiONbts4vHO4LjEjqOuFjvQ0nGm1/8iz4gFBk2I8l0l0ikw3D8M5hK lfcF92MRTFcjVbbKBhLID2IA5sZbdkvlVnBkYeWOcLDzHlSAHIBO6m9vSJs+9cG6+xsO j1AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=3JO68HgeJVu+Z5oRZmobm7DqSB7j9A3mZTX/fDBCYKo=; b=VqQzfu+m44HopED0DOXzNLzy4m5V/8TvAyvKhaWIhasRWOcziynPuegqXsojQvR+lK JSjXV1SLEzwXmk1GVF0zMNWa2c3Jjws9jQwV4UKCrsaqe3EvNNqplIXna74gsC8oT5YA Ngp5cZy3N/+a4WKK/pDPXJ5c2+ycASIIjEH/3ujCjgplU6rYWUDI33gTU5QhqtGMl3GP egmdxFJklhsLJakt2DEYvv3uJPQjn6FXf6DkJWfgchTR6lnCVy+tC/xHPuFtE4qg/TOV 0Lcy50JHb49aF6s08S+NdrzYJwhcHHrxZ4kOdVrlZe/a199wMMTmOTVkQ78Vy7CIKLSG kc8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id c8si4241160qtn.103.2018.01.26.06.13.18; Fri, 26 Jan 2018 06:13:18 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id F2DBC617E7; Fri, 26 Jan 2018 14:13:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 78C0A617F4; Fri, 26 Jan 2018 14:01:42 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 17E90617BA; Fri, 26 Jan 2018 14:01:34 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 9C87960940 for ; Fri, 26 Jan 2018 14:00:22 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward102p.mail.yandex.net (Yandex) with ESMTP id E9C754303508 for ; Fri, 26 Jan 2018 17:00:20 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id AcZbvYD3Bv-0KqO0IaU; Fri, 26 Jan 2018 17:00:20 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id eWPAvjBUnV-0K1SmdRE; Fri, 26 Jan 2018 17:00:20 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 26 Jan 2018 17:00:14 +0300 Message-Id: <1516975214-22205-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516975214-22205-1-git-send-email-odpbot@yandex.ru> References: <1516975214-22205-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 428 Subject: [lng-odp] [PATCH API-NEXT v5 6/6] linux-gen: ipsec: support ChaCha20-Poly1305 X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Support IPsec ChaCha20-Poly1305 on top of linux-generic's crypto support. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 428 (lumag:chacha-poly1305) ** https://github.com/Linaro/odp/pull/428 ** Patch: https://github.com/Linaro/odp/pull/428.patch ** Base sha: 44974a09b01c79adb9637a5dff38539598a76737 ** Merge commit sha: 2e711497bfd4fd2a2ca2c0882de3d93ae7d567af **/ platform/linux-generic/odp_ipsec.c | 1 + platform/linux-generic/odp_ipsec_sad.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index b6192377e..43d7b9f52 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -112,6 +112,7 @@ int odp_ipsec_auth_capability(odp_auth_alg_t auth, continue; if (ODP_AUTH_ALG_AES_GCM == auth || + ODP_AUTH_ALG_CHACHA20_POLY1305 == auth || ODP_DEPRECATE(ODP_AUTH_ALG_AES128_GCM) == auth) { uint8_t aad_len = 12; diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 031adef65..d97735408 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -210,6 +210,8 @@ uint32_t _odp_ipsec_cipher_iv_len(odp_cipher_alg_t cipher) #endif case ODP_CIPHER_ALG_AES_GCM: return 12; + case ODP_CIPHER_ALG_CHACHA20_POLY1305: + return 12; default: return (uint32_t)-1; } @@ -240,6 +242,8 @@ uint32_t _odp_ipsec_auth_digest_len(odp_auth_alg_t auth) case ODP_AUTH_ALG_AES_GCM: case ODP_AUTH_ALG_AES_GMAC: return 16; + case ODP_AUTH_ALG_CHACHA20_POLY1305: + return 16; default: return (uint32_t)-1; } @@ -392,6 +396,11 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) ipsec_sa->esp_iv_len = 8; ipsec_sa->esp_block_len = 16; break; + case ODP_CIPHER_ALG_CHACHA20_POLY1305: + ipsec_sa->use_counter_iv = 1; + ipsec_sa->esp_iv_len = 8; + ipsec_sa->esp_block_len = 1; + break; default: goto error; } @@ -411,6 +420,9 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) ipsec_sa->esp_block_len = 16; crypto_param.auth_iv.length = 12; break; + case ODP_AUTH_ALG_CHACHA20_POLY1305: + crypto_param.auth_aad_len = sizeof(ipsec_aad_t); + break; default: break; }