From patchwork Mon May 22 21:59:57 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: 100324 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp46704qge; Mon, 22 May 2017 15:07:10 -0700 (PDT) X-Received: by 10.200.38.76 with SMTP id v12mr26725609qtv.257.1495490830127; Mon, 22 May 2017 15:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495490830; cv=none; d=google.com; s=arc-20160816; b=gxfi47U6apwbxNqwqdDRg7Mv9/WxcbvL/yW7E/Ln1DpefACzWZ1I/C/+eXfwRnnoSg toieZb3EdEDkeaPAfnPXwnWLDU/r/JwoXMIWJ9g26wzZidqILX3d890/PQo8o2FSQ9I7 Lb1YtKU9Fo4MdfsFEk5gCWfZOKXUKEulp3z63uF4NYz5lm1sgehS0bsd7Y55EoqS6SLd yLOI0Wdf0UI//3KUh4tjp0/g25HNUs0kShjNAgPojaem+b+8Tkzt75BmHh/CNLtAxaN0 6nHfhCAmBjsDiLqUj4f08b3LK0g5WiD8lYxwE9N4dnCv/vSiVCnrklpc6eOZUltG/8eX HPBQ== 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=y+QR1VeMpbWlB97F9dvdPkW02HamDXX7h1KaSOQHmBM=; b=KB0JwCRq+sqY5NXraPhfir3N4ywHaxwiidVdVZHZpiIEiu9cR/iwQD5JsWm2jiR598 fCCw/W8AwMviCJyZEim09HVc8pqotsZsO6REyNdqq39ZZi+W9MhH9QazNeXfnzzMtni2 GuLcBLRljOG3FguJ4k7urKEL6csZs3BroM1Xwb2xbhc2CwkcPz2umrZt1K98UXWbopKZ A818HHfZC6EdqF3EKN/zsuZC+9xrprIvARP59NhuvhV6fr3KTh7w3lCvSzcOy0K5JZVh tH48jftmwqUor2SOOb8Pzfv4wQlEMHfuiNcqSHXflY/pjdgwf1fHP7A3vLm3NxiqP5sD 2d8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f41si19350087qte.254.2017.05.22.15.07.08; Mon, 22 May 2017 15:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 D0E24608BA; Mon, 22 May 2017 22:07:08 +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,URIBL_BLOCKED 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 BD5D8607A3; Mon, 22 May 2017 22:00:59 +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 7C7F960ACC; Mon, 22 May 2017 22:00:26 +0000 (UTC) Received: from forward5m.cmail.yandex.net (forward5m.cmail.yandex.net [5.255.216.23]) by lists.linaro.org (Postfix) with ESMTPS id D2AEC607B5 for ; Mon, 22 May 2017 22:00:21 +0000 (UTC) Received: from smtp3m.mail.yandex.net (smtp3m.mail.yandex.net [IPv6:2a02:6b8:0:2519::125]) by forward5m.cmail.yandex.net (Yandex) with ESMTP id 4B43220FC4 for ; Tue, 23 May 2017 01:00:20 +0300 (MSK) Received: from smtp3m.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp3m.mail.yandex.net (Yandex) with ESMTP id 28FB02840B67 for ; Tue, 23 May 2017 01:00:19 +0300 (MSK) Received: by smtp3m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ll1QrMKPBI-0JE8wwUH; Tue, 23 May 2017 01:00:19 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 23 May 2017 00:59:57 +0300 Message-Id: <1495490409-30066-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495490409-30066-1-git-send-email-odpbot@yandex.ru> References: <1495490409-30066-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 34 Subject: [lng-odp] [PATCH API-NEXT v2 8/20] crypto: linux-generic: add capabilities for CIPHER_NULL and AUTH_NULL 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 There is no point in having separate cases for NULL algorithms. Add capabilities returning 0 key/digest/iv length. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 34 (lumag:crypto-update-main-new) ** https://github.com/Linaro/odp/pull/34 ** Patch: https://github.com/Linaro/odp/pull/34.patch ** Base sha: 826ee894aa0ebd09d42a17e1de077c46bc5b366a ** Merge commit sha: 7c49c61063e2d57f049a5436cf12a3c36710bb34 **/ platform/linux-generic/odp_crypto.c | 14 ++++++++++---- .../validation/api/crypto/odp_crypto_test_inp.c | 18 ++++-------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 0ca3e110..156aab30 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -34,6 +34,9 @@ * * Keep sorted: first by key length, then by IV length */ +static const odp_crypto_cipher_capability_t cipher_capa_null[] = { +{.key_len = 0, .iv_len = 0} }; + static const odp_crypto_cipher_capability_t cipher_capa_des[] = { {.key_len = 24, .iv_len = 8} }; @@ -51,6 +54,9 @@ static const odp_crypto_cipher_capability_t cipher_capa_aes_gcm[] = { * * Keep sorted: first by digest length, then by key length */ +static const odp_crypto_auth_capability_t auth_capa_null[] = { +{.digest_len = 0, .key_len = 0, .aad_len = {.min = 0, .max = 0, .inc = 0} } }; + static const odp_crypto_auth_capability_t auth_capa_md5_hmac[] = { {.digest_len = 12, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} }, {.digest_len = 16, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} } }; @@ -562,8 +568,8 @@ int odp_crypto_cipher_capability(odp_cipher_alg_t cipher, switch (cipher) { case ODP_CIPHER_ALG_NULL: - src = NULL; - num = 0; + src = cipher_capa_null; + num = sizeof(cipher_capa_null) / size; break; case ODP_CIPHER_ALG_DES: src = cipher_capa_des; @@ -602,8 +608,8 @@ int odp_crypto_auth_capability(odp_auth_alg_t auth, switch (auth) { case ODP_AUTH_ALG_NULL: - src = NULL; - num = 0; + src = auth_capa_null; + num = sizeof(auth_capa_null) / size; break; case ODP_AUTH_ALG_MD5_HMAC: src = auth_capa_md5_hmac; diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c index 3f57a907..a7d8727b 100644 --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c @@ -141,13 +141,8 @@ static void alg_test(odp_crypto_op_t op, num = odp_crypto_cipher_capability(cipher_alg, cipher_capa, MAX_ALG_CAPA); - if (cipher_alg != ODP_CIPHER_ALG_NULL) { - CU_ASSERT(num > 0); - found = 0; - } else { - CU_ASSERT(num == 0); - found = 1; - } + CU_ASSERT(num > 0); + found = 0; CU_ASSERT(num <= MAX_ALG_CAPA); @@ -167,13 +162,8 @@ static void alg_test(odp_crypto_op_t op, num = odp_crypto_auth_capability(auth_alg, auth_capa, MAX_ALG_CAPA); - if (auth_alg != ODP_AUTH_ALG_NULL) { - CU_ASSERT(num > 0); - found = 0; - } else { - CU_ASSERT(num == 0); - found = 1; - } + CU_ASSERT(num > 0); + found = 0; CU_ASSERT(num <= MAX_ALG_CAPA);