From patchwork Mon Aug 21 22:00:16 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: 110592 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1843611qge; Mon, 21 Aug 2017 15:03:06 -0700 (PDT) X-Received: by 10.55.9.20 with SMTP id 20mr24193243qkj.355.1503352986407; Mon, 21 Aug 2017 15:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503352986; cv=none; d=google.com; s=arc-20160816; b=upFeW3Wej9j0L93hFtW89pAi61UsQyttFMIzdkQBRprnJBpzLs97WLfdcNsdwNuyZb pYlyDrRxi7SyTrg4Vq+5z+WHNMaW71LTHDM9Ptycg0+BtuUBcxjxlW1NPIdUtEd4asdD x4Tuc/JKbeY3uqoWVEknawL24SYGdhXJw3+qFsK/k8iF8VC+n9DgUewUkgAfmk90DJVm 23Bq93zbWWqYULcTsDUxGw/F3SFcYULO3oeQgSwf9j/ZTEwqRyspDgfR1CO21F2EAWqX TELEbiPSDlNr+ACZRMiql4DkPUvCwozvnMhccavfRhRwO2GBSVcCYd2qNmnkC4nopDRC +fag== 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=I+y8TykX6WaTmJ2zl5MnRdgdmcHFeUf1ikKmkWUwCVs=; b=K8fN+qe3xmRXz4niW+X9YIwbxqYeGSVzNQB0vOU07rtTrnPHLwNfagDKeXVkneOqHY FRvosfjBeMwGiEwKrDsg+S3SVYeioIN8UCZTyARgy/Con39FNmpo2QWwLxwfaMqT+yVs QV9Du2kfsrWIaLLkR9fAXuRm+SSnVSlaElvDxtQz8ryJTNUXe0AHSQQrHa9dihJf3X5L Zk7pcWJBZtPoZexSwk612iotlfKqkbg+N3A4uYKiuA8J+bnAScjKW1rQebitI/UiPSgg jIlUgZL+4ABmKZEfwhRX+ZVTuFzEs3mCYeFy7OseMx4XA6CMhIOgkoJjSbRNLIzU7zdS r5uQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id x23si3598181qkb.255.2017.08.21.15.03.06; Mon, 21 Aug 2017 15:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 01A9664499; Mon, 21 Aug 2017 22:03:05 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 C954B6448F; Mon, 21 Aug 2017 22:01:43 +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 E638B60CE5; Mon, 21 Aug 2017 22:01:33 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 67FB9644A3 for ; Mon, 21 Aug 2017 22:00:23 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward100j.mail.yandex.net (Yandex) with ESMTP id CB7EB5D83AD5 for ; Tue, 22 Aug 2017 01:00:21 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id m6yRdBG1nx-0LiSRbQA; Tue, 22 Aug 2017 01:00:21 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1rAWfL7pdM-0Lh07UQI; Tue, 22 Aug 2017 01:00:21 +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, 22 Aug 2017 01:00:16 +0300 Message-Id: <1503352817-2136-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503352817-2136-1-git-send-email-odpbot@yandex.ru> References: <1503352817-2136-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 94 Subject: [lng-odp] [PATCH API-NEXT v5 2/3] validation: crypto: add AES-192/256 test cases 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 Add testcases for AES192-CBC, AES256-CBC, AES128-GCM, AES256-GCM. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 94 (lumag:crypto-long-keys) ** https://github.com/Linaro/odp/pull/94 ** Patch: https://github.com/Linaro/odp/pull/94.patch ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c ** Merge commit sha: 639b51978ac4cd2c4db537873fee719de65e575b **/ test/common_plat/validation/api/crypto/crypto.h | 16 +-- .../validation/api/crypto/odp_crypto_test_inp.c | 80 ++++++------- .../validation/api/crypto/test_vectors.h | 124 ++++++++++++++++++--- .../validation/api/crypto/test_vectors_len.h | 22 +++- 4 files changed, 177 insertions(+), 65 deletions(-) diff --git a/test/common_plat/validation/api/crypto/crypto.h b/test/common_plat/validation/api/crypto/crypto.h index dd15b448..71f862ec 100644 --- a/test/common_plat/validation/api/crypto/crypto.h +++ b/test/common_plat/validation/api/crypto/crypto.h @@ -16,14 +16,14 @@ 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_aes128_cbc(void); -void crypto_test_enc_alg_aes128_cbc_ovr_iv(void); -void crypto_test_dec_alg_aes128_cbc(void); -void crypto_test_dec_alg_aes128_cbc_ovr_iv(void); -void crypto_test_enc_alg_aes128_gcm(void); -void crypto_test_enc_alg_aes128_gcm_ovr_iv(void); -void crypto_test_dec_alg_aes128_gcm(void); -void crypto_test_dec_alg_aes128_gcm_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_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); diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c index 5b41e2ba..d08beaa3 100644 --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c @@ -707,17 +707,17 @@ 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_aes128_gcm(void) +void crypto_test_enc_alg_aes_gcm(void) { - unsigned int test_vec_num = (sizeof(aes128_gcm_reference) / - sizeof(aes128_gcm_reference[0])); + unsigned int test_vec_num = (sizeof(aes_gcm_reference) / + sizeof(aes_gcm_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_ENCODE, ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM, - &aes128_gcm_reference[i], + &aes_gcm_reference[i], false); } } @@ -726,17 +726,17 @@ void crypto_test_enc_alg_aes128_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_aes128_gcm_ovr_iv(void) +void crypto_test_enc_alg_aes_gcm_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(aes128_gcm_reference) / - sizeof(aes128_gcm_reference[0])); + unsigned int test_vec_num = (sizeof(aes_gcm_reference) / + sizeof(aes_gcm_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_ENCODE, ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM, - &aes128_gcm_reference[i], + &aes_gcm_reference[i], true); } } @@ -746,17 +746,17 @@ void crypto_test_enc_alg_aes128_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_aes128_gcm(void) +void crypto_test_dec_alg_aes_gcm(void) { - unsigned int test_vec_num = (sizeof(aes128_gcm_reference) / - sizeof(aes128_gcm_reference[0])); + unsigned int test_vec_num = (sizeof(aes_gcm_reference) / + sizeof(aes_gcm_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_DECODE, ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM, - &aes128_gcm_reference[i], + &aes_gcm_reference[i], false); } } @@ -766,17 +766,17 @@ void crypto_test_dec_alg_aes128_gcm(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes128_gcm_ovr_iv(void) +void crypto_test_dec_alg_aes_gcm_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(aes128_gcm_reference) / - sizeof(aes128_gcm_reference[0])); + unsigned int test_vec_num = (sizeof(aes_gcm_reference) / + sizeof(aes_gcm_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_DECODE, ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM, - &aes128_gcm_reference[i], + &aes_gcm_reference[i], true); } } @@ -790,17 +790,17 @@ 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_aes128_cbc(void) +void crypto_test_enc_alg_aes_cbc(void) { - unsigned int test_vec_num = (sizeof(aes128_cbc_reference) / - sizeof(aes128_cbc_reference[0])); + unsigned int test_vec_num = (sizeof(aes_cbc_reference) / + sizeof(aes_cbc_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_ENCODE, ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL, - &aes128_cbc_reference[i], + &aes_cbc_reference[i], false); } } @@ -808,17 +808,17 @@ void crypto_test_enc_alg_aes128_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_aes128_cbc_ovr_iv(void) +void crypto_test_enc_alg_aes_cbc_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(aes128_cbc_reference) / - sizeof(aes128_cbc_reference[0])); + unsigned int test_vec_num = (sizeof(aes_cbc_reference) / + sizeof(aes_cbc_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_ENCODE, ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL, - &aes128_cbc_reference[i], + &aes_cbc_reference[i], true); } } @@ -828,17 +828,17 @@ void crypto_test_enc_alg_aes128_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_aes128_cbc(void) +void crypto_test_dec_alg_aes_cbc(void) { - unsigned int test_vec_num = (sizeof(aes128_cbc_reference) / - sizeof(aes128_cbc_reference[0])); + unsigned int test_vec_num = (sizeof(aes_cbc_reference) / + sizeof(aes_cbc_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_DECODE, ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL, - &aes128_cbc_reference[i], + &aes_cbc_reference[i], false); } } @@ -848,17 +848,17 @@ void crypto_test_dec_alg_aes128_cbc(void) * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer. * */ -void crypto_test_dec_alg_aes128_cbc_ovr_iv(void) +void crypto_test_dec_alg_aes_cbc_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(aes128_cbc_reference) / - sizeof(aes128_cbc_reference[0])); + unsigned int test_vec_num = (sizeof(aes_cbc_reference) / + sizeof(aes_cbc_reference[0])); unsigned int i; for (i = 0; i < test_vec_num; i++) { alg_test(ODP_CRYPTO_OP_DECODE, ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL, - &aes128_cbc_reference[i], + &aes_cbc_reference[i], true); } } @@ -1088,21 +1088,21 @@ odp_testinfo_t crypto_suite[] = { check_alg_3des_cbc), ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_3des_cbc_ovr_iv, check_alg_3des_cbc), - ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes128_cbc, + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_cbc, check_alg_aes_cbc), - ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes128_cbc, + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes_cbc, check_alg_aes_cbc), - ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes128_cbc_ovr_iv, + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_cbc_ovr_iv, check_alg_aes_cbc), - ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes128_cbc_ovr_iv, + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes_cbc_ovr_iv, check_alg_aes_cbc), - ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes128_gcm, + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_gcm, check_alg_aes_gcm), - ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes128_gcm_ovr_iv, + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_gcm_ovr_iv, check_alg_aes_gcm), - ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes128_gcm, + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes_gcm, check_alg_aes_gcm), - ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes128_gcm_ovr_iv, + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes_gcm_ovr_iv, check_alg_aes_gcm), ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_hmac_md5, check_alg_hmac_md5), diff --git a/test/common_plat/validation/api/crypto/test_vectors.h b/test/common_plat/validation/api/crypto/test_vectors.h index f9ca9eb5..652968be 100644 --- a/test/common_plat/validation/api/crypto/test_vectors.h +++ b/test/common_plat/validation/api/crypto/test_vectors.h @@ -70,12 +70,12 @@ static crypto_test_reference_t tdes_cbc_reference[] = { } }; -static crypto_test_reference_t aes128_cbc_reference[] = { +static crypto_test_reference_t aes_cbc_reference[] = { { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b, 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06}, - .iv_length = AES128_CBC_IV_LEN, + .iv_length = AES_CBC_IV_LEN, .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, .length = 16, @@ -87,7 +87,7 @@ static crypto_test_reference_t aes128_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a}, - .iv_length = AES128_CBC_IV_LEN, + .iv_length = AES_CBC_IV_LEN, .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, .length = 32, @@ -104,7 +104,7 @@ static crypto_test_reference_t aes128_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0x6c, 0x3e, 0xa0, 0x47, 0x76, 0x30, 0xce, 0x21, 0xa2, 0xce, 0x33, 0x4a, 0xa7, 0x46, 0xc2, 0xcd}, - .iv_length = AES128_CBC_IV_LEN, + .iv_length = AES_CBC_IV_LEN, .iv = { 0xc7, 0x82, 0xdc, 0x4c, 0x09, 0x8c, 0x66, 0xcb, 0xd9, 0xcd, 0x27, 0xd8, 0x25, 0x68, 0x2c, 0x81 }, .length = 48, @@ -120,7 +120,7 @@ static crypto_test_reference_t aes128_cbc_reference[] = { .cipher_key_length = AES128_CBC_KEY_LEN, .cipher_key = { 0x56, 0xe4, 0x7a, 0x38, 0xc5, 0x59, 0x89, 0x74, 0xbc, 0x46, 0x90, 0x3d, 0xba, 0x29, 0x03, 0x49}, - .iv_length = AES128_CBC_IV_LEN, + .iv_length = AES_CBC_IV_LEN, .iv = { 0x8c, 0xe8, 0x2e, 0xef, 0xbe, 0xa0, 0xda, 0x3c, 0x44, 0x69, 0x9e, 0xd7, 0xdb, 0x51, 0xb7, 0xd9 }, .length = 64, @@ -140,18 +140,59 @@ static crypto_test_reference_t aes128_cbc_reference[] = { 0x86, 0x8b, 0xb7, 0xb2, 0x9d, 0x3d, 0x46, 0xad, 0x83, 0xce, 0x9f, 0x9a, 0x10, 0x2e, 0xe9, 0x9d, 0x49, 0xa5, 0x3e, 0x87, 0xf4, 0xc3, 0xda, 0x55 } + }, + { + .cipher_key_length = AES192_CBC_KEY_LEN, + .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c}, + .iv_length = AES_CBC_IV_LEN, + .iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88, 0x01, 0x23, 0x45, 0x67 }, + .length = 32, + .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00, + 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f, + 0x0a, 0x01, 0x06, 0x12, 0x80, 0x23, 0x06, 0xb8, + 0xcb, 0x71, 0x26, 0x02, 0xdd, 0x6b, 0xb0, 0x3e }, + .ciphertext = { 0x0d, 0xbe, 0x02, 0xda, 0x68, 0x9c, 0x8f, 0x30, + 0xce, 0x7c, 0x91, 0x7d, 0x41, 0x08, 0xf6, 0xf1, + 0x8e, 0x0d, 0x7f, 0x02, 0xb6, 0x80, 0x9a, 0x2d, + 0x53, 0x1c, 0xc6, 0x98, 0x85, 0xc3, 0x00, 0xe6}, + }, + { + .cipher_key_length = AES256_CBC_KEY_LEN, + .cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23, + 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, + 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23, + 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab}, + .iv_length = AES_CBC_IV_LEN, + .iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, + 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c }, + .length = 48, + .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00, + 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02, + 0x93, 0x89, 0x15, 0x5e, 0x0a, 0x9e, 0x00, 0x8b, + 0x2d, 0xc5, 0x7e, 0xe0, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x02, 0x40, 0x00, 0x20, 0xbf, 0x00, 0x00, + 0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02 }, + .ciphertext = { 0x92, 0x1e, 0x2f, 0x37, 0x36, 0x3c, 0x45, 0xda, + 0xc9, 0x58, 0xb7, 0x07, 0x06, 0x56, 0x54, 0xc5, + 0x93, 0x46, 0x90, 0xb8, 0xcf, 0x0d, 0x4f, 0x79, + 0xf1, 0x32, 0xc2, 0xf7, 0x23, 0xb8, 0x83, 0x09, + 0xbc, 0x37, 0x1c, 0xeb, 0x95, 0x2c, 0x42, 0x7b, + 0x39, 0x10, 0xa8, 0x76, 0xfa, 0xbe, 0x91, 0xe9}, } }; /* AES-GCM test vectors extracted from * https://tools.ietf.org/html/draft-mcgrew-gcm-test-01#section-2 */ -static crypto_test_reference_t aes128_gcm_reference[] = { +static crypto_test_reference_t aes_gcm_reference[] = { { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda, 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34}, - .iv_length = AES128_GCM_IV_LEN, + .iv_length = AES_GCM_IV_LEN, .iv = { 0x2e, 0x44, 0x3b, 0x68, 0x49, 0x56, 0xed, 0x7e, 0x3b, 0x24, 0x4c, 0xfe }, .length = 72, @@ -176,7 +217,7 @@ static crypto_test_reference_t aes128_gcm_reference[] = { .aad_length = 12, .aad = { 0x00, 0x00, 0x43, 0x21, 0x87, 0x65, 0x43, 0x21, 0x00, 0x00, 0x00, 0x00 }, - .digest_length = AES128_GCM_DIGEST_LEN, + .digest_length = AES_GCM_DIGEST_LEN, .digest = { 0x45, 0x90, 0x18, 0x14, 0x8f, 0x6c, 0xbe, 0x72, 0x2f, 0xd0, 0x47, 0x96, 0x56, 0x2d, 0xfd, 0xb4 } }, @@ -184,7 +225,7 @@ static crypto_test_reference_t aes128_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08}, - .iv_length = AES128_GCM_IV_LEN, + .iv_length = AES_GCM_IV_LEN, .iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88 }, .length = 64, @@ -206,7 +247,7 @@ static crypto_test_reference_t aes128_gcm_reference[] = { 0xec, 0x3b, 0x9b, 0xa9, 0x5d, 0x91, 0x8b, 0xd1}, .aad_length = 8, .aad = { 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a }, - .digest_length = AES128_GCM_DIGEST_LEN, + .digest_length = AES_GCM_DIGEST_LEN, .digest = { 0x83, 0xb7, 0x0d, 0x3a, 0xa8, 0xbc, 0x6e, 0xe4, 0xc3, 0x09, 0xe9, 0xd8, 0x5a, 0x41, 0xad, 0x4a } }, @@ -214,7 +255,7 @@ static crypto_test_reference_t aes128_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - .iv_length = AES128_GCM_IV_LEN, + .iv_length = AES_GCM_IV_LEN, .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, .length = 64, @@ -236,7 +277,7 @@ static crypto_test_reference_t aes128_gcm_reference[] = { 0x1d, 0x19, 0xd4, 0xd5, 0xc8, 0xc1, 0x8a, 0xf3}, .aad_length = 8, .aad = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, - .digest_length = AES128_GCM_DIGEST_LEN, + .digest_length = AES_GCM_DIGEST_LEN, .digest = { 0xf8, 0x21, 0xd4, 0x96, 0xee, 0xb0, 0x96, 0xe9, 0x8a, 0xd2, 0xb6, 0x9e, 0x47, 0x99, 0xc7, 0x1d } }, @@ -244,7 +285,7 @@ static crypto_test_reference_t aes128_gcm_reference[] = { .cipher_key_length = AES128_GCM_KEY_LEN, .cipher_key = { 0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60, 0x7e, 0xae, 0x1f}, - .iv_length = AES128_GCM_IV_LEN, + .iv_length = AES_GCM_IV_LEN, .iv = { 0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00, 0xa2, 0xfc, 0xa1, 0xa3 }, .length = 28, @@ -259,10 +300,65 @@ static crypto_test_reference_t aes128_gcm_reference[] = { .aad_length = 12, .aad = { 0x42, 0xf6, 0x7e, 0x3f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }, - .digest_length = AES128_GCM_DIGEST_LEN, + .digest_length = AES_GCM_DIGEST_LEN, .digest = { 0x36, 0x9f, 0x07, 0x1f, 0x35, 0xe0, 0x34, 0xbe, 0x95, 0xf1, 0x12, 0xe4, 0xe7, 0xd0, 0x5d, 0x35 } }, + { + .cipher_key_length = AES192_GCM_KEY_LEN, + .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c}, + .iv_length = AES_GCM_IV_LEN, + .iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 }, + .length = 40, + .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00, + 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f, + 0x0a, 0x01, 0x06, 0x12, 0x80, 0x23, 0x06, 0xb8, + 0xcb, 0x71, 0x26, 0x02, 0xdd, 0x6b, 0xb0, 0x3e, + 0x50, 0x10, 0x16, 0xd0, 0x75, 0x68, 0x00, 0x01 }, + .ciphertext = { 0xa5, 0xb1, 0xf8, 0x06, 0x60, 0x29, 0xae, 0xa4, + 0x0e, 0x59, 0x8b, 0x81, 0x22, 0xde, 0x02, 0x42, + 0x09, 0x38, 0xb3, 0xab, 0x33, 0xf8, 0x28, 0xe6, + 0x87, 0xb8, 0x85, 0x8b, 0x5b, 0xfb, 0xdb, 0xd0, + 0x31, 0x5b, 0x27, 0x45, 0x21, 0x44, 0xcc, 0x77}, + .aad_length = 8, + .aad = { 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a }, + .digest_length = AES_GCM_DIGEST_LEN, + .digest = { 0x95, 0x45, 0x7b, 0x96, 0x52, 0x03, 0x7f, 0x53, + 0x18, 0x02, 0x7b, 0x5b, 0x4c, 0xd7, 0xa6, 0x36 } + }, + { + .cipher_key_length = AES256_GCM_KEY_LEN, + .cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23, + 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, + 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23, + 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab}, + .iv_length = AES_GCM_IV_LEN, + .iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08 }, + .length = 52, + .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00, + 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02, + 0x93, 0x89, 0x15, 0x5e, 0x0a, 0x9e, 0x00, 0x8b, + 0x2d, 0xc5, 0x7e, 0xe0, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x02, 0x40, 0x00, 0x20, 0xbf, 0x00, 0x00, + 0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02, + 0x01, 0x02, 0x02, 0x01 }, + .ciphertext = { 0xff, 0x42, 0x5c, 0x9b, 0x72, 0x45, 0x99, 0xdf, + 0x7a, 0x3b, 0xcd, 0x51, 0x01, 0x94, 0xe0, 0x0d, + 0x6a, 0x78, 0x10, 0x7f, 0x1b, 0x0b, 0x1c, 0xbf, + 0x06, 0xef, 0xae, 0x9d, 0x65, 0xa5, 0xd7, 0x63, + 0x74, 0x8a, 0x63, 0x79, 0x85, 0x77, 0x1d, 0x34, + 0x7f, 0x05, 0x45, 0x65, 0x9f, 0x14, 0xe9, 0x9d, + 0xef, 0x84, 0x2d, 0x8e }, + .aad_length = 8, + .aad = { 0x4a, 0x2c, 0xbf, 0xe3, 0x00, 0x00, 0x00, 0x02 }, + .digest_length = AES_GCM_DIGEST_LEN, + .digest = { 0xb3, 0x35, 0xf4, 0xee, 0xcf, 0xdb, 0xf8, 0x31, + 0x82, 0x4b, 0x4c, 0x49, 0x15, 0x95, 0x6c, 0x96 } + } }; static crypto_test_reference_t hmac_md5_reference[] = { diff --git a/test/common_plat/validation/api/crypto/test_vectors_len.h b/test/common_plat/validation/api/crypto/test_vectors_len.h index 427c564b..b1ce719e 100644 --- a/test/common_plat/validation/api/crypto/test_vectors_len.h +++ b/test/common_plat/validation/api/crypto/test_vectors_len.h @@ -17,14 +17,30 @@ #define TDES_CBC_KEY_LEN 24 #define TDES_CBC_IV_LEN 8 +/* AES-CBC common */ +#define AES_CBC_IV_LEN 16 + /* AES128-CBC */ #define AES128_CBC_KEY_LEN 16 -#define AES128_CBC_IV_LEN 16 + +/* AES192-CBC */ +#define AES192_CBC_KEY_LEN 24 + +/* AES256-CBC */ +#define AES256_CBC_KEY_LEN 32 + +/* AES-GCM common */ +#define AES_GCM_IV_LEN 12 +#define AES_GCM_DIGEST_LEN 16 /* AES128-GCM */ #define AES128_GCM_KEY_LEN 16 -#define AES128_GCM_IV_LEN 12 -#define AES128_GCM_DIGEST_LEN 16 + +/* AES192-GCM */ +#define AES192_GCM_KEY_LEN 24 + +/* AES256-GCM */ +#define AES256_GCM_KEY_LEN 32 /* HMAC-MD5 */ #define HMAC_MD5_KEY_LEN 16