From patchwork Thu Jan 4 00:00:08 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: 123366 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10788980qgn; Wed, 3 Jan 2018 16:01:08 -0800 (PST) X-Google-Smtp-Source: ACJfBouL3IECrWK3omE8xWVSxE0Nonm9A5vG6mC86eiPKT/dKh5OOqI7pIc+gCXYDavDhbNtL2KM X-Received: by 10.200.27.43 with SMTP id y40mr4186370qtj.126.1515024068352; Wed, 03 Jan 2018 16:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515024068; cv=none; d=google.com; s=arc-20160816; b=gHlWmLjZrw4j/IW/S96Cuc7ZEE12h6fdL+rWiOsdgKuTx86/EgM7FqAAgazXY18jLn /eg6IF0jWzX8QLn3EKiYU07N5X25qm5ZnQ7jwJ7kYEWm4CsA/JWwW5RPUkbZy+ApAPBF jeOMi4ovn402L6VL33lidd47he8AQXpbTa8ZmspiM14j7KoEUBKpGCoPu7DnYjT9ZO98 4VuTUefbjP/Ww1bD6SDocSWTWKMq5KmW85RW/AxRik4Qtb0P5l+F4tvXDFjVCafHYlJ2 ZRgt2shVGJZYZHXqcl9qC8Sk3ClkFBW51LA+BU2wlKp/117c1FNlz54A2vEsYqfOLkyE wXSA== 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=POTVK3LSpRqvxi8UU6o+R7X5/7vb3CgRaTPcIzd2vts=; b=gpSHSBSf7NY5c3v7Zy5UCVzDs/FwyK4npVIP+hZe4QrYo4e9upWcqQmUKdNU+S/TAx yQxaVorJXwnKsb6RJSDWAw2CGF/T79R8BgEi9I+Fv1QGhAzF7lMpwkS5TO2zO2qsUfZz /DMqg/gG4ywhEc/n163WKDksZkEsC5i9Dg5knhLs3cyJzXWxQKMIIm3PW+u0psv/CS9g jcJzo3Ka3/r27F1nZ02cVqIA3wN05y+Yoo3XuZIoy4HEqEzkARM2+bl1RnVKTyn+I9Bu 1d+RYZgfYEOAPvTEoyro+g39d2Y3xHJLScX9xTphIcHI4HblfMt2FwQgFCAcZEBKV62f 6uhg== 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 40si1674437qtt.437.2018.01.03.16.01.08; Wed, 03 Jan 2018 16:01:08 -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 107CC6150D; Thu, 4 Jan 2018 00:01:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B202060846; Thu, 4 Jan 2018 00:00:30 +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 9679E6097F; Thu, 4 Jan 2018 00:00:20 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id EDA3A60846 for ; Thu, 4 Jan 2018 00:00:16 +0000 (UTC) Received: from mxback9o.mail.yandex.net (mxback9o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::23]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 937CE4082552 for ; Thu, 4 Jan 2018 03:00:15 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback9o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id fS4xnrQNlk-0FOqdCoO; Thu, 04 Jan 2018 03:00:15 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lrM9dmOAE5-0E4anaYp; Thu, 04 Jan 2018 03:00:14 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 4 Jan 2018 03:00:08 +0300 Message-Id: <1515024013-30222-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> References: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v5 1/6] 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: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23 **/ 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 Thu Jan 4 00:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 123368 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10790771qgn; Wed, 3 Jan 2018 16:03:02 -0800 (PST) X-Google-Smtp-Source: ACJfBoshehTOKtNLtjPE4t7WKZiXUkDVvCMhGh4EG/5CzywcYmYiEyHPTx7WicSm6+WuVsR8U7O7 X-Received: by 10.55.155.142 with SMTP id d136mr3931500qke.311.1515024182532; Wed, 03 Jan 2018 16:03:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515024182; cv=none; d=google.com; s=arc-20160816; b=NiEHbV1lS6ssl437fFpCjb0XdceJJh3KT1JHpYPqdSO3kqzcT0BTsizc1p29mjxSpf vGEgLH/wMw0vem2jmt+EO6ihWEwUTKQKZttBOdD5IoLNZ2QzgIpLSyoCGt6OOhEg6kzV ByGigm8Uzc8GrgTkrAPahxC28S3qRv/bPZlFYsxo2+hl7GDzOf/+yZS01MTSApq4kDwP TVhb7J+24Wg1jGmIDeIJnng/uvhm51LQWFDnUWAFDQBYkoNZSe5AbwwsqYUzAHM5WSdJ g9oKW1GdMDwTwRybRyV4rvsBSsbaa7bUDoBqmzDJsS5p7x3tQ4Y27Q63s3Q7CjY5OEKN f5FA== 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=sdRIUF4AW8lxcoJYqa6Y2tWybMoVHLHdWjXleNeEDZo=; b=J/9IuRRQmS33wxRmGfP+7jJYvSWUhs2TS3QTbjucyYUIYHdLlvo6DfP2fVkpkU5Qbw qhbwHUzmp0H1cJU9Fq+8+DiPkRgqD8hFjfk/PpdKVwuwZw3CGyDC3X2b18MXrcBKk5Rz yc7EayL6n1x14Hk2cTHpcfxZjbRQFhPDJhrfb527347EtR3t2JnojWWxYsbPWSG6Yxr0 wxCP4i/QEanGoVvdyLTJGzEADNxROaK3j0D8SEIPUfref9ikhpL2tGNH60/MKcYCQF+U zsote0/4+rowk214NRo0u9m/4agjQnG1pUM3aEIkzEce5MPHpu85nWDJSnHTAzVGsspi D5dQ== 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 c1si947809qkd.73.2018.01.03.16.03.02; Wed, 03 Jan 2018 16:03:02 -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 42CB760B52; Thu, 4 Jan 2018 00:03:02 +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, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8165560BF0; Thu, 4 Jan 2018 00:00: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 CC3B4608FA; Thu, 4 Jan 2018 00:00:23 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 71FE3608F7 for ; Thu, 4 Jan 2018 00:00:17 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 1D1231825BB for ; Thu, 4 Jan 2018 03:00:16 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iudTWE9oFq-0GbWWYmL; Thu, 04 Jan 2018 03:00:16 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lrM9dmOAE5-0F4eNlC3; Thu, 04 Jan 2018 03:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 4 Jan 2018 03:00:09 +0300 Message-Id: <1515024013-30222-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> References: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v5 2/6] 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: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23 **/ 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 Thu Jan 4 00:00:10 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: 123369 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10792508qgn; Wed, 3 Jan 2018 16:04:52 -0800 (PST) X-Google-Smtp-Source: ACJfBosbc6EPR9nxSKGDTD8scsr9WkZ5kIJJtnSLnQ0YJl/BQ31nVf+VyHrh50w3wbznNOQxTOUj X-Received: by 10.55.131.196 with SMTP id f187mr3812618qkd.222.1515024291935; Wed, 03 Jan 2018 16:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515024291; cv=none; d=google.com; s=arc-20160816; b=dLxqzNtdxgt4I0Vb8GlbTABvi2mfMNox6HQSaWf6Rp+Rktfd8D/C2EOpqJr7plCDpi qfYRqOrPITsT40F0pewfwd7XgPynF/kCg0yVSNMaljqt+ZC4L7DvDzCqHRWfMZVFdI1/ 4Muuxg6gRvlpvG5pCQ16Fmt6rlDUcRD3Ha8To77o/i92dyaQcOIxgohOCwZ3YogztErK /E6UiXTOoXU8RsAW9ghMbRDY10H41qF4qf9ISpM39K2NAjRO+pyRv0ni4ENpPzj+ZbZ1 ZN1q7i887KBzaF9Jr5kKSFeocumaPOnGjQauLaP3uBZgoKnDEOPFLgZ7qKeSq7q6mFF0 hkKg== 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=Pw6Opy2V8l53+d5Lj402dTjZBN5q22Cz6H3F9MeijGs=; b=bAMlbxLtlfObMMPo5VjhKjx12G2pCJr/LF3hejkEvrcgufISU3fMkSQvPvGRH/kKaQ 1D55dT2RuEt24kZhrfNxkKVTKU610J+fgYAp38F0fTHxYZ1dGJGoyNqN/tKDs2+ijiYC rut3yHVVZ47NA0FnrYdGrIhO8iTNQjqdkrwk37yTu283wrmDEcCrtJAd7kEQAMFQVC5X DkozrQkciojOYTx6F0vx0s+TxNklptFA/YCCUjmSO6dlSU8RVvMLNhIcR4TvSYY/Oijt J1ai2rd4KclcX5UhpF0YF2EWj9B/6bALQ9gDI39PtCSiXJ77AmgnNRsc9E3Axac0n1og UEHg== 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 y9si1471874qtj.480.2018.01.03.16.04.50; Wed, 03 Jan 2018 16:04:51 -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 6DC8D60B0E; Thu, 4 Jan 2018 00:04:50 +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,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 242F5614E2; Thu, 4 Jan 2018 00:00:55 +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 BCF53608F7; Thu, 4 Jan 2018 00:00:25 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 30211607E4 for ; Thu, 4 Jan 2018 00:00:18 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward106o.mail.yandex.net (Yandex) with ESMTP id C4949781D5F for ; Thu, 4 Jan 2018 03:00:16 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SYuTF54uOU-0GoWJoZS; Thu, 04 Jan 2018 03:00:16 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lrM9dmOAE5-0G488X3D; Thu, 04 Jan 2018 03:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 4 Jan 2018 03:00:10 +0300 Message-Id: <1515024013-30222-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> References: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v5 3/6] 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: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23 **/ example/ipsec/odp_ipsec_cache.c | 14 +++++------ include/odp/api/spec/crypto.h | 8 +++++- platform/linux-generic/odp_crypto.c | 32 ++++++++++++------------ platform/linux-generic/odp_ipsec_sad.c | 6 ++--- test/performance/odp_crypto.c | 4 +-- test/validation/api/crypto/odp_crypto_test_inp.c | 2 +- 6 files changed, 36 insertions(+), 30 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..2cf0f5c10 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,8 @@ 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 +529,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 +539,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 +576,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 +586,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 +642,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 +652,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 +681,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 +691,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 +902,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..b49cffb5a 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -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 = iv; ses_params.auth_key = auth_key; ses_params.auth_digest_len = ref->digest_length; ses_params.auth_aad_len = ref->aad_length; From patchwork Thu Jan 4 00:00:11 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: 123370 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp6101340edv; Wed, 3 Jan 2018 16:05:39 -0800 (PST) X-Google-Smtp-Source: ACJfBotEghKBEa7nj6AQM9E4WX4A8EHBNnuOApkfBMnBeExg1BfHnhiEQgNtvGa2a9fvMW4L8Kf/ X-Received: by 10.200.36.212 with SMTP id t20mr4180395qtt.202.1515024245021; Wed, 03 Jan 2018 16:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515024245; cv=none; d=google.com; s=arc-20160816; b=JMjHU2vtBfb6nJ1DlpzQH8ziBArUfDq2huv5QuQuK4lgVKPVc+0oWo9K1FfcPLC3q6 sgjKfTzl6DklrWOQpPxAe/2VQpYDzh4DRV/ob3jMbt2/zOXb83BLU9SscoKcp8xFEW4G KzIrJFTJtDKPI5jAgkXKTUkc+GYX5Hw+d8Fvs8Ny7god65bgnx0c3J0IRIMRu+GuFiTH YXNeyZGpHjNzZUj2z3kbLqByXDqvteB3ECdXWlUOROmr0JqlCqvRuUZLnDSRGaGLecRJ Ni4GmpBYcQWmad36CKrfCKaAdsqgQylpjxpcPBC+Nn/jO7f1w61tCgEGFCXVwpL8wiP2 O4rg== 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=CmC8nMw4ZCsgy8wbPiKJm58AoJCY+E3nQa3rc5OX+DM=; b=uguWpeV70fl97UfbvguGVLbUSyT0kmv+Teal2YwB2c7nSanzztOdAOOLwCCrkDjQyC hFQZGBjBlwLrsCGdiJNF+jmzNd3+cRcaLn+txImprRtw2WEOhdD+vfIxJF3S+lY1ejk5 SFuDEoPURSCCq9IGZb9aQsO5ELbmNL4BVbXM/yfSx6pN38ZG9f5K8sEcR7su9klNECgY x5F9hlfTY9BH9+ifP8nMWAoBGoelBJ2xrtbmDlJU2BTcTs52W/mUfUsk8z4gl6DdSlp+ YVNGqhOqF7Vo+SFN+ioOEBONxMh680RAhasnkGTEjIb/6MYnv5p1EEgcM4MteFRmXRnY 1Q7g== 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 y126si1711955qkc.333.2018.01.03.16.04.04; Wed, 03 Jan 2018 16:04: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 B2AF161505; Thu, 4 Jan 2018 00:04: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_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id BF28660BF4; Thu, 4 Jan 2018 00:00:48 +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 871A8608F7; Thu, 4 Jan 2018 00:00:25 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id D70DF6095D for ; Thu, 4 Jan 2018 00:00:18 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 39E6812425FC for ; Thu, 4 Jan 2018 03:00:17 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LNSmunk86k-0Ho0KhR0; Thu, 04 Jan 2018 03:00:17 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lrM9dmOAE5-0G4Gkks8; Thu, 04 Jan 2018 03:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 4 Jan 2018 03:00:11 +0300 Message-Id: <1515024013-30222-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> References: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v5 4/6] 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: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23 **/ 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 25ce2f86c..99ae4576a 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. @@ -403,6 +406,9 @@ typedef struct odp_crypto_op_param_t { /** Override session IV pointer */ uint8_t *override_iv_ptr; + /** Override session authentication IV pointer */ + uint8_t *override_auth_iv_ptr; + /** Offset from start of packet for hash result * * Specifies the offset where the hash result is to be stored. In case @@ -439,6 +445,9 @@ typedef struct odp_crypto_packet_op_param_t { /** Override session IV pointer */ uint8_t *override_iv_ptr; + /** Override session authentication IV pointer */ + uint8_t *override_auth_iv_ptr; + /** Offset from start of packet for hash result * * Specifies the offset where the hash result is to be stored. In case @@ -604,6 +613,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 Thu Jan 4 00:00:12 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: 123367 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10790023qgn; Wed, 3 Jan 2018 16:02:12 -0800 (PST) X-Google-Smtp-Source: ACJfBovIdtMBfrccp+P+ydRlJIJ4GGDQukeRYSlS+VwlAy0vyVUW7tgkcePzcjxRy2VY/SZdCVG0 X-Received: by 10.55.170.142 with SMTP id t136mr4060771qke.114.1515024132335; Wed, 03 Jan 2018 16:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515024132; cv=none; d=google.com; s=arc-20160816; b=jwEGkjqNFMUqH/09cMnsDgoM941rJWHXx9W9+vSqGOMNjfRjtB2heMI9v2+GW3mCxt d6O63gnA8COVYgwK7/wImb4xJnqN36dlk4Ka+ON6KieZ31qL62Dxl9fA44LvdeNpGz8V NOfD2qx4dp/gZyBiZeduzjpWDviqiznmCkDF29kbWdBee+LEXR/QR7+FxucsXfsPli82 M3phSE/hw/Ex8nqf0cFVxqHB+SPrlrYMkBM9SvvH+Ifirwi4a2PCpoP5HBQx0EV6fh1V CuUe47TwF4sbgTN065Y3fY2j7fvyofqDbuUjgIbIbhGukZEFYobjQfSD/JeEVcBl1xaE kreQ== 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=mCCjmdqBGOsOn/12w2GTFXJ2SDwIA103nQCBmKNLC7U=; b=ktRk/CHiq+0lVlsFotx2cO95a7+e56Xyn0OGCY7z3jWPP17RvqYRYi8Tp+u9QGr7h+ cl3TWHq9zhMEwsW5ebMpqKxy3e1279Cc+JlyAlYSCe+mH3u2DNxolt99j+dr70V1Nisg xxdY1VaV6FMmRZZBsavbjP5GhHWipRyR50uZjxUlziI2mmLmhyGCqXgmQcE8JLQPks30 Hwuab/TtQMT28AcG9vc8o4y/fAzEyxnhHhJrOUD7lVfyh7lTF90+wxS3Pv8rZnH67JII J8rOKdlYReK1ACknlEUfyhoYrx+fWJBgWGgvUhP8nBiWYveGT58WkAuCFUfO5YmGhDcm Yg+g== 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 u89si34448qkl.284.2018.01.03.16.02.12; Wed, 03 Jan 2018 16:02:12 -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 F29A761510; Thu, 4 Jan 2018 00:02: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_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3D3D260B0E; Thu, 4 Jan 2018 00:00:34 +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 619FF608FA; Thu, 4 Jan 2018 00:00:23 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id D29DB608FA for ; Thu, 4 Jan 2018 00:00:18 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward101j.mail.yandex.net (Yandex) with ESMTP id C0AF91243240 for ; Thu, 4 Jan 2018 03:00:17 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9EOOdlJS3H-0HkepgQk; Thu, 04 Jan 2018 03:00:17 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lrM9dmOAE5-0H4iG6fi; Thu, 04 Jan 2018 03:00:17 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 4 Jan 2018 03:00:12 +0300 Message-Id: <1515024013-30222-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> References: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v5 5/6] 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: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23 **/ test/validation/api/crypto/odp_crypto_test_inp.c | 61 ++++++++++++++++++++++-- test/validation/api/crypto/test_vectors.h | 8 ++-- 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index b49cffb5a..0f10c4f49 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 *op_iv_ptr, + uint8_t *op_auth_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -99,8 +100,10 @@ static int alg_op(odp_packet_t pkt, op_params.cipher_range = *cipher_range; op_params.auth_range = *auth_range; - if (op_iv_ptr) + if (op_iv_ptr) { op_params.override_iv_ptr = op_iv_ptr; + op_params.override_auth_iv_ptr = op_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 *op_iv_ptr, + uint8_t *op_auth_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -171,8 +175,10 @@ 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) + if (op_iv_ptr) { op_params.override_iv_ptr = op_iv_ptr; + op_params.override_auth_iv_ptr = op_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 *op_iv_ptr, + uint8_t *op_auth_iv_ptr, odp_packet_data_range_t *cipher_range, odp_packet_data_range_t *auth_range, uint8_t *aad, @@ -229,8 +236,10 @@ 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) + if (op_iv_ptr) { op_params.override_iv_ptr = op_iv_ptr; + op_params.override_auth_iv_ptr = op_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->iv, .length = ref->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 = 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->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->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->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 f2ce9eb2f..90b020356 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 iv_length; uint8_t 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}, - .iv_length = AES_GCM_IV_LEN, - .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 Thu Jan 4 00:00:13 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: 123371 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp6101608edv; Wed, 3 Jan 2018 16:05:57 -0800 (PST) X-Google-Smtp-Source: ACJfBovLDtTkuO5W8E9RQAltRaeF/NZ2WgpMzW88T2nfj1LZ74hye/oPA6psZ5AInH0T8Bj6SPuY X-Received: by 10.237.37.177 with SMTP id x46mr4280504qtc.76.1515024357845; Wed, 03 Jan 2018 16:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515024357; cv=none; d=google.com; s=arc-20160816; b=Pg1xVu/rsHjYRuVLbtR7x4EU7O0G069s9hOq9B782y1+3RgJ9W89NNzBqkA1xa4lv+ b+bYbbf0xZS7WHaILc3+jDtIPejjKrZtmvKdV9ToE1yMToxkQTYnx1rZqJnEE0RwAWDL myzvfD7m+RrFXi1TYAjEK7Kafd+eBxQc0HawlhFWSjGmkkYrYt2TJQqzoXDpIrvpuFoV oaF+tF8fjw4XG5It5p06odqILxCps25tQeyuTekDR34Jwg6nyDeQbmeysOH5sWKldl+3 WNlL4LowTw3Zz4+x4s0ySd4bIv5e8iBtI8ucXkP3WxyNXVuJnhPtsec3C3D5t9CtvBVV qEJA== 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=f7i6+jWtMGjt8vn/Wm7yq/YjF2XAdVefh1plvIyb/O0=; b=lo/diFUSMWxSgCtOql/Iw87E5aSkl26MpiroHWmP5E8hqgzRi3ACdQhcUA1wpt4NVx 4PR+gssUpufIO+jl2tYzEnaOU1MHfItJHQsxGVzl11RdL/vDu78rIbwdW9h57u5TEqFk D+2zMT3XvKYvGDBXi1zCd8k2JxxZS04TtHUVj0U6fn5AuS5YQBsjN8TQJQfd1G5UdeKH FnwhdfSk223dUzf22CN4HzLVorkQACusB8AFthHVXH6TYCOyqd7LlMy8rLIZ99LpGW9W HhEL3Mw7yRft0WZdDneipVcCXOzTvfO+fWx+hFyzzwml7P3z7eng+0YD3f3cQEEbN0x9 l4uw== 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 g64si207270qka.398.2018.01.03.16.05.57; Wed, 03 Jan 2018 16:05:57 -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 6D02261508; Thu, 4 Jan 2018 00:05:57 +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, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 6BDDB614FE; Thu, 4 Jan 2018 00:01: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 D74E260960; Thu, 4 Jan 2018 00:00:28 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 9B4FE60846 for ; Thu, 4 Jan 2018 00:00:25 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 665224301B1E for ; Thu, 4 Jan 2018 03:00:24 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id BlFv0AHFEw-0IX8YaWc; Thu, 04 Jan 2018 03:00:18 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lrM9dmOAE5-0H4C3Kub; Thu, 04 Jan 2018 03:00:17 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 4 Jan 2018 03:00:13 +0300 Message-Id: <1515024013-30222-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> References: <1515024013-30222-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v5 6/6] 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: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23 **/ 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 2cf0f5c10..f42b7e182 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 { @@ -640,10 +640,10 @@ 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; - else if (session->p.cipher_iv.data) - iv_ptr = session->cipher.iv_data; + if (param->override_auth_iv_ptr) + iv_ptr = param->override_auth_iv_ptr; + else if (session->p.auth_iv.data) + iv_ptr = session->auth.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -679,10 +679,10 @@ 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; - else if (session->p.cipher_iv.data) - iv_ptr = session->cipher.iv_data; + if (param->override_auth_iv_ptr) + iv_ptr = param->override_auth_iv_ptr; + else if (session->p.auth_iv.data) + iv_ptr = session->auth.iv_data; else return ODP_CRYPTO_ALG_ERR_IV_INVALID; @@ -908,11 +908,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; @@ -1101,6 +1111,7 @@ odp_crypto_operation(odp_crypto_op_param_t *param, packet_param.session = param->session; packet_param.override_iv_ptr = param->override_iv_ptr; + packet_param.override_auth_iv_ptr = param->override_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 b023d308d..d8c8fc0f0 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->override_iv_ptr = state->iv; + param->override_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->override_iv_ptr = state->iv; + param->override_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->override_iv_ptr = state->iv; + param->override_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->override_iv_ptr = state->iv; + param->override_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;