From patchwork Mon Jan 15 00:03:35 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: 124458 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp505045lje; Sun, 14 Jan 2018 16:14:22 -0800 (PST) X-Google-Smtp-Source: ACJfBosSFTteeBrs3l5Y0C9yuikScrjvcmC7fXNIOq7s7yer7y2eO70ojdKr62CtYoclU0e+NH5R X-Received: by 10.200.19.202 with SMTP id i10mr48674344qtj.117.1515975262660; Sun, 14 Jan 2018 16:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975262; cv=none; d=google.com; s=arc-20160816; b=DGrhCrrtzPjpqPZHIckd5mD2ezZHJhTxgkLl9zKdKibTXLiHsFw98Y+sEvh6GsKuxg 9GEGFgOmcX8H/ANcE9WH4cijGlPymLVgBklQNA7fh3UcvWMc480OWYGGtHdhn1maVF8g /8T2+EUBOyjHg/k49siJSPTa943+jw2SfRmTmagpvxovkbh9cUW9CXsqNaM33JzZJQq8 zsHoeF6ock72wu2lPHEz0VEVZYUyQI/vmIV3S5h+o9Bh4DnKox2y8gO2kCKhwDs3qi3f QepP73FZ7NEo2Mvrrpu/u7MRSeFwNmoqtOUySN6hIOKGa/+AYM28sjiy1m7TCFWBP7JD oFmg== 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=kP7nG73XFE0y8ySGxT7hi5UtIbmyOOSCs/kX8naINDo=; b=yBKUSdanD2e+l6pr7VjAUC0aBsPDKf+Qnzw+lnxcZ58TN4giQHsIcTiyV40lKdqDKN 0/piZRkmV5CWLa0Kff91CDhksvtOFZ22zglxfml4uBM73Q8pWH6i4DTRQz1VJ4AjD5L2 5LlvupTNzssJi5EKeftTy+drr/f7fOiqVCNSSNntzIG+AXG2YOSKNi7HJ00J10rHp+y6 4C+3XEiblNEfT6Srv2oj8J0SaMQLBtPezZBPYrK+gnzXRgeveSk5S2aYpRWJtiUUSjsr 8K1YEmKRvTRxT/tOTeLZa5CjH6NaAVoKWY469hoEOj3d6iNsreUrDjrxLLfFdghUhRZu BzSA== 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 s16si1872979qtb.417.2018.01.14.16.14.22; Sun, 14 Jan 2018 16:14:22 -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 555056175E; Mon, 15 Jan 2018 00:14:22 +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 CEB9361763; Mon, 15 Jan 2018 00:05:40 +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 0F27661788; Mon, 15 Jan 2018 00:05:32 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 107E76176A for ; Mon, 15 Jan 2018 00:03:44 +0000 (UTC) Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 7D5DB34C2EFF for ; Mon, 15 Jan 2018 03:03:42 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id KQCrMW2ySH-3gZ42RBs; Mon, 15 Jan 2018 03:03:42 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3fKCmTbU; Mon, 15 Jan 2018 03:03:41 +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: Mon, 15 Jan 2018 03:03:35 +0300 Message-Id: <1515974621-25987-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 1/7] validation: crypto: stop declaring test functions as public 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 use to declare test functions as public, they are defined and used in the same file. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ test/validation/api/crypto/crypto.h | 30 ------------- test/validation/api/crypto/odp_crypto_test_inp.c | 56 ++++++++++++------------ 2 files changed, 28 insertions(+), 58 deletions(-) diff --git a/test/validation/api/crypto/crypto.h b/test/validation/api/crypto/crypto.h index 078a1909f..7c248d9eb 100644 --- a/test/validation/api/crypto/crypto.h +++ b/test/validation/api/crypto/crypto.h @@ -9,36 +9,6 @@ #include "odp_cunit_common.h" -/* test functions: */ -void crypto_test_enc_alg_null(void); -void crypto_test_dec_alg_null(void); -void crypto_test_enc_alg_3des_cbc(void); -void crypto_test_enc_alg_3des_cbc_ovr_iv(void); -void crypto_test_dec_alg_3des_cbc(void); -void crypto_test_dec_alg_3des_cbc_ovr_iv(void); -void crypto_test_enc_alg_aes_cbc(void); -void crypto_test_enc_alg_aes_cbc_ovr_iv(void); -void crypto_test_dec_alg_aes_cbc(void); -void crypto_test_dec_alg_aes_cbc_ovr_iv(void); -void crypto_test_enc_alg_aes_ctr(void); -void crypto_test_enc_alg_aes_ctr_ovr_iv(void); -void crypto_test_dec_alg_aes_ctr(void); -void crypto_test_dec_alg_aes_ctr_ovr_iv(void); -void crypto_test_enc_alg_aes_gcm(void); -void crypto_test_enc_alg_aes_gcm_ovr_iv(void); -void crypto_test_dec_alg_aes_gcm(void); -void crypto_test_dec_alg_aes_gcm_ovr_iv(void); -void crypto_test_gen_alg_hmac_md5(void); -void crypto_test_check_alg_hmac_md5(void); -void crypto_test_gen_alg_hmac_sha1(void); -void crypto_test_check_alg_hmac_sha1(void); -void crypto_test_gen_alg_hmac_sha256(void); -void crypto_test_check_alg_hmac_sha256(void); -void crypto_test_gen_alg_hmac_sha512(void); -void crypto_test_check_alg_hmac_sha512(void); -void crypto_test_gen_alg_aes_gmac(void); -void crypto_test_check_alg_aes_gmac(void); - /* test arrays: */ extern odp_testinfo_t crypto_suite[]; diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 821bdc7e4..c7076d300 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -631,7 +631,7 @@ static int check_alg_null(void) return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_NULL); } -void crypto_test_enc_alg_null(void) +static void crypto_test_enc_alg_null(void) { unsigned int test_vec_num = (sizeof(null_reference) / sizeof(null_reference[0])); @@ -645,7 +645,7 @@ void crypto_test_enc_alg_null(void) false); } -void crypto_test_dec_alg_null(void) +static void crypto_test_dec_alg_null(void) { unsigned int test_vec_num = (sizeof(null_reference) / sizeof(null_reference[0])); @@ -668,7 +668,7 @@ static int check_alg_3des_cbc(void) * operation for 3DES_CBC algorithm. IV for the operation is the session IV. * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer.*/ -void crypto_test_enc_alg_3des_cbc(void) +static void crypto_test_enc_alg_3des_cbc(void) { unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / sizeof(tdes_cbc_reference[0])); @@ -685,7 +685,7 @@ void crypto_test_enc_alg_3des_cbc(void) /* This test verifies the correctness of encode (plaintext -> ciphertext) * operation for 3DES_CBC algorithm. IV for the operation is the operation IV. * */ -void crypto_test_enc_alg_3des_cbc_ovr_iv(void) +static void crypto_test_enc_alg_3des_cbc_ovr_iv(void) { unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / sizeof(tdes_cbc_reference[0])); @@ -704,7 +704,7 @@ void crypto_test_enc_alg_3des_cbc_ovr_iv(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_3des_cbc(void) +static void crypto_test_dec_alg_3des_cbc(void) { unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / sizeof(tdes_cbc_reference[0])); @@ -723,7 +723,7 @@ void crypto_test_dec_alg_3des_cbc(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_3des_cbc_ovr_iv(void) +static void crypto_test_dec_alg_3des_cbc_ovr_iv(void) { unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / sizeof(tdes_cbc_reference[0])); @@ -746,7 +746,7 @@ static int check_alg_aes_gcm(void) * operation for AES128_GCM algorithm. IV for the operation is the session IV. * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer.*/ -void crypto_test_enc_alg_aes_gcm(void) +static void crypto_test_enc_alg_aes_gcm(void) { unsigned int test_vec_num = (sizeof(aes_gcm_reference) / sizeof(aes_gcm_reference[0])); @@ -765,7 +765,7 @@ void crypto_test_enc_alg_aes_gcm(void) * operation for AES128_GCM algorithm. IV for the operation is the session IV. * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer.*/ -void crypto_test_enc_alg_aes_gcm_ovr_iv(void) +static void crypto_test_enc_alg_aes_gcm_ovr_iv(void) { unsigned int test_vec_num = (sizeof(aes_gcm_reference) / sizeof(aes_gcm_reference[0])); @@ -785,7 +785,7 @@ void crypto_test_enc_alg_aes_gcm_ovr_iv(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes_gcm(void) +static void crypto_test_dec_alg_aes_gcm(void) { unsigned int test_vec_num = (sizeof(aes_gcm_reference) / sizeof(aes_gcm_reference[0])); @@ -805,7 +805,7 @@ void crypto_test_dec_alg_aes_gcm(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes_gcm_ovr_iv(void) +static void crypto_test_dec_alg_aes_gcm_ovr_iv(void) { unsigned int test_vec_num = (sizeof(aes_gcm_reference) / sizeof(aes_gcm_reference[0])); @@ -829,7 +829,7 @@ static int check_alg_aes_cbc(void) * operation for AES128_CBC algorithm. IV for the operation is the session IV. * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer.*/ -void crypto_test_enc_alg_aes_cbc(void) +static void crypto_test_enc_alg_aes_cbc(void) { unsigned int test_vec_num = (sizeof(aes_cbc_reference) / sizeof(aes_cbc_reference[0])); @@ -847,7 +847,7 @@ void crypto_test_enc_alg_aes_cbc(void) /* This test verifies the correctness of encode (plaintext -> ciphertext) * operation for AES128_CBC algorithm. IV for the operation is the operation IV. * */ -void crypto_test_enc_alg_aes_cbc_ovr_iv(void) +static void crypto_test_enc_alg_aes_cbc_ovr_iv(void) { unsigned int test_vec_num = (sizeof(aes_cbc_reference) / sizeof(aes_cbc_reference[0])); @@ -867,7 +867,7 @@ void crypto_test_enc_alg_aes_cbc_ovr_iv(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes_cbc(void) +static void crypto_test_dec_alg_aes_cbc(void) { unsigned int test_vec_num = (sizeof(aes_cbc_reference) / sizeof(aes_cbc_reference[0])); @@ -887,7 +887,7 @@ void crypto_test_dec_alg_aes_cbc(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes_cbc_ovr_iv(void) +static void crypto_test_dec_alg_aes_cbc_ovr_iv(void) { unsigned int test_vec_num = (sizeof(aes_cbc_reference) / sizeof(aes_cbc_reference[0])); @@ -911,7 +911,7 @@ static int check_alg_aes_ctr(void) * operation for AES128_CTR algorithm. IV for the operation is the session IV. * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer.*/ -void crypto_test_enc_alg_aes_ctr(void) +static void crypto_test_enc_alg_aes_ctr(void) { unsigned int test_vec_num = (sizeof(aes_ctr_reference) / sizeof(aes_ctr_reference[0])); @@ -929,7 +929,7 @@ void crypto_test_enc_alg_aes_ctr(void) /* This test verifies the correctness of encode (plaintext -> ciphertext) * operation for AES128_CTR algorithm. IV for the operation is the operation IV. * */ -void crypto_test_enc_alg_aes_ctr_ovr_iv(void) +static void crypto_test_enc_alg_aes_ctr_ovr_iv(void) { unsigned int test_vec_num = (sizeof(aes_ctr_reference) / sizeof(aes_ctr_reference[0])); @@ -949,7 +949,7 @@ void crypto_test_enc_alg_aes_ctr_ovr_iv(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes_ctr(void) +static void crypto_test_dec_alg_aes_ctr(void) { unsigned int test_vec_num = (sizeof(aes_ctr_reference) / sizeof(aes_ctr_reference[0])); @@ -969,7 +969,7 @@ void crypto_test_dec_alg_aes_ctr(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes_ctr_ovr_iv(void) +static void crypto_test_dec_alg_aes_ctr_ovr_iv(void) { unsigned int test_vec_num = (sizeof(aes_ctr_reference) / sizeof(aes_ctr_reference[0])); @@ -996,7 +996,7 @@ static int check_alg_hmac_md5(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_gen_alg_hmac_md5(void) +static void crypto_test_gen_alg_hmac_md5(void) { unsigned int test_vec_num = (sizeof(hmac_md5_reference) / sizeof(hmac_md5_reference[0])); @@ -1010,7 +1010,7 @@ void crypto_test_gen_alg_hmac_md5(void) false); } -void crypto_test_check_alg_hmac_md5(void) +static void crypto_test_check_alg_hmac_md5(void) { unsigned int test_vec_num = (sizeof(hmac_md5_reference) / sizeof(hmac_md5_reference[0])); @@ -1036,7 +1036,7 @@ static int check_alg_hmac_sha1(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_gen_alg_hmac_sha1(void) +static void crypto_test_gen_alg_hmac_sha1(void) { unsigned int test_vec_num = (sizeof(hmac_sha1_reference) / sizeof(hmac_sha1_reference[0])); @@ -1050,7 +1050,7 @@ void crypto_test_gen_alg_hmac_sha1(void) false); } -void crypto_test_check_alg_hmac_sha1(void) +static void crypto_test_check_alg_hmac_sha1(void) { unsigned int test_vec_num = (sizeof(hmac_sha1_reference) / sizeof(hmac_sha1_reference[0])); @@ -1076,7 +1076,7 @@ static int check_alg_hmac_sha256(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_gen_alg_hmac_sha256(void) +static void crypto_test_gen_alg_hmac_sha256(void) { unsigned int test_vec_num = (sizeof(hmac_sha256_reference) / sizeof(hmac_sha256_reference[0])); @@ -1090,7 +1090,7 @@ void crypto_test_gen_alg_hmac_sha256(void) false); } -void crypto_test_check_alg_hmac_sha256(void) +static void crypto_test_check_alg_hmac_sha256(void) { unsigned int test_vec_num = (sizeof(hmac_sha256_reference) / sizeof(hmac_sha256_reference[0])); @@ -1116,7 +1116,7 @@ static int check_alg_hmac_sha512(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_gen_alg_hmac_sha512(void) +static void crypto_test_gen_alg_hmac_sha512(void) { unsigned int test_vec_num = (sizeof(hmac_sha512_reference) / sizeof(hmac_sha512_reference[0])); @@ -1130,7 +1130,7 @@ void crypto_test_gen_alg_hmac_sha512(void) false); } -void crypto_test_check_alg_hmac_sha512(void) +static void crypto_test_check_alg_hmac_sha512(void) { unsigned int test_vec_num = (sizeof(hmac_sha512_reference) / sizeof(hmac_sha512_reference[0])); @@ -1149,7 +1149,7 @@ static int check_alg_aes_gmac(void) return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_GMAC); } -void crypto_test_gen_alg_aes_gmac(void) +static void crypto_test_gen_alg_aes_gmac(void) { unsigned int test_vec_num = (sizeof(aes_gmac_reference) / sizeof(aes_gmac_reference[0])); @@ -1163,7 +1163,7 @@ void crypto_test_gen_alg_aes_gmac(void) false); } -void crypto_test_check_alg_aes_gmac(void) +static void crypto_test_check_alg_aes_gmac(void) { unsigned int test_vec_num = (sizeof(aes_gmac_reference) / sizeof(aes_gmac_reference[0])); From patchwork Mon Jan 15 00:03:36 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: 124464 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp506102lje; Sun, 14 Jan 2018 16:20:27 -0800 (PST) X-Google-Smtp-Source: ACJfBovjk3udoDhVtPMUXwKdtiHoanSDiNgRfuGXDO4/z9pY6pqdiyzuP+iKgZGCUnez2KhQXu/0 X-Received: by 10.200.19.196 with SMTP id i4mr7034395qtj.153.1515975627558; Sun, 14 Jan 2018 16:20:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975627; cv=none; d=google.com; s=arc-20160816; b=DaCyEbTR6w1iiBTdGg3+7UHbi6EukRhyr0a9QjTqLDuJ1Op+uxMDl2TcFkm0hWcAfX zAIowRBhnmhyKpWulw/7YeDcADmZGiJAYAokNAgr8Xms4zKxBc5i/5dAY2+sLdFE9BCa LOHm1q9XhJZK0FkTohXbHtqnLg9suuFMCXivClKex1RYlXSq9JtVBPEuIZn/pI9mauo/ CXgqc+0PBZzMm2x0sQ8PapnD5rU1S9ypjrg9FbZretudZR8fMU9/OK4ceD+sfpJhG2C9 MmbuVdnEp/tg5C5XFFJLzlYgTVQON03tVVM3LKZmc/rYTFa0KQA6kO6dio7NNycIxp/P e0mA== 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=OQeWuZYlhRWhnD5DqWBiBq83UVMsyzgUg2bx2cwW8AA=; b=drFoKDnUb6OER/GiGXcpujrVptzsLwllHiKkWXsew/J7pHu1n8k+XtMEZ2S2pkSYRI eG82jexuaB/y+uZmGxirEo+QnqCPnNTRUdru4XQa9vttB5qe/MOI809UL0wHN9k22vHN KCi7r52fcK6xO69cd7FXLcX4wKJZzIa0WM/W9Uj7rkCHFgM0xLChXyYIjW+hD4dt/V6v azoBknWcdyJmY1UXQf75S6vimiuHCRHy/03GdIt4UqRDqVGZEF/hFBDBi4wx7N1lHLyY Nhis5MX+C8huDCY4kD3CnpdfVlH1OSMTuzcz8e7NSnKx0LFyiJ5SL/FdIofLZtK8oylo syQg== 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 m68si5444373qkl.433.2018.01.14.16.20.27; Sun, 14 Jan 2018 16:20:27 -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 3560A6176D; Mon, 15 Jan 2018 00:20:27 +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 52E606179A; Mon, 15 Jan 2018 00:06:18 +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 D87C461787; Mon, 15 Jan 2018 00:05:59 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id E1073616F3 for ; Mon, 15 Jan 2018 00:03:51 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 166BA4300D68 for ; Mon, 15 Jan 2018 03:03:43 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6P2NyHKiob-3gmW2IYJ; Mon, 15 Jan 2018 03:03:43 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3gK0j55b; Mon, 15 Jan 2018 03:03:42 +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: Mon, 15 Jan 2018 03:03:36 +0300 Message-Id: <1515974621-25987-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 2/7] linux-gen: crypto: move session type to odp_crypto module 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 odp_crypto_generic_session_t definition in global include file. Move it to odp_crypto module. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ platform/linux-generic/Makefile.am | 1 - .../linux-generic/include/odp_crypto_internal.h | 73 ---------------------- platform/linux-generic/odp_crypto.c | 46 +++++++++++++- 3 files changed, 44 insertions(+), 76 deletions(-) delete mode 100644 platform/linux-generic/include/odp_crypto_internal.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 9f7993d81..12d8131e8 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -140,7 +140,6 @@ noinst_HEADERS = \ include/odp_classification_inlines.h \ include/odp_classification_internal.h \ include/odp_config_internal.h \ - include/odp_crypto_internal.h \ include/odp_debug_internal.h \ include/odp_errno_define.h \ include/odp_forward_typedefs_internal.h \ diff --git a/platform/linux-generic/include/odp_crypto_internal.h b/platform/linux-generic/include/odp_crypto_internal.h deleted file mode 100644 index 32178d9de..000000000 --- a/platform/linux-generic/include/odp_crypto_internal.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_CRYPTO_INTERNAL_H_ -#define ODP_CRYPTO_INTERNAL_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define MAX_IV_LEN 64 -#define OP_RESULT_MAGIC 0x91919191 - -/** Forward declaration of session structure */ -typedef struct odp_crypto_generic_session odp_crypto_generic_session_t; - -/** - * Algorithm handler function prototype - */ -typedef -odp_crypto_alg_err_t (*crypto_func_t)(odp_packet_t pkt, - const odp_crypto_packet_op_param_t *param, - odp_crypto_generic_session_t *session); - -/** - * Per crypto session data structure - */ -struct odp_crypto_generic_session { - struct odp_crypto_generic_session *next; - - /* Session creation parameters */ - odp_crypto_session_param_t p; - - odp_bool_t do_cipher_first; - - struct { - /* Copy of session IV data */ - uint8_t iv_data[MAX_IV_LEN]; - uint8_t key_data[EVP_MAX_KEY_LENGTH]; - - const EVP_CIPHER *evp_cipher; - crypto_func_t func; - } cipher; - - struct { - uint8_t key[EVP_MAX_KEY_LENGTH]; - uint32_t key_length; - union { - const EVP_MD *evp_md; - const EVP_CIPHER *evp_cipher; - }; - crypto_func_t func; - } auth; -}; - -/** - * Per session creation operation result - */ -typedef struct odp_crypto_generic_session_result { - odp_crypto_ses_create_err_t rc; - odp_crypto_session_t session; -} odp_crypto_generic_session_result_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 2038aa46b..3b110c191 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -89,6 +88,49 @@ static const odp_crypto_auth_capability_t auth_capa_aes_gcm[] = { static const odp_crypto_auth_capability_t auth_capa_aes_gmac[] = { {.digest_len = 16, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} } }; +/** Forward declaration of session structure */ +typedef struct odp_crypto_generic_session_t odp_crypto_generic_session_t; + +/** + * Algorithm handler function prototype + */ +typedef +odp_crypto_alg_err_t (*crypto_func_t)(odp_packet_t pkt, + const odp_crypto_packet_op_param_t *param, + odp_crypto_generic_session_t *session); + +/** + * Per crypto session data structure + */ +struct odp_crypto_generic_session_t { + odp_crypto_generic_session_t *next; + + /* Session creation parameters */ + odp_crypto_session_param_t p; + + odp_bool_t do_cipher_first; + + struct { + /* Copy of session IV data */ + uint8_t iv_data[EVP_MAX_IV_LENGTH]; + uint8_t key_data[EVP_MAX_KEY_LENGTH]; + + const EVP_CIPHER *evp_cipher; + crypto_func_t func; + } cipher; + + struct { + uint8_t key[EVP_MAX_KEY_LENGTH]; + uint32_t key_length; + uint32_t bytes; + union { + const EVP_MD *evp_md; + const EVP_CIPHER *evp_cipher; + }; + crypto_func_t func; + } auth; +}; + typedef struct odp_crypto_global_s odp_crypto_global_t; struct odp_crypto_global_s { @@ -860,7 +902,7 @@ odp_crypto_session_create(odp_crypto_session_param_t *param, /* Copy parameters */ session->p = *param; - if (session->p.iv.length > MAX_IV_LEN) { + if (session->p.iv.length > EVP_MAX_IV_LENGTH) { ODP_DBG("Maximum IV length exceeded\n"); *status = ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER; goto err; From patchwork Mon Jan 15 00:03:37 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: 124459 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp505345lje; Sun, 14 Jan 2018 16:16:05 -0800 (PST) X-Google-Smtp-Source: ACJfBotU5JjhsCsmo8ynM567RPK9DrwMkntixEVBOQS8rv9Ok3TNHxFEr7m3SnzC4jO3xYS1AJsf X-Received: by 10.55.166.69 with SMTP id p66mr26483094qke.1.1515975365324; Sun, 14 Jan 2018 16:16:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975365; cv=none; d=google.com; s=arc-20160816; b=P8PIl8VeeVXW/WQ92SJWRf60uczdphkP/MJrsFsHlSwVXZvmyeGeY1/x4IKhvy9lIx 2ZNxI/T0OrRYysaxEiZ8Mk5BA42547oqRoi0lv2mw04j779SiFO+eR8hW4YIdou1rdbR iVAtRN2bR+CqntmTmSxQSsc3j3j9la9IbveHvHwjY2PC80yNgHX9kfydNyH/MdYxuO77 ahXqDV5rRVX2dkpKdBppvLt7U05VPcHH0Q65TDXw6Sh0onzw7YUIR06P5mWAX2+rl/fB BBM3sVcfmbBbDZ2orcxcOfv6+zszGOFYgalmfVOoA0fmlIVxn1saDbeF6HTIuz7657Ub lQ3w== 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=03VG/GXdVN0uPYbPutYIdtEiZwOPrYw65aqhbpKivbw=; b=yhx7gh9k6sJtgyXeRKbrJhlRytlxzWKg+Jddpe11SMlb9hPtDLC9V0ryvlDuUPoYa3 xXxOgFzIo9QnwdDisnDYJpxb/qGeNn/rTEynSMw+f3X1NZChVCg0g/USpq/FDufnHSi4 kkx6ispMNHjQILFqlcwpf/NJX/+aCHu90SOm8yCfEQd/alcToqDHbeH3GUMThODxA60h K6YCUu10WlEM2ob8dFopSvsIVNGK/5rBtogYfwrUSM/9ugPOhihwjT8UZs/ElTsjxz1S bLApwJlc82sV7ae8S81VboTbzPt0K0fMQ30+ED6zeHFvykAyydkmaa0oSAyAVcHfhSq4 rXQA== 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 144si5490884qkf.65.2018.01.14.16.16.05; Sun, 14 Jan 2018 16:16:05 -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 E86926175E; Mon, 15 Jan 2018 00:16:04 +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 53AC16176C; Mon, 15 Jan 2018 00:05:53 +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 6637A6176A; Mon, 15 Jan 2018 00:05:40 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 62C8261753 for ; Mon, 15 Jan 2018 00:03:45 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 68A3F5102DA0 for ; Mon, 15 Jan 2018 03:03:44 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9BRVnzHpHh-3ivCOKCD; Mon, 15 Jan 2018 03:03:44 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3hKOHggK; Mon, 15 Jan 2018 03:03:43 +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: Mon, 15 Jan 2018 03:03:37 +0300 Message-Id: <1515974621-25987-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 3/7] api: crypto: use cipher_iv instead of iv in session params 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 In preparation to add auth-specific IV, rename iv field to ciper_iv. Provide deprecated compatibility field iv. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ example/ipsec/odp_ipsec_cache.c | 14 +-- include/odp/api/spec/crypto.h | 8 +- platform/linux-generic/odp_crypto.c | 33 +++---- platform/linux-generic/odp_ipsec_sad.c | 6 +- test/performance/odp_crypto.c | 4 +- test/validation/api/crypto/odp_crypto_test_inp.c | 18 ++-- test/validation/api/crypto/test_vectors.h | 108 +++++++++++------------ 7 files changed, 99 insertions(+), 92 deletions(-) diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index bd4c1eabc..220df7825 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -92,13 +92,13 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, params.cipher_alg = cipher_sa->alg.u.cipher; params.cipher_key.data = cipher_sa->key.data; params.cipher_key.length = cipher_sa->key.length; - params.iv.data = entry->state.iv; - params.iv.length = cipher_sa->iv_len; + params.cipher_iv.data = entry->state.iv; + params.cipher_iv.length = cipher_sa->iv_len; mode = cipher_sa->mode; } else { params.cipher_alg = ODP_CIPHER_ALG_NULL; - params.iv.data = NULL; - params.iv.length = 0; + params.cipher_iv.data = NULL; + params.cipher_iv.length = 0; } /* Auth */ @@ -113,10 +113,10 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, } /* Generate an IV */ - if (params.iv.length) { - int32_t size = params.iv.length; + if (params.cipher_iv.length) { + int32_t size = params.cipher_iv.length; - int32_t ret = odp_random_data(params.iv.data, size, 1); + int32_t ret = odp_random_data(params.cipher_iv.data, size, 1); if (ret != size) return -1; } diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 81fecbc36..25ce2f86c 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -313,7 +313,13 @@ typedef struct odp_crypto_session_param_t { odp_crypto_key_t cipher_key; /** Cipher Initialization Vector (IV) */ - odp_crypto_iv_t iv; + union { + /** @deprecated Use cipher_iv */ + odp_crypto_iv_t ODP_DEPRECATE(iv); + + /** Cipher Initialization Vector (IV) */ + odp_crypto_iv_t cipher_iv; + }; /** Authentication algorithm * diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 3b110c191..eab82e9fa 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -436,7 +436,7 @@ odp_crypto_alg_err_t cipher_encrypt(odp_packet_t pkt, if (param->override_iv_ptr) iv_ptr = param->override_iv_ptr; - else if (session->p.iv.data) + else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -467,7 +467,7 @@ odp_crypto_alg_err_t cipher_decrypt(odp_packet_t pkt, if (param->override_iv_ptr) iv_ptr = param->override_iv_ptr; - else if (session->p.iv.data) + else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -496,8 +496,9 @@ static int process_cipher_param(odp_crypto_generic_session_t *session, return -1; /* Verify IV len is correct */ - if (!((0 == session->p.iv.length) || - ((uint32_t)EVP_CIPHER_iv_length(cipher) == session->p.iv.length))) + if (!((0 == session->p.cipher_iv.length) || + ((uint32_t)EVP_CIPHER_iv_length(cipher) == + session->p.cipher_iv.length))) return -1; session->cipher.evp_cipher = cipher; @@ -529,7 +530,7 @@ odp_crypto_alg_err_t aes_gcm_encrypt(odp_packet_t pkt, if (param->override_iv_ptr) iv_ptr = param->override_iv_ptr; - else if (session->p.iv.data) + else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -539,7 +540,7 @@ odp_crypto_alg_err_t aes_gcm_encrypt(odp_packet_t pkt, EVP_EncryptInit_ex(ctx, session->cipher.evp_cipher, NULL, session->cipher.key_data, NULL); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, - session->p.iv.length, NULL); + session->p.cipher_iv.length, NULL); EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); EVP_CIPHER_CTX_set_padding(ctx, 0); @@ -576,7 +577,7 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_packet_t pkt, if (param->override_iv_ptr) iv_ptr = param->override_iv_ptr; - else if (session->p.iv.data) + else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -586,7 +587,7 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_packet_t pkt, EVP_DecryptInit_ex(ctx, session->cipher.evp_cipher, NULL, session->cipher.key_data, NULL); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, - session->p.iv.length, NULL); + session->p.cipher_iv.length, NULL); EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); EVP_CIPHER_CTX_set_padding(ctx, 0); @@ -642,7 +643,7 @@ odp_crypto_alg_err_t aes_gmac_gen(odp_packet_t pkt, if (param->override_iv_ptr) iv_ptr = param->override_iv_ptr; - else if (session->p.iv.data) + else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -652,7 +653,7 @@ odp_crypto_alg_err_t aes_gmac_gen(odp_packet_t pkt, EVP_EncryptInit_ex(ctx, session->auth.evp_cipher, NULL, session->auth.key, NULL); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, - session->p.iv.length, NULL); + session->p.cipher_iv.length, NULL); EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); EVP_CIPHER_CTX_set_padding(ctx, 0); @@ -681,7 +682,7 @@ odp_crypto_alg_err_t aes_gmac_check(odp_packet_t pkt, if (param->override_iv_ptr) iv_ptr = param->override_iv_ptr; - else if (session->p.iv.data) + else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -691,7 +692,7 @@ odp_crypto_alg_err_t aes_gmac_check(odp_packet_t pkt, EVP_DecryptInit_ex(ctx, session->auth.evp_cipher, NULL, session->auth.key, NULL); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, - session->p.iv.length, NULL); + session->p.cipher_iv.length, NULL); EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); EVP_CIPHER_CTX_set_padding(ctx, 0); @@ -902,16 +903,16 @@ odp_crypto_session_create(odp_crypto_session_param_t *param, /* Copy parameters */ session->p = *param; - if (session->p.iv.length > EVP_MAX_IV_LENGTH) { + if (session->p.cipher_iv.length > EVP_MAX_IV_LENGTH) { ODP_DBG("Maximum IV length exceeded\n"); *status = ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER; goto err; } /* Copy IV data */ - if (session->p.iv.data) - memcpy(session->cipher.iv_data, session->p.iv.data, - session->p.iv.length); + if (session->p.cipher_iv.data) + memcpy(session->cipher.iv_data, session->p.cipher_iv.data, + session->p.cipher_iv.length); /* Derive order */ if (ODP_CRYPTO_OP_ENCODE == param->op) diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 845a73dea..11227a5fc 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -351,13 +351,13 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) crypto_param.auth_alg = param->crypto.auth_alg; crypto_param.auth_key = param->crypto.auth_key; - crypto_param.iv.length = + crypto_param.cipher_iv.length = _odp_ipsec_cipher_iv_len(crypto_param.cipher_alg); crypto_param.auth_digest_len = _odp_ipsec_auth_digest_len(crypto_param.auth_alg); - if ((uint32_t)-1 == crypto_param.iv.length || + if ((uint32_t)-1 == crypto_param.cipher_iv.length || (uint32_t)-1 == crypto_param.auth_digest_len) goto error; @@ -409,7 +409,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) ipsec_sa->use_counter_iv = 1; ipsec_sa->esp_iv_len = 8; ipsec_sa->esp_block_len = 16; - crypto_param.iv.length = 12; + crypto_param.cipher_iv.length = 12; break; default: break; diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c index 0cbc2754e..21d916887 100644 --- a/test/performance/odp_crypto.c +++ b/test/performance/odp_crypto.c @@ -187,7 +187,7 @@ static crypto_alg_config_t algs_config[] = { .data = test_key24, .length = sizeof(test_key24) }, - .iv = { + .cipher_iv = { .data = test_iv, .length = 8, }, @@ -202,7 +202,7 @@ static crypto_alg_config_t algs_config[] = { .data = test_key24, .length = sizeof(test_key24) }, - .iv = { + .cipher_iv = { .data = test_iv, .length = 8, }, diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index c7076d300..d795baafc 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -317,9 +317,9 @@ static void alg_test(odp_crypto_op_t op, .data = ref->auth_key, .length = ref->auth_key_length }; - odp_crypto_iv_t iv = { - .data = ovr_iv ? NULL : ref->iv, - .length = ref->iv_length + odp_crypto_iv_t cipher_iv = { + .data = ovr_iv ? NULL : ref->cipher_iv, + .length = ref->cipher_iv_length }; int num, i; int found; @@ -388,7 +388,7 @@ static void alg_test(odp_crypto_op_t op, /* Search for the test case */ for (i = 0; i < num; i++) { if (cipher_capa[i].key_len == cipher_key.length && - cipher_capa[i].iv_len == iv.length) { + cipher_capa[i].iv_len == cipher_iv.length) { found = 1; break; } @@ -397,7 +397,7 @@ static void alg_test(odp_crypto_op_t op, if (!found) { printf("\n Unsupported: alg=%s, key_len=%" PRIu32 ", " "iv_len=%" PRIu32 "\n", cipher_alg_name(cipher_alg), - cipher_key.length, iv.length); + cipher_key.length, cipher_iv.length); return; } @@ -438,7 +438,7 @@ static void alg_test(odp_crypto_op_t op, ses_params.compl_queue = suite_context.queue; ses_params.output_pool = suite_context.pool; ses_params.cipher_key = cipher_key; - ses_params.iv = iv; + ses_params.cipher_iv = cipher_iv; ses_params.auth_key = auth_key; ses_params.auth_digest_len = ref->digest_length; ses_params.auth_aad_len = ref->aad_length; @@ -488,17 +488,17 @@ static void alg_test(odp_crypto_op_t op, if (!suite_context.packet) rc = alg_op(pkt, &ok, session, - ovr_iv ? ref->iv : NULL, + ovr_iv ? ref->cipher_iv : NULL, &cipher_range, &auth_range, ref->aad, ref->length); else if (ODP_CRYPTO_ASYNC == suite_context.op_mode) rc = alg_packet_op_enq(pkt, &ok, session, - ovr_iv ? ref->iv : NULL, + ovr_iv ? ref->cipher_iv : NULL, &cipher_range, &auth_range, ref->aad, ref->length); else rc = alg_packet_op(pkt, &ok, session, - ovr_iv ? ref->iv : NULL, + ovr_iv ? ref->cipher_iv : NULL, &cipher_range, &auth_range, ref->aad, ref->length); if (rc < 0) diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h index f2ce9eb2f..6673ba4b6 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/test/validation/api/crypto/test_vectors.h @@ -14,8 +14,8 @@ typedef struct crypto_test_reference_s { uint8_t cipher_key[MAX_KEY_LEN]; uint32_t auth_key_length; uint8_t auth_key[MAX_KEY_LEN]; - uint32_t iv_length; - uint8_t iv[MAX_IV_LEN]; + uint32_t cipher_iv_length; + uint8_t cipher_iv[MAX_IV_LEN]; uint32_t length; uint8_t plaintext[MAX_DATA_LEN]; uint8_t ciphertext[MAX_DATA_LEN]; @@ -49,8 +49,8 @@ static crypto_test_reference_t tdes_cbc_reference[] = { .cipher_key = { 0x62, 0x7f, 0x46, 0x0e, 0x08, 0x10, 0x4a, 0x10, 0x43, 0xcd, 0x26, 0x5d, 0x58, 0x40, 0xea, 0xf1, 0x31, 0x3e, 0xdf, 0x97, 0xdf, 0x2a, 0x8a, 0x8c}, - .iv_length = TDES_CBC_IV_LEN, - .iv = { 0x8e, 0x29, 0xf7, 0x5e, 0xa7, 0x7e, 0x54, 0x75 }, + .cipher_iv_length = TDES_CBC_IV_LEN, + .cipher_iv = { 0x8e, 0x29, 0xf7, 0x5e, 0xa7, 0x7e, 0x54, 0x75 }, .length = 8, .plaintext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 }, .ciphertext = { 0xb2, 0x2b, 0x8d, 0x66, 0xde, 0x97, 0x06, 0x92 } @@ -60,8 +60,8 @@ static crypto_test_reference_t tdes_cbc_reference[] = { .cipher_key = { 0x37, 0xae, 0x5e, 0xbf, 0x46, 0xdf, 0xf2, 0xdc, 0x07, 0x54, 0xb9, 0x4f, 0x31, 0xcb, 0xb3, 0x85, 0x5e, 0x7f, 0xd3, 0x6d, 0xc8, 0x70, 0xbf, 0xae}, - .iv_length = TDES_CBC_IV_LEN, - .iv = {0x3d, 0x1d, 0xe3, 0xcc, 0x13, 0x2e, 0x3b, 0x65 }, + .cipher_iv_length = TDES_CBC_IV_LEN, + .cipher_iv = {0x3d, 0x1d, 0xe3, 0xcc, 0x13, 0x2e, 0x3b, 0x65 }, .length = 16, .plaintext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87, 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 }, @@ -75,9 +75,9 @@ static crypto_test_reference_t aes_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b, 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06}, - .iv_length = AES_CBC_IV_LEN, - .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, - 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, + .cipher_iv_length = AES_CBC_IV_LEN, + .cipher_iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, + 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, .length = 16, .plaintext = "Single block msg", .ciphertext = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8, @@ -87,9 +87,9 @@ static crypto_test_reference_t aes_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a}, - .iv_length = AES_CBC_IV_LEN, - .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, - 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, + .cipher_iv_length = AES_CBC_IV_LEN, + .cipher_iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, + 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, .length = 32, .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -104,9 +104,9 @@ static crypto_test_reference_t aes_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0x6c, 0x3e, 0xa0, 0x47, 0x76, 0x30, 0xce, 0x21, 0xa2, 0xce, 0x33, 0x4a, 0xa7, 0x46, 0xc2, 0xcd}, - .iv_length = AES_CBC_IV_LEN, - .iv = { 0xc7, 0x82, 0xdc, 0x4c, 0x09, 0x8c, 0x66, 0xcb, - 0xd9, 0xcd, 0x27, 0xd8, 0x25, 0x68, 0x2c, 0x81 }, + .cipher_iv_length = AES_CBC_IV_LEN, + .cipher_iv = { 0xc7, 0x82, 0xdc, 0x4c, 0x09, 0x8c, 0x66, 0xcb, + 0xd9, 0xcd, 0x27, 0xd8, 0x25, 0x68, 0x2c, 0x81 }, .length = 48, .plaintext = "This is a 48-byte message (exactly 3 AES blocks)", .ciphertext = { 0xd0, 0xa0, 0x2b, 0x38, 0x36, 0x45, 0x17, 0x53, @@ -120,9 +120,9 @@ static crypto_test_reference_t aes_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0x56, 0xe4, 0x7a, 0x38, 0xc5, 0x59, 0x89, 0x74, 0xbc, 0x46, 0x90, 0x3d, 0xba, 0x29, 0x03, 0x49}, - .iv_length = AES_CBC_IV_LEN, - .iv = { 0x8c, 0xe8, 0x2e, 0xef, 0xbe, 0xa0, 0xda, 0x3c, - 0x44, 0x69, 0x9e, 0xd7, 0xdb, 0x51, 0xb7, 0xd9 }, + .cipher_iv_length = AES_CBC_IV_LEN, + .cipher_iv = { 0x8c, 0xe8, 0x2e, 0xef, 0xbe, 0xa0, 0xda, 0x3c, + 0x44, 0x69, 0x9e, 0xd7, 0xdb, 0x51, 0xb7, 0xd9 }, .length = 64, .plaintext = { 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, @@ -146,9 +146,9 @@ static crypto_test_reference_t aes_cbc_reference[] = { .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c}, - .iv_length = AES_CBC_IV_LEN, - .iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88, 0x01, 0x23, 0x45, 0x67 }, + .cipher_iv_length = AES_CBC_IV_LEN, + .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88, 0x01, 0x23, 0x45, 0x67 }, .length = 32, .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00, 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f, @@ -165,9 +165,9 @@ static crypto_test_reference_t aes_cbc_reference[] = { 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab}, - .iv_length = AES_CBC_IV_LEN, - .iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c }, + .cipher_iv_length = AES_CBC_IV_LEN, + .cipher_iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, + 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c }, .length = 48, .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00, 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02, @@ -189,9 +189,9 @@ static crypto_test_reference_t aes_ctr_reference[] = { .cipher_key_length = AES128_CTR_KEY_LEN, .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, - .iv_length = AES_CTR_IV_LEN, - .iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, + .cipher_iv_length = AES_CTR_IV_LEN, + .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, .length = 64, .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, @@ -215,9 +215,9 @@ static crypto_test_reference_t aes_ctr_reference[] = { .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}, - .iv_length = AES_CTR_IV_LEN, - .iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, + .cipher_iv_length = AES_CTR_IV_LEN, + .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, .length = 64, .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, @@ -242,9 +242,9 @@ static crypto_test_reference_t aes_ctr_reference[] = { 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}, - .iv_length = AES_CTR_IV_LEN, - .iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, + .cipher_iv_length = AES_CTR_IV_LEN, + .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, .length = 64, .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, @@ -273,9 +273,9 @@ static crypto_test_reference_t aes_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda, 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0x2e, 0x44, 0x3b, 0x68, 0x49, 0x56, 0xed, 0x7e, - 0x3b, 0x24, 0x4c, 0xfe }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0x2e, 0x44, 0x3b, 0x68, 0x49, 0x56, 0xed, 0x7e, + 0x3b, 0x24, 0x4c, 0xfe }, .length = 72, .plaintext = { 0x45, 0x00, 0x00, 0x48, 0x69, 0x9a, 0x00, 0x00, 0x80, 0x11, 0x4d, 0xb7, 0xc0, 0xa8, 0x01, 0x02, @@ -306,9 +306,9 @@ static crypto_test_reference_t aes_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88 }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 }, .length = 64, .plaintext = { 0x45, 0x00, 0x00, 0x3e, 0x69, 0x8f, 0x00, 0x00, 0x80, 0x11, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02, @@ -336,9 +336,9 @@ static crypto_test_reference_t aes_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }, .length = 64, .plaintext = { 0x45, 0x00, 0x00, 0x3c, 0x99, 0xc5, 0x00, 0x00, 0x80, 0x01, 0xcb, 0x7a, 0x40, 0x67, 0x93, 0x18, @@ -366,9 +366,9 @@ static crypto_test_reference_t aes_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60, 0x7e, 0xae, 0x1f}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00, - 0xa2, 0xfc, 0xa1, 0xa3 }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00, + 0xa2, 0xfc, 0xa1, 0xa3 }, .length = 28, .plaintext = { 0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00, 0x80, 0x01, 0x44, 0x1f, 0x40, 0x67, 0x93, 0xb6, @@ -390,9 +390,9 @@ static crypto_test_reference_t aes_gcm_reference[] = { .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88 }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 }, .length = 40, .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00, 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f, @@ -416,9 +416,9 @@ static crypto_test_reference_t aes_gcm_reference[] = { 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08 }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, + 0x05, 0x06, 0x07, 0x08 }, .length = 52, .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00, 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02, @@ -447,9 +447,9 @@ static crypto_test_reference_t aes_gmac_reference[] = { .auth_key_length = AES128_GCM_KEY_LEN, .auth_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda, 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34}, - .iv_length = AES_GCM_IV_LEN, - .iv = { 0x22, 0x43, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }, + .cipher_iv_length = AES_GCM_IV_LEN, + .cipher_iv = { 0x22, 0x43, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }, .length = 68, .plaintext = { 0x00, 0x00, 0x43, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From patchwork Mon Jan 15 00:03:38 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: 124460 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp505363lje; Sun, 14 Jan 2018 16:16:11 -0800 (PST) X-Google-Smtp-Source: ACJfBov3mP03S8jiCRYyiMUj+Pst9T8o1JYO6Eg0+HKwCOwQMaojh4/3HUsVE96eMCoUrZYQAsXR X-Received: by 10.200.39.244 with SMTP id x49mr46770822qtx.169.1515975371665; Sun, 14 Jan 2018 16:16:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975371; cv=none; d=google.com; s=arc-20160816; b=wN8jgoIlB/tYNJbs+ScI6mckXC6AmVkWJSrFfTVKyMYUYA6u1wrkEOinBnPTk8XsT1 4QIti/WtfzmXZdlIxM6UnYIIy1lVk0jVXmNaccER0hUqQNz5P2rT7DEOERtsuCWXjDvk wTKeCGg0nUCSaBP30sItopJ/qtTI9sLW4y7mmbAmzvhO1A/lgilP98X1BtMabjCllyiy 41z795ubqWLpD2D0XFK6kf+MuOAuNReLcg5SzvEGcatvpWgaFWgoeEP5pAN++bVcJu9B PAU0lXetUAfCtbCwm2iN6lxMpxDoPtH/Kyy9Q2pGZnWwlE2Pm/OKFfl62ZM46k9JtGZe 6Ljw== 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=J1aC1feGBlxjCQui7UdPDWcK211Myn4LCovdKu8ds8w=; b=ezjH2ncBm1VERyZ+z4BbE46r+8AJ+/syEh0TARatMs7WNW4E2X0BIZexFceAI9KQ1F r1y2V+y0xJxrOdrlOLouw6Qim1gtudMAy+NaNGEzNvokz9siKnf/VUX/CmDHs+vZkEnO NfuAduoCIwgrZNO7dO+yTlCUytjWfHiLkXJwclAOzFlRESbhvP4NheTIImcf3b1awMX0 PD8rn58vH4P+AMnZIjEPmnvlp4XNeVi89dIJDW7TSFsc8oMcUzBNLVrt5rYBv12xIviz O++PI5Yostg+br1UoINqlz0q3ZN8hPFQHWXnBJbC9nCtkowQhE8JVjzz9T2HrLY4liCz pW9A== 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 c27si617157qte.160.2018.01.14.16.16.11; Sun, 14 Jan 2018 16:16:11 -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 5B53D6175E; Mon, 15 Jan 2018 00:16:11 +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 97ADC61787; Mon, 15 Jan 2018 00:06:00 +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 2648E61789; Mon, 15 Jan 2018 00:05:43 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 2CE4561765 for ; Mon, 15 Jan 2018 00:03:46 +0000 (UTC) Received: from mxback4o.mail.yandex.net (mxback4o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1e]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 1FA67182EFB for ; Mon, 15 Jan 2018 03:03:45 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback4o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dlESLjhpuP-3iICuPTM; Mon, 15 Jan 2018 03:03:45 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3iKaSwhg; Mon, 15 Jan 2018 03:03:44 +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: Mon, 15 Jan 2018 03:03:38 +0300 Message-Id: <1515974621-25987-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 4/7] api: crypto: use cipher_iv_ptr instead of override_iv_ptr 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 In preparation to add auth-specific IV, rename override_iv_ptr field to ciper_iv_ptr. Provide deprecated compatibility field override_iv_ptr. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ example/ipsec/odp_ipsec.c | 2 +- include/odp/api/spec/crypto.h | 18 ++++++++++++---- platform/linux-generic/odp_crypto.c | 26 ++++++++++++------------ platform/linux-generic/odp_ipsec.c | 8 ++++---- test/validation/api/crypto/odp_crypto_test_inp.c | 18 ++++++++-------- 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 001f52084..c0978d0df 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -635,7 +635,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t *pkt, if (esp) { params.cipher_range.offset = ipv4_data_p(ip) + hdr_len - buf; params.cipher_range.length = ipv4_data_len(ip) - hdr_len; - params.override_iv_ptr = esp->iv; + params.cipher_iv_ptr = esp->iv; } /* Issue crypto request */ diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 25ce2f86c..e44892fbf 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -400,8 +400,13 @@ typedef struct odp_crypto_op_param_t { */ odp_packet_t out_pkt; - /** Override session IV pointer */ - uint8_t *override_iv_ptr; + /** Override session IV pointer for cipher */ + union { + /** @deprecated use cipher_iv_ptr */ + uint8_t *ODP_DEPRECATE(override_iv_ptr); + /** Override session IV pointer for cipher */ + uint8_t *cipher_iv_ptr; + }; /** Offset from start of packet for hash result * @@ -436,8 +441,13 @@ typedef struct odp_crypto_packet_op_param_t { /** Session handle from creation */ odp_crypto_session_t session; - /** Override session IV pointer */ - uint8_t *override_iv_ptr; + /** Override session IV pointer for cipher */ + union { + /** @deprecated use cipher_iv_ptr */ + uint8_t *ODP_DEPRECATE(override_iv_ptr); + /** Override session IV pointer for cipher */ + uint8_t *cipher_iv_ptr; + }; /** Offset from start of packet for hash result * diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index eab82e9fa..35a83ce0f 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -434,8 +434,8 @@ odp_crypto_alg_err_t cipher_encrypt(odp_packet_t pkt, void *iv_ptr; int ret; - if (param->override_iv_ptr) - iv_ptr = param->override_iv_ptr; + if (param->cipher_iv_ptr) + iv_ptr = param->cipher_iv_ptr; else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else @@ -465,8 +465,8 @@ odp_crypto_alg_err_t cipher_decrypt(odp_packet_t pkt, void *iv_ptr; int ret; - if (param->override_iv_ptr) - iv_ptr = param->override_iv_ptr; + if (param->cipher_iv_ptr) + iv_ptr = param->cipher_iv_ptr; else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else @@ -528,8 +528,8 @@ odp_crypto_alg_err_t aes_gcm_encrypt(odp_packet_t pkt, uint8_t block[EVP_MAX_MD_SIZE]; int ret; - if (param->override_iv_ptr) - iv_ptr = param->override_iv_ptr; + if (param->cipher_iv_ptr) + iv_ptr = param->cipher_iv_ptr; else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else @@ -575,8 +575,8 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_packet_t pkt, uint8_t block[EVP_MAX_MD_SIZE]; int ret; - if (param->override_iv_ptr) - iv_ptr = param->override_iv_ptr; + if (param->cipher_iv_ptr) + iv_ptr = param->cipher_iv_ptr; else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else @@ -641,8 +641,8 @@ odp_crypto_alg_err_t aes_gmac_gen(odp_packet_t pkt, uint8_t block[EVP_MAX_MD_SIZE]; int ret; - if (param->override_iv_ptr) - iv_ptr = param->override_iv_ptr; + if (param->cipher_iv_ptr) + iv_ptr = param->cipher_iv_ptr; else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else @@ -680,8 +680,8 @@ odp_crypto_alg_err_t aes_gmac_check(odp_packet_t pkt, uint8_t block[EVP_MAX_MD_SIZE]; int ret; - if (param->override_iv_ptr) - iv_ptr = param->override_iv_ptr; + if (param->cipher_iv_ptr) + iv_ptr = param->cipher_iv_ptr; else if (session->p.cipher_iv.data) iv_ptr = session->cipher.iv_data; else @@ -1101,7 +1101,7 @@ odp_crypto_operation(odp_crypto_op_param_t *param, int rc; packet_param.session = param->session; - packet_param.override_iv_ptr = param->override_iv_ptr; + packet_param.cipher_iv_ptr = param->cipher_iv_ptr; packet_param.hash_result_offset = param->hash_result_offset; packet_param.aad_ptr = param->aad_ptr; packet_param.cipher_range = param->cipher_range; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index b023d308d..ab4fb5543 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -477,7 +477,7 @@ static int ipsec_in_esp(odp_packet_t *pkt, state->ip_hdr_len - state->in.hdr_len - ipsec_sa->icv_len; - param->override_iv_ptr = state->iv; + param->cipher_iv_ptr = state->iv; state->esp.aad.spi = esp.spi; state->esp.aad.seq_no = esp.seq_no; @@ -560,7 +560,7 @@ static int ipsec_in_ah(odp_packet_t *pkt, return -1; } - param->override_iv_ptr = state->iv; + param->cipher_iv_ptr = state->iv; state->in.hdr_len = (ah.ah_len + 2) * 4; state->in.trl_len = 0; @@ -1079,7 +1079,7 @@ static int ipsec_out_esp(odp_packet_t *pkt, return -1; } - param->override_iv_ptr = state->iv; + param->cipher_iv_ptr = state->iv; memset(&esp, 0, sizeof(esp)); esp.spi = odp_cpu_to_be_32(ipsec_sa->spi); @@ -1229,7 +1229,7 @@ static int ipsec_out_ah(odp_packet_t *pkt, return -1; } - param->override_iv_ptr = state->iv; + param->cipher_iv_ptr = state->iv; if (odp_packet_extend_head(pkt, hdr_len, NULL, NULL) < 0) { status->error.alg = 1; diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index d795baafc..7309b5d52 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -78,7 +78,7 @@ static const char *cipher_alg_name(odp_cipher_alg_t cipher) static int alg_op(odp_packet_t pkt, odp_bool_t *ok, odp_crypto_session_t session, - uint8_t *op_iv_ptr, + uint8_t *cipher_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -99,8 +99,8 @@ static int alg_op(odp_packet_t pkt, op_params.cipher_range = *cipher_range; op_params.auth_range = *auth_range; - if (op_iv_ptr) - op_params.override_iv_ptr = op_iv_ptr; + if (cipher_iv_ptr) + op_params.cipher_iv_ptr = cipher_iv_ptr; op_params.aad_ptr = aad; @@ -153,7 +153,7 @@ static int alg_op(odp_packet_t pkt, static int alg_packet_op(odp_packet_t pkt, odp_bool_t *ok, odp_crypto_session_t session, - uint8_t *op_iv_ptr, + uint8_t *cipher_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -171,8 +171,8 @@ static int alg_packet_op(odp_packet_t pkt, op_params.cipher_range = *cipher_range; op_params.auth_range = *auth_range; - if (op_iv_ptr) - op_params.override_iv_ptr = op_iv_ptr; + if (cipher_iv_ptr) + op_params.cipher_iv_ptr = cipher_iv_ptr; op_params.aad_ptr = aad; @@ -210,7 +210,7 @@ static int alg_packet_op(odp_packet_t pkt, static int alg_packet_op_enq(odp_packet_t pkt, odp_bool_t *ok, odp_crypto_session_t session, - uint8_t *op_iv_ptr, + uint8_t *cipher_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -229,8 +229,8 @@ static int alg_packet_op_enq(odp_packet_t pkt, op_params.cipher_range = *cipher_range; op_params.auth_range = *auth_range; - if (op_iv_ptr) - op_params.override_iv_ptr = op_iv_ptr; + if (cipher_iv_ptr) + op_params.cipher_iv_ptr = cipher_iv_ptr; op_params.aad_ptr = aad; From patchwork Mon Jan 15 00:03:39 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: 124461 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp505827lje; Sun, 14 Jan 2018 16:18:44 -0800 (PST) X-Google-Smtp-Source: ACJfBosxSnVhTYPgDd8fWNm9kPE4BAQsXHxYw9y+g8iaBHGlTXY/vhmbpprd0zOrfuF0Wk14GgAP X-Received: by 10.200.35.186 with SMTP id q55mr45593977qtq.73.1515975524085; Sun, 14 Jan 2018 16:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975524; cv=none; d=google.com; s=arc-20160816; b=JktJ4R78Tzte3UDKPAsOsPPEeS6TArYCGyrwj9GE151UP83IYCiuWq1dnr/AhkUzCR 1GUm6pakUF0EmqpuG/uzxlOWDZtx4cGA1EkjuFlKNMNhQTc5S2LuiaPYTqBedlrVdB7k HMFMzcG9Bo7jnzGCuihxpwb+K3D5lQaTtQD00iFTIu/4fJUuQHycnnz7hBRfCGmnY2vY b+yt6jDElcuB3Mgm4DTEUhUT7K6wtKtFjzJ9LtCUzurLnllPD235vff7eSahQzj7PWbr G63OnPnUYdCK3Lx9KDk+degM9ftHL463hvLrcqfA8xylfHo1L4r9VYgZR1gv+PZyXz/B 6Zxg== 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=5CPs14SLo3jqVGFXee6uLlXaDTV42nmyHXq9o9sAWaQ=; b=drEQP6XK4bu+GPsobyMDfdRTrA256KRa4v2+xEPuXtcLAoNpx0aLM3hdEaCcil/HD9 eReqNXbCZAWWjGNXyTj1LPFJbYvgEQfsniIxZRnPGYhPoV/nfaHeYYhDhGCAHxSLGBps QcpI7gw61nZOmqgppPvQKSI235r2zDJ/fC3SrqPFb9v2zY1obR/aTFS/3aPgQokavkrM vXSl6JLTwbQWsApXkoHVAVtI4mhNmSkA5RK3OTp2qyi/V9/PvT2MiEZfgn5cCqLaf9Ru e1ClkI/ExQ8mZSvXPB96L5YnfrN9WyazsYLEGAkS+XxPoONUtQiZJAji7jLK6qEL/QZU RM3Q== 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 4si3007790qtn.177.2018.01.14.16.18.43; Sun, 14 Jan 2018 16:18:44 -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 BBFDA61757; Mon, 15 Jan 2018 00:18:43 +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 D2B3A6176B; Mon, 15 Jan 2018 00:06:03 +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 4FA7061785; Mon, 15 Jan 2018 00:05:46 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id B20F46176C for ; Mon, 15 Jan 2018 00:03:46 +0000 (UTC) Received: from mxback7j.mail.yandex.net (mxback7j.mail.yandex.net [IPv6:2a02:6b8:0:1619::110]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 868132A2248D for ; Mon, 15 Jan 2018 03:03:45 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback7j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id py6temxo7M-3jRSo9qd; Mon, 15 Jan 2018 03:03:45 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3jKaRDcT; Mon, 15 Jan 2018 03:03:45 +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: Mon, 15 Jan 2018 03:03:39 +0300 Message-Id: <1515974621-25987-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 5/7] api: crypto: add separate auth IV 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 GMAC auth algorithm requires IV to work. Instead of hacking the ODP_CIPHER_ALG_NULL iv to include value for ODP_AUTH_ALG_GMAC, provide separate iv (in auth capability, session params and operation params). Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ include/odp/api/spec/crypto.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index e44892fbf..ea2a14d65 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -333,6 +333,9 @@ typedef struct odp_crypto_session_param_t { */ odp_crypto_key_t auth_key; + /** Authentication Initialization Vector (IV) */ + odp_crypto_iv_t auth_iv; + /** Authentication digest length in bytes * * Use odp_crypto_auth_capability() for supported digest lengths. @@ -408,6 +411,9 @@ typedef struct odp_crypto_op_param_t { uint8_t *cipher_iv_ptr; }; + /** Override session authentication IV pointer */ + uint8_t *auth_iv_ptr; + /** Offset from start of packet for hash result * * Specifies the offset where the hash result is to be stored. In case @@ -449,6 +455,9 @@ typedef struct odp_crypto_packet_op_param_t { uint8_t *cipher_iv_ptr; }; + /** Override session IV pointer for authentication */ + uint8_t *auth_iv_ptr; + /** Offset from start of packet for hash result * * Specifies the offset where the hash result is to be stored. In case @@ -614,6 +623,9 @@ typedef struct odp_crypto_auth_capability_t { /** Key length in bytes */ uint32_t key_len; + /** IV length in bytes */ + uint32_t iv_len; + /** Additional Authenticated Data (AAD) lengths */ struct { /** Minimum AAD length in bytes */ From patchwork Mon Jan 15 00:03:40 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: 124462 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp505949lje; Sun, 14 Jan 2018 16:19:29 -0800 (PST) X-Google-Smtp-Source: ACJfBotaQ9OdUVggSDJcRGFfbL9w6FZRhLejEOOyGpDoeq2oqTJZyIy5lcdnVtic5cKVCXl92BkF X-Received: by 10.237.41.225 with SMTP id o88mr8386000qtd.184.1515975569271; Sun, 14 Jan 2018 16:19:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975569; cv=none; d=google.com; s=arc-20160816; b=VjPIFYfOeVkYEppzDjCkJRy4ncK57DvDTf73hP0DHKn6Yhsta+/pfo/NlzKwRFrOGi dBal1M15ks2vc5OfW7swfjQL2zA0hlA/CX7TNVP7rOAOiFTiK7436AxAuIvSzqIGSwIY 0RKURsEyUZBTo/DYXPjt/uRT1BK44eS8DRaLpFenhWPY/5nH4kNKylQHzx2lq1Gyt4QV SFiw0ctFk0T+ItfLcDssmR5YE/8t0xkEXwbsk6pPqK4BL+2lfl7kaaZhEUHOwH/zNa+t VK9yoXQkA8HJagRitZ9ZhMb5fifQhtjnuimRVmiQtWRzvnHwE2CXXEfvfV4LBHIp/gYP 4Vpw== 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=ZZbLzdQE/L1XRk8l7sV8id77MBOveb6T62gnKGzk9Tc=; b=qVyWRruCvP3rN4fJ8DTYjbhBCSPC/0QuMoSxmwMy2tL8JwK7/Jjj0APwNtxQQe4wKI 8x2vRmwbWf4tA2lX0gKJKj+0rn7WlCc/+n+oU2dDGmjcLG9h6Cp5fQ92G6uksRks0Pyr pDz/AUCCEsrcJ56LGDZTgSXgJAHZn+qCUXdTi8NicChuqMDQmR98PxaYsuiLwPr8lVhs 0eTz2k1i6k/4Dg1BaZ5IoewWfY3pv56M18fgXauZ00RtTvxfiHOMcd2EhX5pUWAThRlg eT+0nJdkA7EWfQMOKFBuKl5c2dPRpuAamS0aR089Zl7COZnhgMkBvLQITIs/jO/lYcYs tPCg== 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 r7si14878072qtd.259.2018.01.14.16.19.29; Sun, 14 Jan 2018 16:19:29 -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 E982D6176B; Mon, 15 Jan 2018 00:19:28 +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 249D06178E; Mon, 15 Jan 2018 00:06:08 +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 04B6D6176C; Mon, 15 Jan 2018 00:05:51 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 1E80861770 for ; Mon, 15 Jan 2018 00:03:47 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 196EC1241E58 for ; Mon, 15 Jan 2018 03:03:46 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6BQevBS8rn-3kuuI17p; Mon, 15 Jan 2018 03:03:46 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3jKmh18X; Mon, 15 Jan 2018 03:03:45 +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: Mon, 15 Jan 2018 03:03:40 +0300 Message-Id: <1515974621-25987-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 6/7] validation: crypto: use auth IV for GMAC test case 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 Change GMAC testing code to use new auth IV fields. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ test/validation/api/crypto/odp_crypto_test_inp.c | 55 +++++++++++++++++++++++- test/validation/api/crypto/test_vectors.h | 8 ++-- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 7309b5d52..976c88821 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -79,6 +79,7 @@ static int alg_op(odp_packet_t pkt, odp_bool_t *ok, odp_crypto_session_t session, uint8_t *cipher_iv_ptr, + uint8_t *auth_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -101,6 +102,8 @@ static int alg_op(odp_packet_t pkt, op_params.auth_range = *auth_range; if (cipher_iv_ptr) op_params.cipher_iv_ptr = cipher_iv_ptr; + if (auth_iv_ptr) + op_params.auth_iv_ptr = auth_iv_ptr; op_params.aad_ptr = aad; @@ -154,6 +157,7 @@ static int alg_packet_op(odp_packet_t pkt, odp_bool_t *ok, odp_crypto_session_t session, uint8_t *cipher_iv_ptr, + uint8_t *auth_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -173,6 +177,8 @@ static int alg_packet_op(odp_packet_t pkt, op_params.auth_range = *auth_range; if (cipher_iv_ptr) op_params.cipher_iv_ptr = cipher_iv_ptr; + if (auth_iv_ptr) + op_params.auth_iv_ptr = auth_iv_ptr; op_params.aad_ptr = aad; @@ -211,6 +217,7 @@ static int alg_packet_op_enq(odp_packet_t pkt, odp_bool_t *ok, odp_crypto_session_t session, uint8_t *cipher_iv_ptr, + uint8_t *auth_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -231,6 +238,8 @@ static int alg_packet_op_enq(odp_packet_t pkt, op_params.auth_range = *auth_range; if (cipher_iv_ptr) op_params.cipher_iv_ptr = cipher_iv_ptr; + if (auth_iv_ptr) + op_params.auth_iv_ptr = auth_iv_ptr; op_params.aad_ptr = aad; @@ -321,6 +330,10 @@ static void alg_test(odp_crypto_op_t op, .data = ovr_iv ? NULL : ref->cipher_iv, .length = ref->cipher_iv_length }; + odp_crypto_iv_t auth_iv = { + .data = ovr_iv ? NULL : ref->auth_iv, + .length = ref->auth_iv_length + }; int num, i; int found; @@ -414,6 +427,7 @@ static void alg_test(odp_crypto_op_t op, /* Search for the test case */ for (i = 0; i < num; i++) { if (auth_capa[i].digest_len == ref->digest_length && + auth_capa[i].iv_len == auth_iv.length && auth_capa[i].key_len == auth_key.length) { found = 1; break; @@ -422,8 +436,9 @@ static void alg_test(odp_crypto_op_t op, if (!found) { printf("\n Unsupported: alg=%s, key_len=%" PRIu32 ", " - "digest_len=%" PRIu32 "\n", auth_alg_name(auth_alg), - auth_key.length, ref->digest_length); + "digest_len=%" PRIu32 ", iv_len=%" PRIu32 "\n", + auth_alg_name(auth_alg), auth_key.length, + ref->digest_length, auth_iv.length); return; } @@ -439,6 +454,7 @@ static void alg_test(odp_crypto_op_t op, ses_params.output_pool = suite_context.pool; ses_params.cipher_key = cipher_key; ses_params.cipher_iv = cipher_iv; + ses_params.auth_iv = auth_iv; ses_params.auth_key = auth_key; ses_params.auth_digest_len = ref->digest_length; ses_params.auth_aad_len = ref->aad_length; @@ -489,16 +505,19 @@ static void alg_test(odp_crypto_op_t op, if (!suite_context.packet) rc = alg_op(pkt, &ok, session, ovr_iv ? ref->cipher_iv : NULL, + ovr_iv ? ref->auth_iv : NULL, &cipher_range, &auth_range, ref->aad, ref->length); else if (ODP_CRYPTO_ASYNC == suite_context.op_mode) rc = alg_packet_op_enq(pkt, &ok, session, ovr_iv ? ref->cipher_iv : NULL, + ovr_iv ? ref->auth_iv : NULL, &cipher_range, &auth_range, ref->aad, ref->length); else rc = alg_packet_op(pkt, &ok, session, ovr_iv ? ref->cipher_iv : NULL, + ovr_iv ? ref->auth_iv : NULL, &cipher_range, &auth_range, ref->aad, ref->length); if (rc < 0) @@ -1163,6 +1182,20 @@ static void crypto_test_gen_alg_aes_gmac(void) false); } +static void crypto_test_gen_alg_aes_gmac_ovr_iv(void) +{ + unsigned int test_vec_num = (sizeof(aes_gmac_reference) / + sizeof(aes_gmac_reference[0])); + unsigned int i; + + for (i = 0; i < test_vec_num; i++) + alg_test(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_AES_GMAC, + &aes_gmac_reference[i], + true); +} + static void crypto_test_check_alg_aes_gmac(void) { unsigned int test_vec_num = (sizeof(aes_gmac_reference) / @@ -1177,6 +1210,20 @@ static void crypto_test_check_alg_aes_gmac(void) false); } +static void crypto_test_check_alg_aes_gmac_ovr_iv(void) +{ + unsigned int test_vec_num = (sizeof(aes_gmac_reference) / + sizeof(aes_gmac_reference[0])); + unsigned int i; + + for (i = 0; i < test_vec_num; i++) + alg_test(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_AES_GMAC, + &aes_gmac_reference[i], + true); +} + int crypto_suite_sync_init(void) { suite_context.pool = odp_pool_lookup("packet_pool"); @@ -1284,8 +1331,12 @@ odp_testinfo_t crypto_suite[] = { check_alg_hmac_sha512), ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_aes_gmac, check_alg_aes_gmac), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_aes_gmac_ovr_iv, + check_alg_aes_gmac), ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_aes_gmac, check_alg_aes_gmac), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_aes_gmac_ovr_iv, + check_alg_aes_gmac), ODP_TEST_INFO_NULL, }; diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h index 6673ba4b6..d08bf1500 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/test/validation/api/crypto/test_vectors.h @@ -16,6 +16,8 @@ typedef struct crypto_test_reference_s { uint8_t auth_key[MAX_KEY_LEN]; uint32_t cipher_iv_length; uint8_t cipher_iv[MAX_IV_LEN]; + uint32_t auth_iv_length; + uint8_t auth_iv[MAX_IV_LEN]; uint32_t length; uint8_t plaintext[MAX_DATA_LEN]; uint8_t ciphertext[MAX_DATA_LEN]; @@ -447,9 +449,9 @@ static crypto_test_reference_t aes_gmac_reference[] = { .auth_key_length = AES128_GCM_KEY_LEN, .auth_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda, 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34}, - .cipher_iv_length = AES_GCM_IV_LEN, - .cipher_iv = { 0x22, 0x43, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }, + .auth_iv_length = AES_GCM_IV_LEN, + .auth_iv = { 0x22, 0x43, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }, .length = 68, .plaintext = { 0x00, 0x00, 0x43, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From patchwork Mon Jan 15 00:03:41 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: 124463 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp506092lje; Sun, 14 Jan 2018 16:20:23 -0800 (PST) X-Google-Smtp-Source: ACJfBotJyadBppZaH+qox9GK0HPWSf6Fz85hGWaIBQzKZVCvM8Cvq7+HiHPxce09MNp2HjaVxxz2 X-Received: by 10.55.149.194 with SMTP id x185mr47996867qkd.46.1515975623746; Sun, 14 Jan 2018 16:20:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515975623; cv=none; d=google.com; s=arc-20160816; b=vOaVsBfwidc0nT3wvgqbRHpbICry+/h8V+tEjjY8mVeffukxfVwM6Np3peznV3cA9T EABj5emxHKqr/munGwUKsZKwB3z51hqXFgFwmkjQxvwHMwZ1p24aHnN/teIRYDMW5fCt WjhsN0vjWiirfxlLMA212zR/Gdf9NRHunw/oUEox1dMmOOucpg6mdJzMbs8ZMyehgJId jPncWyPN1jx6s0+8qzKGEEaBMqzbyl2riKG7zBpssv4DwVJ7OQAo/Jw6eVv53jbdFM2a xLyEEGzRsl5MxDPnnwfCOGOyBgNIt+brUZVmvQfAqX+YY91S+Kf7XTxSNWZMqAv7nynS +60g== 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=3ilQjAXwE9mYU0nKmceiYHtZO72kkXT1NZZwy0dkhnI=; b=AaCBxLYQ4HEyTRcDhfxOmkls4P0AwtJrEexl79mPQoODEk4zhlMqkq22aFDpciqX+N qCvr2ufv5efvfapHdN6lS2c8yKZ4HYZo6KSs0Mu13137JrQkhl/V/SP6D/f5AyUKHU++ zvJHK2J2XQoizdER9dTa9trdiQCbjDkig6GRPTIy/BrAn6ogNdDrxKen3n+egy5aW0KG LcD6/15t3AiPG+erEqmsU97Vwch3uRPiSxGiTKTGLaChg0IrdtZN5GEN+DeZB5fvu9Mt zl3RQPvKCfmHXBXFsajanQbodUrPrb+aA2/4N3XfCTvd3n3jJV4mmUiwGJ8IU3K4vPJi nmqA== 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 d192si729655qkg.484.2018.01.14.16.20.23; Sun, 14 Jan 2018 16:20:23 -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 6262E6176D; Mon, 15 Jan 2018 00:20:23 +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 61A8A61793; Mon, 15 Jan 2018 00:06:13 +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 ADA536176B; Mon, 15 Jan 2018 00:05:55 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 89F4D6176B for ; Mon, 15 Jan 2018 00:03:47 +0000 (UTC) Received: from mxback4o.mail.yandex.net (mxback4o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1e]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 89D2D1241E47 for ; Mon, 15 Jan 2018 03:03:46 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback4o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id RmLxKiwNNk-3kIawOZ3; Mon, 15 Jan 2018 03:03:46 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HWZU16MmnE-3kKG3050; Mon, 15 Jan 2018 03:03:46 +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: Mon, 15 Jan 2018 03:03:41 +0300 Message-Id: <1515974621-25987-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> References: <1515974621-25987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v7 7/7] linux-gen: crypto, ipsec: use auth_iv. 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 Separate handling of authentication IV data. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 352 (lumag:crypto_gmac_iv) ** https://github.com/Linaro/odp/pull/352 ** Patch: https://github.com/Linaro/odp/pull/352.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 8b925492ef06bf633b8767bba97bd6ec68547618 **/ platform/linux-generic/odp_crypto.c | 35 ++++++++++++++++++++++------------ platform/linux-generic/odp_ipsec.c | 6 ++++-- platform/linux-generic/odp_ipsec_sad.c | 2 +- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 35a83ce0f..b7065e73c 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -36,9 +36,7 @@ * 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}, -/* Special case for GMAC */ -{.key_len = 0, .iv_len = 12} }; +{.key_len = 0, .iv_len = 0} }; static const odp_crypto_cipher_capability_t cipher_capa_trides_cbc[] = { {.key_len = 24, .iv_len = 8} }; @@ -86,7 +84,8 @@ static const odp_crypto_auth_capability_t auth_capa_aes_gcm[] = { {.digest_len = 16, .key_len = 0, .aad_len = {.min = 8, .max = 12, .inc = 4} } }; static const odp_crypto_auth_capability_t auth_capa_aes_gmac[] = { -{.digest_len = 16, .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}, + .iv_len = 12 } }; /** Forward declaration of session structure */ typedef struct odp_crypto_generic_session_t odp_crypto_generic_session_t; @@ -121,6 +120,7 @@ struct odp_crypto_generic_session_t { struct { uint8_t key[EVP_MAX_KEY_LENGTH]; + uint8_t iv_data[EVP_MAX_IV_LENGTH]; uint32_t key_length; uint32_t bytes; union { @@ -641,10 +641,10 @@ odp_crypto_alg_err_t aes_gmac_gen(odp_packet_t pkt, uint8_t block[EVP_MAX_MD_SIZE]; int ret; - if (param->cipher_iv_ptr) - iv_ptr = param->cipher_iv_ptr; - else if (session->p.cipher_iv.data) - iv_ptr = session->cipher.iv_data; + if (param->auth_iv_ptr) + iv_ptr = param->auth_iv_ptr; + else if (session->p.auth_iv.data) + iv_ptr = session->auth.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -680,10 +680,10 @@ odp_crypto_alg_err_t aes_gmac_check(odp_packet_t pkt, uint8_t block[EVP_MAX_MD_SIZE]; int ret; - if (param->cipher_iv_ptr) - iv_ptr = param->cipher_iv_ptr; - else if (session->p.cipher_iv.data) - iv_ptr = session->cipher.iv_data; + if (param->auth_iv_ptr) + iv_ptr = param->auth_iv_ptr; + else if (session->p.auth_iv.data) + iv_ptr = session->auth.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -909,11 +909,21 @@ odp_crypto_session_create(odp_crypto_session_param_t *param, goto err; } + if (session->p.auth_iv.length > EVP_MAX_IV_LENGTH) { + ODP_DBG("Maximum auth IV length exceeded\n"); + *status = ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER; + goto err; + } + /* Copy IV data */ if (session->p.cipher_iv.data) memcpy(session->cipher.iv_data, session->p.cipher_iv.data, session->p.cipher_iv.length); + if (session->p.auth_iv.data) + memcpy(session->auth.iv_data, session->p.auth_iv.data, + session->p.auth_iv.length); + /* Derive order */ if (ODP_CRYPTO_OP_ENCODE == param->op) session->do_cipher_first = param->auth_cipher_text; @@ -1102,6 +1112,7 @@ odp_crypto_operation(odp_crypto_op_param_t *param, packet_param.session = param->session; packet_param.cipher_iv_ptr = param->cipher_iv_ptr; + packet_param.auth_iv_ptr = param->auth_iv_ptr; packet_param.hash_result_offset = param->hash_result_offset; packet_param.aad_ptr = param->aad_ptr; packet_param.cipher_range = param->cipher_range; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index ab4fb5543..e19907a5f 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -478,6 +478,7 @@ static int ipsec_in_esp(odp_packet_t *pkt, state->in.hdr_len - ipsec_sa->icv_len; param->cipher_iv_ptr = state->iv; + param->auth_iv_ptr = state->iv; state->esp.aad.spi = esp.spi; state->esp.aad.seq_no = esp.seq_no; @@ -560,7 +561,7 @@ static int ipsec_in_ah(odp_packet_t *pkt, return -1; } - param->cipher_iv_ptr = state->iv; + param->auth_iv_ptr = state->iv; state->in.hdr_len = (ah.ah_len + 2) * 4; state->in.trl_len = 0; @@ -1080,6 +1081,7 @@ static int ipsec_out_esp(odp_packet_t *pkt, } param->cipher_iv_ptr = state->iv; + param->auth_iv_ptr = state->iv; memset(&esp, 0, sizeof(esp)); esp.spi = odp_cpu_to_be_32(ipsec_sa->spi); @@ -1229,7 +1231,7 @@ static int ipsec_out_ah(odp_packet_t *pkt, return -1; } - param->cipher_iv_ptr = state->iv; + param->auth_iv_ptr = state->iv; if (odp_packet_extend_head(pkt, hdr_len, NULL, NULL) < 0) { status->error.alg = 1; diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 11227a5fc..38cf77557 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -409,7 +409,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) ipsec_sa->use_counter_iv = 1; ipsec_sa->esp_iv_len = 8; ipsec_sa->esp_block_len = 16; - crypto_param.cipher_iv.length = 12; + crypto_param.auth_iv.length = 12; break; default: break;