From patchwork Tue Nov 14 20:00:09 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: 118888 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3466758qgn; Tue, 14 Nov 2017 12:06:36 -0800 (PST) X-Google-Smtp-Source: AGs4zMaEGYuRTZA5ShimlTSIl6gR9XG30tnZR/Wkp2ZZ/Kn5RENCt0Z0LzkKbRCYR1F/qqNnjurT X-Received: by 10.200.46.241 with SMTP id i46mr16892620qta.248.1510689996601; Tue, 14 Nov 2017 12:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510689996; cv=none; d=google.com; s=arc-20160816; b=bEjyhg56IqS6Xxp5zj2C7rrocwYQ2r1nv5vGpWKayoQhOQbiqtb1LE5GDwnHwm6IfC 46WpCFQYWUziqw22hSfy7jAP1ryVoEWXsHQzc44R6FLSoBXtT0dumlPZtNagI+IQlIlQ yzsrTznmq5nf5GPRSZ1QCVPz+pj/ZZ3nvmXfkpmqDhmJAeocwDW0KO87uMfzSnsPat5Z kBxlddMdQBHbCS/zamhZDkkNPUUe3tRccx+UDmQ7dw0WMuBUpz75zaXmt1/DKp4ZhabV pEDXvrOdbFQzl66xAOr5VlTxNLI8KbbXouoEqn8eScZOPS0HVb4gx6SE1oTHyFV7BAba bj6Q== 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=UO3JOhz/IQ70/W2YQycHDffGV4tMAMT1fZKVTLeJ5aU=; b=xrzEjRItW3bZZBxqStpJUHGBG2620jWXJ+vzH8rEYLxyDWoY9cv+W0vTH48OiCZoWU bOpH2WO0Mc42ZeagAdj7lvmVMIl0EFa4F0i7HWp6TQO7iisTS2AtyDeAl47TK6usZXiS RxLLSWnfOQMrVI13ma7k+o0Exkuf632jofABG45Wzp+eJinQaFdR8aUCxX5TaRP5bQEm hcudd0krh55U9ZiKfWFks5NnhGz7l08/fkHyxo/YoHcTSeuxHu999S4023oyLNIIPzps G5USfUH2C7JTrxEh6RyAahkWPveGbeLp1nrAQBL9pwF/c9rbHAgho1bWX4rmp/+2nXna uH1A== 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 w36si10512034qta.214.2017.11.14.12.06.36; Tue, 14 Nov 2017 12:06:36 -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 446716072F; Tue, 14 Nov 2017 20:06:36 +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 E19576071A; Tue, 14 Nov 2017 20:01:06 +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 12FB36069A; Tue, 14 Nov 2017 20:00:30 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 8C42660654 for ; Tue, 14 Nov 2017 20:00:17 +0000 (UTC) Received: from mxback4o.mail.yandex.net (mxback4o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1e]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 40CC36A84123 for ; Tue, 14 Nov 2017 23:00:16 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback4o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dRyYWSlJqM-0GZarsci; Tue, 14 Nov 2017 23:00:16 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ZsDLds7hfB-0FpW6qDb; Tue, 14 Nov 2017 23: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: Tue, 14 Nov 2017 23:00:09 +0300 Message-Id: <1510689611-17861-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510689611-17861-1-git-send-email-odpbot@yandex.ru> References: <1510689611-17861-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 288 Subject: [lng-odp] [PATCH API-NEXT v8 8/10] validation: api: add AES-GMAC-AH testcases 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 288 (lumag:gmac) ** https://github.com/Linaro/odp/pull/288 ** Patch: https://github.com/Linaro/odp/pull/288.patch ** Base sha: ba93e355ddf151215aa18b59cbfca08fe175fe65 ** Merge commit sha: 8363c3a4073075d0f3dd68864b9a33819005aab4 **/ test/validation/api/ipsec/ipsec.c | 6 +++++ test/validation/api/ipsec/ipsec.h | 1 + test/validation/api/ipsec/ipsec_test_in.c | 32 ++++++++++++++++++++++++ test/validation/api/ipsec/ipsec_test_out.c | 32 ++++++++++++++++++++++++ test/validation/api/ipsec/test_vectors.h | 40 ++++++++++++++++++++++++++++++ 5 files changed, 111 insertions(+) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 5a267200c..7b39c2c5a 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -301,6 +301,12 @@ int ipsec_check_esp_aes_gcm_256(void) ODP_AUTH_ALG_AES_GCM, 0); } +int ipsec_check_ah_aes_gmac_128(void) +{ + return ipsec_check_esp(ODP_CIPHER_ALG_NULL, 0, + ODP_AUTH_ALG_AES_GMAC, 128); +} + int ipsec_check_esp_null_aes_gmac_128(void) { return ipsec_check_esp(ODP_CIPHER_ALG_NULL, 0, diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h index 16608fe00..9a24dd38c 100644 --- a/test/validation/api/ipsec/ipsec.h +++ b/test/validation/api/ipsec/ipsec.h @@ -87,6 +87,7 @@ 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); +int ipsec_check_ah_aes_gmac_128(void); int ipsec_check_esp_null_aes_gmac_128(void); #endif diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index 0f7148d72..294e4a5d6 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -1009,6 +1009,36 @@ static void test_in_mcgrew_gcm_15_esp(void) ipsec_sa_destroy(sa); } +static void test_in_ah_aes_gmac_128(void) +{ + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + + ipsec_sa_param_fill(¶m, + true, true, 123, NULL, + ODP_CIPHER_ALG_NULL, NULL, + ODP_AUTH_ALG_AES_GMAC, &key_a5_128, + &key_mcgrew_gcm_salt_2); + + 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_ah_aes_gmac_128_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_esp_null_aes_gmac_128(void) { odp_ipsec_sa_param_t param; @@ -1110,6 +1140,8 @@ odp_testinfo_t ipsec_in_suite[] = { ipsec_check_ah_sha256), ODP_TEST_INFO_CONDITIONAL(test_in_esp_null_sha256_bad1, ipsec_check_esp_null_sha256), + ODP_TEST_INFO_CONDITIONAL(test_in_ah_aes_gmac_128, + ipsec_check_ah_aes_gmac_128), ODP_TEST_INFO_CONDITIONAL(test_in_esp_null_aes_gmac_128, ipsec_check_esp_null_aes_gmac_128), ODP_TEST_INFO_NULL, diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index a498b663b..7d4ea4a73 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -361,6 +361,36 @@ static void test_out_esp_aes_gcm128(void) ipsec_sa_destroy(sa); } +static void test_out_ah_aes_gmac_128(void) +{ + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + + ipsec_sa_param_fill(¶m, + false, true, 123, NULL, + ODP_CIPHER_ALG_NULL, NULL, + ODP_AUTH_ALG_AES_GMAC, &key_a5_128, + &key_mcgrew_gcm_salt_2); + + 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, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .pkt_out = &pkt_icmp_0_ah_aes_gmac_128_1 }, + }, + }; + + ipsec_check_out_one(&test, sa); + + ipsec_sa_destroy(sa); +} + static void test_out_esp_null_aes_gmac_128(void) { odp_ipsec_sa_param_t param; @@ -418,6 +448,8 @@ odp_testinfo_t ipsec_out_suite[] = { 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_CONDITIONAL(test_out_ah_aes_gmac_128, + ipsec_check_ah_aes_gmac_128), ODP_TEST_INFO_CONDITIONAL(test_out_esp_null_aes_gmac_128, ipsec_check_esp_null_aes_gmac_128), ODP_TEST_INFO_NULL, diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h index 09823e632..7fb7d5a84 100644 --- a/test/validation/api/ipsec/test_vectors.h +++ b/test/validation/api/ipsec/test_vectors.h @@ -625,6 +625,46 @@ static const ODP_UNUSED ipsec_test_packet pkt_icmp_0_esp_aes_ctr_null_1 = { }, }; +static const ODP_UNUSED ipsec_test_packet pkt_icmp_0_ah_aes_gmac_128_1 = { + .len = 178, + .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, 0xa4, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x33, 0xab, 0xd1, 0xc0, 0xa8, 0x6f, 0x02, + 0xc0, 0xa8, 0xde, 0x02, + + /* AH */ + 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, + 0x00, 0x00, 0x00, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd6, 0x0e, 0xcc, 0x22, 0x31, 0x79, 0x59, 0x72, + 0x68, 0xc9, 0x58, 0xfb, 0x8b, 0xb0, 0xbb, 0xd5, + + /* ICMP */ + 0x08, 0x00, 0xfb, 0x37, 0x12, 0x34, 0x00, 0x00, + 0xba, 0xbe, 0x01, 0x23, 0x45, 0x67, 0xca, 0xfe, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, + }, +}; + static const ODP_UNUSED ipsec_test_packet pkt_icmp_0_esp_null_aes_gmac_128_1 = { .len = 178, .l2_offset = 0,