From patchwork Thu Nov 2 17:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 117835 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp2316570edm; Thu, 2 Nov 2017 10:01:36 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RexSxGv+QxsfHpGmgH7xTXJ8lWwuzYKEtLo5zmyomI6uyLypOabtvNdQB4DR5G8XRqWAsH X-Received: by 10.55.80.3 with SMTP id e3mr5439537qkb.254.1509642096082; Thu, 02 Nov 2017 10:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509642096; cv=none; d=google.com; s=arc-20160816; b=Bef6aHnVtUSjZuOavm6pDAlgI16JVr4mLCRWoeOgIYUNPmw14lGDxQrHpilTPZLZ/y 3vXRDNbMCkGhmS7wFY8Bw5I9ZA2ovy0/PMOGNC5rWqzJWJgtZVxt8UXFqt9Ry67G11b5 LlB1dCsfb7SuKFh7R7DbGMEVIN7EiDgF3JpftmIug+GL9xvhg4UQAC8gfMpSn6aP3Kzd QZ2lWrTXsyJG8aGbwEPxZriBT1z0/c/Qki9siGY/pXGpQQvCLIEXhbL10FsDW/8Gzu+3 9YWCU7kDjqFzAnvnIKGhHM9xdZklcBzP2YhUfL9XUMnqLiTfsrFmw1S1FJ8UrpKprnml lwvg== 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=JsTyOGNda/nsAYspgAbpKrzqZ5585KIPMwIDb5wMuAg=; b=GJgdGQgF9u+HsvVf+wqttfZxhQYHbTwrM/jVNdUL8xwjhEugi70sPEDFFB7GgCysxe i3pqyYvh+nMpNzTxYoFVuqD/1eAfsXKDv2AG2dL6bjpjWGb8eP7V9H39mGbXrm9ir3Db l049Oz11avzjm+TYLNnxNRcgZxqvTkqkMwBf6/pyVQIXmSeFXRr4a48k68gcVcgRQ4PX Od7MEmBnFlFTVa8xOH8T2JZv1dWZxs0+wu6d6HUZN/D2IU/++Inz/lyvSBOwMBgbExyw TXTchYWBdEbJYWOE5rJnE+C2/85+9loeXumWOU0c6eZyNcyxiUBX4Jgg0yesrRErsK0H u6tg== 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 o7si1553514qkl.118.2017.11.02.10.01.35; Thu, 02 Nov 2017 10:01:36 -0700 (PDT) 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 AACAD60A31; Thu, 2 Nov 2017 17:01:35 +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 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 59FF360AC0; Thu, 2 Nov 2017 17:00:22 +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 A0E7B608C4; Thu, 2 Nov 2017 17:00:15 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 76D8E6069C for ; Thu, 2 Nov 2017 17:00:13 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward102j.mail.yandex.net (Yandex) with ESMTP id B08FF5604BDC for ; Thu, 2 Nov 2017 20:00:11 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id YiuQlWopdH-0Bxeb9FO; Thu, 02 Nov 2017 20:00:11 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id EKt7cPg9I4-0Bsa9rNN; Thu, 02 Nov 2017 20:00:11 +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: Thu, 2 Nov 2017 20:00:08 +0300 Message-Id: <1509642008-6978-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509642008-6978-1-git-send-email-odpbot@yandex.ru> References: <1509642008-6978-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 271 Subject: [lng-odp] [PATCH API-NEXT v2 3/3] linux-gen: crypto: add AES-CTR support 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 Add implementation for AES-CTR cryptographic mode. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 271 (lumag:aes-ctr) ** https://github.com/Linaro/odp/pull/271 ** Patch: https://github.com/Linaro/odp/pull/271.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: b976868759b2e8ee4ff32d3749e1df5cbd844ef7 **/ platform/linux-generic/odp_crypto.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 3174feee0..2fbf91f28 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -56,6 +56,11 @@ static const odp_crypto_cipher_capability_t cipher_capa_aes_gcm[] = { {.key_len = 24, .iv_len = 12}, {.key_len = 32, .iv_len = 12} }; +static const odp_crypto_cipher_capability_t cipher_capa_aes_ctr[] = { +{.key_len = 16, .iv_len = 16}, +{.key_len = 24, .iv_len = 16}, +{.key_len = 32, .iv_len = 16} }; + /* * Authentication algorithm capabilities * @@ -593,6 +598,7 @@ int odp_crypto_capability(odp_crypto_capability_t *capa) capa->ciphers.bit.trides_cbc = 1; capa->ciphers.bit.aes_cbc = 1; capa->ciphers.bit.aes_gcm = 1; + capa->ciphers.bit.aes_ctr = 1; capa->auths.bit.null = 1; capa->auths.bit.md5_hmac = 1; @@ -639,6 +645,10 @@ int odp_crypto_cipher_capability(odp_cipher_alg_t cipher, src = cipher_capa_aes_cbc; num = sizeof(cipher_capa_aes_cbc) / size; break; + case ODP_CIPHER_ALG_AES_CTR: + src = cipher_capa_aes_ctr; + num = sizeof(cipher_capa_aes_ctr) / size; + break; case ODP_CIPHER_ALG_AES_GCM: src = cipher_capa_aes_gcm; num = sizeof(cipher_capa_aes_gcm) / size; @@ -763,6 +773,16 @@ odp_crypto_session_create(odp_crypto_session_param_t *param, else rc = -1; break; + case ODP_CIPHER_ALG_AES_CTR: + if (param->cipher_key.length == 16) + rc = process_cipher_param(session, EVP_aes_128_ctr()); + else if (param->cipher_key.length == 24) + rc = process_cipher_param(session, EVP_aes_192_ctr()); + else if (param->cipher_key.length == 32) + rc = process_cipher_param(session, EVP_aes_256_ctr()); + else + rc = -1; + break; #if ODP_DEPRECATED_API case ODP_CIPHER_ALG_AES128_GCM: /* AES-GCM requires to do both auth and