From patchwork Mon Dec 25 23:00:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 122714 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp309867qgn; Mon, 25 Dec 2017 15:05:35 -0800 (PST) X-Google-Smtp-Source: ACJfBotDaPLmsV3J5C2njwy9MG9Zm4IJ4ETcvPjAP8j5XnPeeedtG1b81WsS/E6YIn8C1F430uip X-Received: by 10.55.131.196 with SMTP id f187mr29562558qkd.222.1514243135022; Mon, 25 Dec 2017 15:05:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514243135; cv=none; d=google.com; s=arc-20160816; b=VDYFpm7QuWfiXqLxGqDBt8+I2xfX3wOtmHDaSEI6TfYPHBkbtMPXXXAq+JLPUq7MZR Y14elU+6YkqM34+aW7Ztwo+Xpm0gqDgBmKKnqa7osD1IJ+PTfaBlLT+7JadU7XYL6Rey qeuiZY/hhe4lkqEMMw9neWQoJqi/vQm2tx4KVhfDRUmPSdZNoFKl0xn+uqi3Y7WzFWFD dNGfKxwUql9ZACt5G12osX3NPgT1gTtHuffAycf7RFqbE3SpWcpWEZqgRiAiSpBPui48 bBUfjh8V8sLVOT8W8o6Vc1/tiNNNUXi52f/i/GMjo/LhV5NNKHquGk8M0lJid4qk5z9f S0Iw== 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=eHgmD8XooW3XDxEpip/Qp5h0GUrh0DDuwdQEvCwyTuo=; b=B4rqjum1tfcwQuupcTc2YbhKkRFc/BLIX7FRZ+3VaWNbWb4k0vCRQc3Fvn94vogXNt KPaHUuG0eiMctYYWdO36vKu87i91Dl/yoOp/f9AXOEJmfipVmTD9d9ebGP/1tU8FUMof Y97O5LKstLt0x3BI36tyt7xOxK7qI5+hE9ZS/+4xBuhjBlCk1t6+PJX8cN8qPNpFrMTf 71SdqbtMsFmPNQKJVQDgrtyG+c4MmG9/yqH8DxeGaHS05oyoMlUfxM5Mtd2eHCObScWG gk4Qt5BACgf+b5J9McNz2uBif0RG526WFnJapVpm/YBMnbDzhF59K/9fdj0uHUxGljZY mJeQ== 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 m32si3074051qtk.191.2017.12.25.15.05.34; Mon, 25 Dec 2017 15:05:35 -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 AA30E60922; Mon, 25 Dec 2017 23:05:34 +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 28B44608B5; Mon, 25 Dec 2017 23:02:57 +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 61F7F608ED; Mon, 25 Dec 2017 23:02:44 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id CB1B9608FD for ; Mon, 25 Dec 2017 23:01:42 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward105o.mail.yandex.net (Yandex) with ESMTP id EE1DD44409B4 for ; Tue, 26 Dec 2017 02:01:40 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id PY5W7Exmu1-1e8OXrn7; Tue, 26 Dec 2017 02:01:40 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rho8WkqRtC-1YYu1pgm; Tue, 26 Dec 2017 02:01:34 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 26 Dec 2017 02:00:17 +0300 Message-Id: <1514242817-22123-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514242817-22123-1-git-send-email-odpbot@yandex.ru> References: <1514242817-22123-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 352 Subject: [lng-odp] [PATCH API-NEXT v3 6/6] fixup! 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 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: a5f07dbf95f982b7c5898434e56164ff976c0a0f ** Merge commit sha: 17da319d68f1b79fbec6d76e925b5d4c9665aaf3 **/ test/validation/api/crypto/odp_crypto_test_inp.c | 50 ++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 748a64dcf..d9b43c0b1 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; @@ -494,16 +503,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) @@ -1167,6 +1179,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) / @@ -1181,6 +1207,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"); @@ -1288,8 +1328,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, };