From patchwork Mon Nov 13 14:00:30 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: 118783 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1857879qgn; Mon, 13 Nov 2017 06:26:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ+xDGS9MOxMp7MsBEfo0G5Tqbgfjlnn5sF4adn71KurmJ0O2sK7wFK1R8oJvxCYpLvSmuU X-Received: by 10.55.5.13 with SMTP id 13mr13101784qkf.11.1510583195276; Mon, 13 Nov 2017 06:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510583195; cv=none; d=google.com; s=arc-20160816; b=hTIaPCSr1e0kljSK1wVsYqgCIK/X7mJZG+KDfmHTqQy2vk30A9/cyD9QhlzJUeaPOi 1hcm4rp475aUtXRpBNKfHJe7hmaCY33gFK+4Rq+f4knqXx+ngwAQteTwwVb0nYEOyDJK MxrriFPnKAG82BlCyQjPp2T+Vjla47+vj3Ea3NMCfrrt2Qv0oBTFiTq81CVLAyXo6PRg O9nudCkW3bgysoG+hghRFG6ArdUZ9JwBHgvhtLMZqfOwcNxydRkHsYUh7Mq5eqfuBvMo ENkxIa848rrXMQ4SS3+ght3GI6rXYsEjkqbQU7JpeDf+6lAOMIbxFCIT3vivkVyW8f6B 1X5A== 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=QaH8QJ+KhTrXIEh+03spgGVEmSGwA0zjTi9sothdgU8=; b=a8sHkQ42x/c66ZMS+dtX5RFwsYfhLxhbpyeBCFu7iRtZGKLwGH8qGhB69TgqDWeZcw +pX2vvAg8bsDVYNSYjBGhxfhYPvEo16OS0lsvH9f9S7F+z13AU32XbxrEgrX9agsZScI g4sQ7868FAsG1RdEKyplCQnY3pQdSn55YEjXNPo/uPbaf/7R3E2hkHn8inuoYrxYPRpW coG6oLRhy72S0MN+GMAt2CLiPoobQ2gqv2M4WSmNx7PDy104Estw2pCI6RUCfzu0jhUg +XeFYTDFiiMm9mkk1X0jib1h2AswX9GKkCENmZlrVy0m4ac0HYWp42K9y8XsjlI28zqH GMJg== 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 w30si292141qte.219.2017.11.13.06.26.34; Mon, 13 Nov 2017 06:26: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 D5F7761052; Mon, 13 Nov 2017 14:26: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=-5.4 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 DCF016185A; Mon, 13 Nov 2017 14:03:58 +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 ED66861012; Mon, 13 Nov 2017 14:03:37 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 3E21761018 for ; Mon, 13 Nov 2017 14:00:47 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward106p.mail.yandex.net (Yandex) with ESMTP id C3D3A2D82EBC for ; Mon, 13 Nov 2017 17:00:45 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id pQkcC87oWh-0jMqSKhV; Mon, 13 Nov 2017 17:00:45 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 955rfAmciQ-0jk4akws; Mon, 13 Nov 2017 17:00: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, 13 Nov 2017 17:00:30 +0300 Message-Id: <1510581630-13993-17-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510581630-13993-1-git-send-email-odpbot@yandex.ru> References: <1510581630-13993-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 243 Subject: [lng-odp] [PATCH API-NEXT v16 16/16] validation: ipsec: add AES-CTR tests 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 243 (lumag:ipsec-packet-impl-3) ** https://github.com/Linaro/odp/pull/243 ** Patch: https://github.com/Linaro/odp/pull/243.patch ** Base sha: a908a4dead95321e84d6a8a23de060051dcd8969 ** Merge commit sha: 845914564f2d99792452ac22a524279f44496a1d **/ test/validation/api/ipsec/ipsec.c | 10 +++++++ test/validation/api/ipsec/ipsec.h | 1 + test/validation/api/ipsec/ipsec_test_in.c | 32 ++++++++++++++++++++++ test/validation/api/ipsec/ipsec_test_out.c | 44 ++++++++++++++++++++++++++++++ test/validation/api/ipsec/test_vectors.h | 39 ++++++++++++++++++++++++++ 5 files changed, 126 insertions(+) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 6c5623580..277d393ab 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -168,6 +168,10 @@ int ipsec_check(odp_bool_t ah, if (!capa.ciphers.bit.aes_cbc) return ODP_TEST_INACTIVE; break; + case ODP_CIPHER_ALG_AES_CTR: + if (!capa.ciphers.bit.aes_ctr) + return ODP_TEST_INACTIVE; + break; case ODP_CIPHER_ALG_AES_GCM: if (!capa.ciphers.bit.aes_gcm) return ODP_TEST_INACTIVE; @@ -259,6 +263,12 @@ int ipsec_check_esp_aes_cbc_128_sha256(void) ODP_AUTH_ALG_SHA256_HMAC); } +int ipsec_check_esp_aes_ctr_128_null(void) +{ + return ipsec_check_esp(ODP_CIPHER_ALG_AES_CTR, 128, + ODP_AUTH_ALG_NULL); +} + int ipsec_check_esp_aes_gcm_128(void) { return ipsec_check_esp(ODP_CIPHER_ALG_AES_GCM, 128, diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h index d1c6854b7..d45063672 100644 --- a/test/validation/api/ipsec/ipsec.h +++ b/test/validation/api/ipsec/ipsec.h @@ -83,6 +83,7 @@ int ipsec_check_ah_sha256(void); int ipsec_check_esp_null_sha256(void); int ipsec_check_esp_aes_cbc_128_null(void); int ipsec_check_esp_aes_cbc_128_sha256(void); +int ipsec_check_esp_aes_ctr_128_null(void); int ipsec_check_esp_aes_gcm_128(void); int ipsec_check_esp_aes_gcm_256(void); diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index 598a83e3f..8c883262a 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -191,6 +191,36 @@ static void test_in_esp_aes_cbc_sha256(void) ipsec_sa_destroy(sa); } +static void test_in_esp_aes_ctr_null(void) +{ + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + + ipsec_sa_param_fill(¶m, + true, false, 123, NULL, + ODP_CIPHER_ALG_AES_CTR, &key_a5_128, + ODP_AUTH_ALG_NULL, NULL, + &key_mcgrew_gcm_salt_3); + + sa = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa); + + ipsec_test_part test = { + .pkt_in = &pkt_icmp_0_esp_aes_ctr_null_1, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .pkt_out = &pkt_icmp_0 }, + }, + }; + + ipsec_check_in_one(&test, sa); + + ipsec_sa_destroy(sa); +} + static void test_in_lookup_ah_sha256(void) { odp_ipsec_sa_param_t param; @@ -987,6 +1017,8 @@ odp_testinfo_t ipsec_in_suite[] = { ipsec_check_esp_aes_cbc_128_null), ODP_TEST_INFO_CONDITIONAL(test_in_esp_aes_cbc_sha256, ipsec_check_esp_aes_cbc_128_sha256), + ODP_TEST_INFO_CONDITIONAL(test_in_esp_aes_ctr_null, + ipsec_check_esp_aes_ctr_128_null), ODP_TEST_INFO_CONDITIONAL(test_in_lookup_ah_sha256, ipsec_check_ah_sha256), ODP_TEST_INFO_CONDITIONAL(test_in_lookup_esp_null_sha256, diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 39a3c30ff..b543271bf 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -277,6 +277,48 @@ static void test_out_esp_aes_cbc_sha256(void) ipsec_sa_destroy(sa); } +static void test_out_esp_aes_ctr_null(void) +{ + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + odp_ipsec_sa_t sa2; + + ipsec_sa_param_fill(¶m, + false, false, 123, NULL, + ODP_CIPHER_ALG_AES_CTR, &key_a5_128, + ODP_AUTH_ALG_NULL, NULL, + &key_mcgrew_gcm_salt_3); + + sa = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa); + + ipsec_sa_param_fill(¶m, + true, false, 123, NULL, + ODP_CIPHER_ALG_AES_CTR, &key_a5_128, + ODP_AUTH_ALG_NULL, NULL, + &key_mcgrew_gcm_salt_3); + + sa2 = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa2); + + ipsec_test_part test = { + .pkt_in = &pkt_icmp_0, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .pkt_out = &pkt_icmp_0 }, + }, + }; + + ipsec_check_out_in_one(&test, sa, sa2); + + ipsec_sa_destroy(sa2); + ipsec_sa_destroy(sa); +} + static void test_out_esp_aes_gcm128(void) { odp_ipsec_sa_param_t param; @@ -342,6 +384,8 @@ odp_testinfo_t ipsec_out_suite[] = { ipsec_check_esp_aes_cbc_128_null), ODP_TEST_INFO_CONDITIONAL(test_out_esp_aes_cbc_sha256, ipsec_check_esp_aes_cbc_128_sha256), + ODP_TEST_INFO_CONDITIONAL(test_out_esp_aes_ctr_null, + ipsec_check_esp_aes_ctr_128_null), ODP_TEST_INFO_CONDITIONAL(test_out_esp_aes_gcm128, ipsec_check_esp_aes_gcm_128), ODP_TEST_INFO_NULL, diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h index 593a8f450..fbf7d366c 100644 --- a/test/validation/api/ipsec/test_vectors.h +++ b/test/validation/api/ipsec/test_vectors.h @@ -583,6 +583,45 @@ static const ODP_UNUSED ipsec_test_packet pkt_icmp_0_esp_aes_cbc_sha256_1 = { }, }; +static const ODP_UNUSED ipsec_test_packet pkt_icmp_0_esp_aes_ctr_null_1 = { + .len = 162, + .l2_offset = 0, + .l3_offset = 14, + .l4_offset = 34, + .data = { + /* ETH */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00, + + /* IP */ + 0x45, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x32, 0xab, 0xe2, 0xc0, 0xa8, 0x6f, 0x02, + 0xc0, 0xa8, 0xde, 0x02, + + /* ESP */ + 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x01, + + /* IV */ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + /* data */ + 0x39, 0xab, 0xe5, 0xae, 0x74, 0x57, 0x76, 0x7f, + 0x1d, 0x1f, 0xce, 0xe8, 0xca, 0xf1, 0x87, 0xf5, + 0xfd, 0x9e, 0x1d, 0x20, 0x38, 0x30, 0x8a, 0xe5, + 0xb9, 0x55, 0x80, 0x7b, 0xfd, 0x9d, 0xb9, 0x99, + 0x85, 0xcd, 0xb5, 0x30, 0x86, 0xaa, 0xe1, 0x7a, + 0x69, 0xe5, 0xfa, 0x38, 0xf3, 0x0f, 0x91, 0x18, + 0x75, 0x7b, 0x5f, 0x4e, 0x69, 0x17, 0xaa, 0xe7, + 0x84, 0x6c, 0x40, 0x31, 0xec, 0x87, 0x4c, 0x8c, + 0xb3, 0xb4, 0x9f, 0x7e, 0xea, 0x83, 0x6f, 0xc6, + 0x11, 0xd5, 0xce, 0xbe, 0x65, 0x37, 0x1c, 0xb6, + 0xd3, 0xcb, 0x51, 0xa8, 0xa4, 0x0e, 0x3e, 0xe6, + 0x26, 0xd8, 0x17, 0xec, 0x8b, 0xca, 0x79, 0x96, + 0xa0, 0xcd, 0x6f, 0xdd, 0x9e, 0xe9, 0x6a, 0xc0, + 0xf2, 0x6c, 0xdb, 0xfd, 0x99, 0xa2, 0xb5, 0xbf, + }, +}; + static const ODP_UNUSED ipsec_test_packet pkt_rfc3602_5 = { .len = 98, .l2_offset = 0,