From patchwork Sun Jan 28 09:00:09 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: 126072 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp1563111ljd; Sun, 28 Jan 2018 01:12:56 -0800 (PST) X-Google-Smtp-Source: AH8x227gSG3fTfSAe1B0VOItRgCo//J2w5tjXp/Z65kblx5PkdrNxLDIav2FdR/eaD9G8CCHyjqf X-Received: by 10.55.81.198 with SMTP id f189mr29190896qkb.204.1517130776691; Sun, 28 Jan 2018 01:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517130776; cv=none; d=google.com; s=arc-20160816; b=NWD2PbMdIkPdnL8jF4XqpxNYean0x+wbQGRu2oGuZO5Xv7R/jpaiO/Z+SxeuFsd/j3 DzMwIGxAfqZmmnbnaHIuouWlLoH/36QAOgQ4hlJ6ZSQhC/pKBLp4XgImYJeEHV3s6Sw0 290KKDdwtnw8fXpunQf3wAsZtzfg/XSegfVeEpWJQAINKiKJIGWjwAoCPKEqJ6Z4CoDk REQ5nnx3GHiEnDrPI44cxVenxdzKcmHWhe5JRW1F0VVVsCdBH8cwaD+g0rh1yTh869Hm 7+XxNGrsLsp0yFapWhl3zyuAtJ5TtKS0Go8gGEau6KD7U30ZEAZeQa8VPtL2xvdtmVmz MC0A== 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=Gu+Mpf9f4k4zjIDt0acz6mkYoIwzs+2FvY1dB4+2Amg=; b=XTmFXgXuJVkQilreJ+P+BMOaek4xqBKeZFQTuTgUgyPYwAUYqCa4EJTHRgtp8GjycR 1mTB15bExfs8u+4u+3GPtgfjVVTOqB0YhRmyT7/FGzr+zn+W3ouzUNHj1jlEV5UxNgwr vkn2QvJU93MUIp7bRDMoHtxpTMRTFqefv3Lm5dIjiNJpDGsY+u7nRQKOoRE0OvLJTTaF IHpwHI875g74r/BHK/OsMzrWoJroVzT2M+4ufOeMQbj0qcUNoWU0/sUnj8km3jv8L6AE 5xRx/03yqQewtgSqhz3YCa9MynkDtsia0M8g+ri/ANRbVrhR8LsyuVyyF1NyKU1LKo84 wOaQ== 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 i2si2234672qtj.314.2018.01.28.01.12.56; Sun, 28 Jan 2018 01:12:56 -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 549CD62772; Sun, 28 Jan 2018 09:12:56 +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_H3, RCVD_IN_MSPIKE_WL 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 BBF5E62783; Sun, 28 Jan 2018 09:01:29 +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 76FC7617E5; Sun, 28 Jan 2018 09:00:36 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 127CF6176F for ; Sun, 28 Jan 2018 09:00:22 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 9EA3B783A01 for ; Sun, 28 Jan 2018 12:00:20 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id idz6rSF8tb-0K6OEWVb; Sun, 28 Jan 2018 12:00:20 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kBi2pciDaV-0KXeMXNH; Sun, 28 Jan 2018 12: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: Sun, 28 Jan 2018 12:00:09 +0300 Message-Id: <1517130009-11837-17-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517130009-11837-1-git-send-email-odpbot@yandex.ru> References: <1517130009-11837-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 434 Subject: [lng-odp] [PATCH API-NEXT v2 16/16] 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 434 (lumag:crypto-upd) ** https://github.com/Linaro/odp/pull/434 ** Patch: https://github.com/Linaro/odp/pull/434.patch ** Base sha: 0bdad6d2562166eec4abeb957b6bb5067de9fe94 ** Merge commit sha: 8947b874421e06f87f32ec66357967a71e46e986 **/ 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; }