From patchwork Tue Nov 7 14:00:12 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: 118170 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4017215qgn; Tue, 7 Nov 2017 06:04:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMYMNF04FWn1VrvY7yMIp4HvhWcU7fyRZiBrKjDmAQdIOr5p4xSrZecA8wFWB609K17tOGVF X-Received: by 10.55.158.148 with SMTP id h142mr5011068qke.209.1510063461949; Tue, 07 Nov 2017 06:04:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510063461; cv=none; d=google.com; s=arc-20160816; b=Ra34lXPvLgPkgIkSlbCbcd6qs80jQen3w8UuiOmxdvzEQ4dti1knrWXZxHUkDbtc3N f5aT2VfhYN/BzigGOnt2ufVMMov4pCBTJykptni6uUqcMicvYu9ZAVzCb83yi3kz5/6C LOVlo3I6HlYJYNW2W7LMDIk12tVXXvdfMag3X7BIRTZG787K5lrO89xkh5eNkkkRbkLX Jy+E93leiTvF8HqLlcg7SIfbHszIU4/b7ZOCwfLEGjH3W/5j/TZ6QZpvXWCtczH7LaB/ 3FrEykZVwbyEnZx35cCIEERteHRBFzmCriJwr5rG6KIteUiopMkeByTCU9TAUbuxXNts Qzhg== 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=LeJPnG7vvjE8nzbo/lPJqd0kmyQg09g7EQea7nQ59EY=; b=KpycEHPoezFURb0/5rXRHaT5t+Hl4pLi+8f7SpNtriu2a5ObPGZ8EfC9siCrFmYxoy k/GrQ3TchrjC/37TBALe1vbaV82VNG05MpIFwbhsm3HzlipE83ekKCEcGfTky7KktQGd fwiy57omv+DjtimaBVXdPiXhaRmhOQA9KuOjnhtqidabi9uWEuwDArXQXB3uLlKEoFMn GRTTdCfXLyW2AvL7E3GsCp3Xug38ZjezjwT90p8NqeuyZF0Mj8eIn9lsSsVZk20AeyOi UKByavfZFxYHWgeb/Fi6Ai3BzWG0C0qZBvob4jEUMBn4oK1sCEsBOgBfR/FzLLWp4nMN 1Deg== 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 u63si1176319qka.307.2017.11.07.06.04.21; Tue, 07 Nov 2017 06:04:21 -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 44DF160C88; Tue, 7 Nov 2017 14:04:21 +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 33F3860C6A; Tue, 7 Nov 2017 14:00:56 +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 C628E60386; Tue, 7 Nov 2017 14:00:25 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 8AF6A60592 for ; Tue, 7 Nov 2017 14:00:18 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 09E4934C4F65 for ; Tue, 7 Nov 2017 17:00:17 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bhlkY2TafU-0GCaSxIf; Tue, 07 Nov 2017 17:00:16 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mAkgTAX8AR-0GeucXNW; Tue, 07 Nov 2017 17:00:16 +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: Tue, 7 Nov 2017 17:00:12 +0300 Message-Id: <1510063212-30218-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510063212-30218-1-git-send-email-odpbot@yandex.ru> References: <1510063212-30218-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 271 Subject: [lng-odp] [PATCH API-NEXT v3 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: 17e6f7bd8c2da61bad27d90c4b530c0f5a80fb0d **/ 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..9341e2c78 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -51,6 +51,11 @@ static const odp_crypto_cipher_capability_t cipher_capa_aes_cbc[] = { {.key_len = 24, .iv_len = 16}, {.key_len = 32, .iv_len = 16} }; +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} }; + static const odp_crypto_cipher_capability_t cipher_capa_aes_gcm[] = { {.key_len = 16, .iv_len = 12}, {.key_len = 24, .iv_len = 12}, @@ -592,6 +597,7 @@ int odp_crypto_capability(odp_crypto_capability_t *capa) capa->ciphers.bit.des = 1; capa->ciphers.bit.trides_cbc = 1; capa->ciphers.bit.aes_cbc = 1; + capa->ciphers.bit.aes_ctr = 1; capa->ciphers.bit.aes_gcm = 1; capa->auths.bit.null = 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