From patchwork Mon Dec 25 17:00:08 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: 122699 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp62739qgn; Mon, 25 Dec 2017 09:03:41 -0800 (PST) X-Google-Smtp-Source: ACJfBovVpiKCgsk92avR3ZhhRqjc8gLRfnjvZHdaiqNw63Tcv81MHysjXiZflTdhhIQxwyxxsadc X-Received: by 10.200.46.233 with SMTP id i38mr13132548qta.109.1514221421528; Mon, 25 Dec 2017 09:03:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514221421; cv=none; d=google.com; s=arc-20160816; b=K/7ChBvGUt+q5YPG5txTSn1cxVi2zPaCeNe+iN976+Dx28T4Ans2vmpG22vb3VaaxK t0axR+gjplCBI3ilOeYOL/cVeyo4jH+GOul7IvMmgj7AdpSG3XzTIt4YoRNtwo3hHQUw fknvT4UZcT2LtJM8wVp8lGTCB9r1uE2NxyxLu9W6gm8WyxzIMVQ3a3d8vIrmGL92lezv ysN4mgUNbFzsHOSsE0lhLN9KEnEdJvs3/6zT6gYhkNnu4yfgLeb8XoqqZTdUSI/Lo06z GwrPyZSLLZCll0uxo1T0FwHepbcvtdpb4RQuxnYHvr2gLIW/+T5h0WP/2bQCFMejMJHP +F4w== 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=8fFKjgL3SyN5g9tU4G6p64mKYaOPNgVEiYzlufvR8pI=; b=a/HOlk5qe50HMqSKYDmq+MU4uJvJfplR4o20FcHkfEr8fsg2yqYtu9DUyFscP799Q4 UcX4mTrNYTJ806NwcQzT45ebmLkqESJXNAtgGbtil8n67Gb07HrDoWJssH+vPLxxY/HI kz3BIlJg7OmxPUVnBXlWF7gCMU3/FMiPbTaFLkQG69x5yAMKTopEPc58zGZpcKJznf8o 8+AWPq/4Q22H2A5wEjAf9J/sNTj7+WyyHnEP+uQmeALvOm15YBtxBHJkguq2C/x8gGmq zv0c9YUZbzb/C07Eqb966PANtImXlB+9I7U4jScMiOyFnTkGQJxJzyCF+FeLCKHjA5I9 42Uw== 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 n65si3309283qkd.365.2017.12.25.09.03.41; Mon, 25 Dec 2017 09:03:41 -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 2FD8E6096F; Mon, 25 Dec 2017 17:03:41 +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 5B0E16090D; Mon, 25 Dec 2017 17:00:49 +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 3C6BF6085F; Mon, 25 Dec 2017 17:00:27 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 2F1EA6038C for ; Mon, 25 Dec 2017 17:00:16 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 4ACBA6A820BE for ; Mon, 25 Dec 2017 20:00:14 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hjC4W205GO-0EOS1aob; Mon, 25 Dec 2017 20:00:14 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id eIe5mGadxk-0DtCMvSQ; Mon, 25 Dec 2017 20:00:13 +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, 25 Dec 2017 20:00:08 +0300 Message-Id: <1514221211-7675-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> References: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 367 Subject: [lng-odp] [PATCH API-NEXT v1 1/4] validation: crypto: print untested capabilities 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 Print all capability variants that were not covered by reference tests. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 367 (lumag:crypto-untested) ** https://github.com/Linaro/odp/pull/367 ** Patch: https://github.com/Linaro/odp/pull/367.patch ** Base sha: a5f07dbf95f982b7c5898434e56164ff976c0a0f ** Merge commit sha: 0f2debefe973066bf83f4d93a551f16f758b0c14 **/ test/validation/api/crypto/odp_crypto_test_inp.c | 712 ++++++++++------------- 1 file changed, 317 insertions(+), 395 deletions(-) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index f1da6989c..48a1c3a5c 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -299,14 +299,11 @@ static void alg_test(odp_crypto_op_t op, odp_bool_t ovr_iv) { odp_crypto_session_t session; - odp_crypto_capability_t capa; int rc; odp_crypto_ses_create_err_t status; odp_bool_t ok = false; int iteration; odp_crypto_session_param_t ses_params; - odp_crypto_cipher_capability_t cipher_capa[MAX_ALG_CAPA]; - odp_crypto_auth_capability_t auth_capa[MAX_ALG_CAPA]; odp_packet_data_range_t cipher_range; odp_packet_data_range_t auth_range; odp_crypto_key_t cipher_key = { @@ -321,111 +318,6 @@ static void alg_test(odp_crypto_op_t op, .data = ovr_iv ? NULL : ref->iv, .length = ref->iv_length }; - int num, i; - int found; - - rc = odp_crypto_capability(&capa); - CU_ASSERT(!rc); - - if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC && - !(capa.ciphers.bit.trides_cbc)) - rc = -1; - if (cipher_alg == ODP_CIPHER_ALG_AES_CBC && - !(capa.ciphers.bit.aes_cbc)) - rc = -1; - if (cipher_alg == ODP_CIPHER_ALG_AES_CTR && - !(capa.ciphers.bit.aes_ctr)) - rc = -1; - if (cipher_alg == ODP_CIPHER_ALG_AES_GCM && - !(capa.ciphers.bit.aes_gcm)) - rc = -1; - if (cipher_alg == ODP_CIPHER_ALG_DES && - !(capa.ciphers.bit.des)) - rc = -1; - if (cipher_alg == ODP_CIPHER_ALG_NULL && - !(capa.ciphers.bit.null)) - rc = -1; - - CU_ASSERT(!rc); - CU_ASSERT((~capa.ciphers.all_bits & capa.hw_ciphers.all_bits) == 0); - - if (auth_alg == ODP_AUTH_ALG_AES_GCM && - !(capa.auths.bit.aes_gcm)) - rc = -1; - if (auth_alg == ODP_AUTH_ALG_AES_GMAC && - !(capa.auths.bit.aes_gmac)) - rc = -1; - if (auth_alg == ODP_AUTH_ALG_MD5_HMAC && - !(capa.auths.bit.md5_hmac)) - rc = -1; - if (auth_alg == ODP_AUTH_ALG_NULL && - !(capa.auths.bit.null)) - rc = -1; - if (auth_alg == ODP_AUTH_ALG_SHA1_HMAC && - !(capa.auths.bit.sha1_hmac)) - rc = -1; - if (auth_alg == ODP_AUTH_ALG_SHA256_HMAC && - !(capa.auths.bit.sha256_hmac)) - rc = -1; - if (auth_alg == ODP_AUTH_ALG_SHA512_HMAC && - !(capa.auths.bit.sha512_hmac)) - rc = -1; - - CU_ASSERT(!rc); - CU_ASSERT((~capa.auths.all_bits & capa.hw_auths.all_bits) == 0); - - num = odp_crypto_cipher_capability(cipher_alg, cipher_capa, - MAX_ALG_CAPA); - - CU_ASSERT(num > 0); - found = 0; - - CU_ASSERT(num <= MAX_ALG_CAPA); - - if (num > MAX_ALG_CAPA) - num = MAX_ALG_CAPA; - - /* Search for the test case */ - for (i = 0; i < num; i++) { - if (cipher_capa[i].key_len == cipher_key.length && - cipher_capa[i].iv_len == iv.length) { - found = 1; - break; - } - } - - if (!found) { - printf("\n Unsupported: alg=%s, key_len=%" PRIu32 ", " - "iv_len=%" PRIu32 "\n", cipher_alg_name(cipher_alg), - cipher_key.length, iv.length); - return; - } - - num = odp_crypto_auth_capability(auth_alg, auth_capa, MAX_ALG_CAPA); - - CU_ASSERT(num > 0); - found = 0; - - CU_ASSERT(num <= MAX_ALG_CAPA); - - if (num > MAX_ALG_CAPA) - num = MAX_ALG_CAPA; - - /* Search for the test case */ - for (i = 0; i < num; i++) { - if (auth_capa[i].digest_len == ref->digest_length && - auth_capa[i].key_len == auth_key.length) { - found = 1; - break; - } - } - - 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); - return; - } /* Create a crypto session */ odp_crypto_session_param_init(&ses_params); @@ -529,6 +421,154 @@ static void alg_test(odp_crypto_op_t op, odp_packet_free(pkt); } +static void check_alg(odp_crypto_op_t op, + odp_cipher_alg_t cipher_alg, + odp_auth_alg_t auth_alg, + crypto_test_reference_t *ref, + size_t count, + odp_bool_t ovr_iv) +{ + odp_crypto_capability_t capa; + odp_crypto_cipher_capability_t cipher_capa[MAX_ALG_CAPA]; + odp_crypto_auth_capability_t auth_capa[MAX_ALG_CAPA]; + int rc, cipher_num, auth_num, i; + odp_bool_t cipher_tested[MAX_ALG_CAPA]; + odp_bool_t auth_tested[MAX_ALG_CAPA]; + size_t idx; + + rc = odp_crypto_capability(&capa); + CU_ASSERT(!rc); + + if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC && + !(capa.ciphers.bit.trides_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES_CBC && + !(capa.ciphers.bit.aes_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES_CTR && + !(capa.ciphers.bit.aes_ctr)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES_GCM && + !(capa.ciphers.bit.aes_gcm)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_DES && + !(capa.ciphers.bit.des)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_NULL && + !(capa.ciphers.bit.null)) + rc = -1; + + CU_ASSERT(!rc); + CU_ASSERT((~capa.ciphers.all_bits & capa.hw_ciphers.all_bits) == 0); + + if (auth_alg == ODP_AUTH_ALG_AES_GCM && + !(capa.auths.bit.aes_gcm)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_AES_GMAC && + !(capa.auths.bit.aes_gmac)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_MD5_HMAC && + !(capa.auths.bit.md5_hmac)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_NULL && + !(capa.auths.bit.null)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_SHA1_HMAC && + !(capa.auths.bit.sha1_hmac)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_SHA256_HMAC && + !(capa.auths.bit.sha256_hmac)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_SHA512_HMAC && + !(capa.auths.bit.sha512_hmac)) + rc = -1; + + CU_ASSERT(!rc); + CU_ASSERT((~capa.auths.all_bits & capa.hw_auths.all_bits) == 0); + + cipher_num = odp_crypto_cipher_capability(cipher_alg, cipher_capa, + MAX_ALG_CAPA); + + CU_ASSERT(cipher_num > 0); + CU_ASSERT(cipher_num <= MAX_ALG_CAPA); + if (cipher_num > MAX_ALG_CAPA) + cipher_num = MAX_ALG_CAPA; + + auth_num = odp_crypto_auth_capability(auth_alg, auth_capa, + MAX_ALG_CAPA); + + CU_ASSERT(auth_num > 0); + CU_ASSERT(auth_num <= MAX_ALG_CAPA); + if (auth_num > MAX_ALG_CAPA) + auth_num = MAX_ALG_CAPA; + + memset(cipher_tested, 0, sizeof(cipher_tested)); + memset(auth_tested, 0, sizeof(auth_tested)); + + for (idx = 0; idx < count; idx++) { + int cipher_idx = -1, auth_idx = -1; + + for (i = 0; i < cipher_num; i++) { + if (cipher_capa[i].key_len == + ref[idx].cipher_key_length && + cipher_capa[i].iv_len == + ref[idx].iv_length) { + cipher_idx = i; + break; + } + } + + if (cipher_idx < 0) { + printf("\n Unsupported: alg=%s, key_len=%" PRIu32 + ", iv_len=%" PRIu32 "\n", + cipher_alg_name(cipher_alg), + ref[idx].cipher_key_length, + ref[idx].iv_length); + continue; + } + + for (i = 0; i < auth_num; i++) { + if (auth_capa[i].digest_len == + ref[idx].digest_length && + auth_capa[i].key_len == + ref[idx].auth_key_length) { + auth_idx = i; + break; + } + } + + if (auth_idx < 0) { + printf("\n Unsupported: alg=%s, key_len=%" PRIu32 + ", digest_len=%" PRIu32 "\n", + auth_alg_name(auth_alg), + ref[idx].auth_key_length, + ref[idx].digest_length); + continue; + } + + alg_test(op, cipher_alg, auth_alg, &ref[idx], ovr_iv); + + cipher_tested[cipher_idx] = true; + auth_tested[auth_idx] = true; + } + + for (i = 0; i < cipher_num; i++) + if (!cipher_tested[i]) + printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " + "iv_len=%" PRIu32 "\n", + cipher_alg_name(cipher_alg), + cipher_capa[i].key_len, + cipher_capa[i].iv_len); + + for (i = 0; i < auth_num; i++) + if (!auth_tested[i]) + printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " + "digest_len=%" PRIu32 "\n", + auth_alg_name(auth_alg), + auth_capa[i].key_len, + auth_capa[i].digest_len); +} + /** * Check if given cipher and authentication algorithms are supported * @@ -628,32 +668,25 @@ static int check_alg_null(void) return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_NULL); } +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) void crypto_test_enc_alg_null(void) { - unsigned int test_vec_num = (sizeof(null_reference) / - sizeof(null_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_NULL, - &null_reference[i], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_NULL, + null_reference, + ARRAY_SIZE(null_reference), + false); } void crypto_test_dec_alg_null(void) { - unsigned int test_vec_num = (sizeof(null_reference) / - sizeof(null_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_NULL, - &null_reference[i], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_NULL, + null_reference, + ARRAY_SIZE(null_reference), + false); } static int check_alg_3des_cbc(void) @@ -667,16 +700,12 @@ static int check_alg_3des_cbc(void) * packet buffer as completion event buffer.*/ void crypto_test_enc_alg_3des_cbc(void) { - unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / - sizeof(tdes_cbc_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) - alg_test(ODP_CRYPTO_OP_ENCODE, - ODP_CIPHER_ALG_3DES_CBC, - ODP_AUTH_ALG_NULL, - &tdes_cbc_reference[i], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_3DES_CBC, + ODP_AUTH_ALG_NULL, + tdes_cbc_reference, + ARRAY_SIZE(tdes_cbc_reference), + false); } /* This test verifies the correctness of encode (plaintext -> ciphertext) @@ -684,16 +713,12 @@ void crypto_test_enc_alg_3des_cbc(void) * */ void crypto_test_enc_alg_3des_cbc_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / - sizeof(tdes_cbc_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) - alg_test(ODP_CRYPTO_OP_ENCODE, - ODP_CIPHER_ALG_3DES_CBC, - ODP_AUTH_ALG_NULL, - &tdes_cbc_reference[i], - true); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_3DES_CBC, + ODP_AUTH_ALG_NULL, + tdes_cbc_reference, + ARRAY_SIZE(tdes_cbc_reference), + true); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -703,16 +728,12 @@ void crypto_test_enc_alg_3des_cbc_ovr_iv(void) * */ void crypto_test_dec_alg_3des_cbc(void) { - unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / - sizeof(tdes_cbc_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) - alg_test(ODP_CRYPTO_OP_DECODE, - ODP_CIPHER_ALG_3DES_CBC, - ODP_AUTH_ALG_NULL, - &tdes_cbc_reference[i], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_3DES_CBC, + ODP_AUTH_ALG_NULL, + tdes_cbc_reference, + ARRAY_SIZE(tdes_cbc_reference), + false); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -722,16 +743,12 @@ void crypto_test_dec_alg_3des_cbc(void) * */ void crypto_test_dec_alg_3des_cbc_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(tdes_cbc_reference) / - sizeof(tdes_cbc_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) - alg_test(ODP_CRYPTO_OP_DECODE, - ODP_CIPHER_ALG_3DES_CBC, - ODP_AUTH_ALG_NULL, - &tdes_cbc_reference[i], - true); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_3DES_CBC, + ODP_AUTH_ALG_NULL, + tdes_cbc_reference, + ARRAY_SIZE(tdes_cbc_reference), + true); } static int check_alg_aes_gcm(void) @@ -745,17 +762,12 @@ static int check_alg_aes_gcm(void) * packet buffer as completion event buffer.*/ void crypto_test_enc_alg_aes_gcm(void) { - 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, - &aes_gcm_reference[i], - false); - } + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_AES_GCM, + ODP_AUTH_ALG_AES_GCM, + aes_gcm_reference, + ARRAY_SIZE(aes_gcm_reference), + false); } /* This test verifies the correctness of encode (plaintext -> ciphertext) @@ -764,17 +776,12 @@ void crypto_test_enc_alg_aes_gcm(void) * packet buffer as completion event buffer.*/ void crypto_test_enc_alg_aes_gcm_ovr_iv(void) { - 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, - &aes_gcm_reference[i], - true); - } + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_AES_GCM, + ODP_AUTH_ALG_AES_GCM, + aes_gcm_reference, + ARRAY_SIZE(aes_gcm_reference), + true); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -784,17 +791,12 @@ void crypto_test_enc_alg_aes_gcm_ovr_iv(void) * */ void crypto_test_dec_alg_aes_gcm(void) { - 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, - &aes_gcm_reference[i], - false); - } + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_AES_GCM, + ODP_AUTH_ALG_AES_GCM, + aes_gcm_reference, + ARRAY_SIZE(aes_gcm_reference), + false); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -804,17 +806,12 @@ void crypto_test_dec_alg_aes_gcm(void) * */ void crypto_test_dec_alg_aes_gcm_ovr_iv(void) { - 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, - &aes_gcm_reference[i], - true); - } + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_AES_GCM, + ODP_AUTH_ALG_AES_GCM, + aes_gcm_reference, + ARRAY_SIZE(aes_gcm_reference), + true); } static int check_alg_aes_cbc(void) @@ -828,17 +825,12 @@ static int check_alg_aes_cbc(void) * packet buffer as completion event buffer.*/ void crypto_test_enc_alg_aes_cbc(void) { - 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, - &aes_cbc_reference[i], - false); - } + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_AES_CBC, + ODP_AUTH_ALG_NULL, + aes_cbc_reference, + ARRAY_SIZE(aes_cbc_reference), + false); } /* This test verifies the correctness of encode (plaintext -> ciphertext) @@ -846,17 +838,12 @@ void crypto_test_enc_alg_aes_cbc(void) * */ void crypto_test_enc_alg_aes_cbc_ovr_iv(void) { - 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, - &aes_cbc_reference[i], - true); - } + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_AES_CBC, + ODP_AUTH_ALG_NULL, + aes_cbc_reference, + ARRAY_SIZE(aes_cbc_reference), + true); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -866,17 +853,12 @@ void crypto_test_enc_alg_aes_cbc_ovr_iv(void) * */ void crypto_test_dec_alg_aes_cbc(void) { - 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, - &aes_cbc_reference[i], - false); - } + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_AES_CBC, + ODP_AUTH_ALG_NULL, + aes_cbc_reference, + ARRAY_SIZE(aes_cbc_reference), + false); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -886,17 +868,12 @@ void crypto_test_dec_alg_aes_cbc(void) * */ void crypto_test_dec_alg_aes_cbc_ovr_iv(void) { - 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, - &aes_cbc_reference[i], - true); - } + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_AES_CBC, + ODP_AUTH_ALG_NULL, + aes_cbc_reference, + ARRAY_SIZE(aes_cbc_reference), + true); } static int check_alg_aes_ctr(void) @@ -910,17 +887,12 @@ static int check_alg_aes_ctr(void) * packet buffer as completion event buffer.*/ void crypto_test_enc_alg_aes_ctr(void) { - unsigned int test_vec_num = (sizeof(aes_ctr_reference) / - sizeof(aes_ctr_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) { - alg_test(ODP_CRYPTO_OP_ENCODE, - ODP_CIPHER_ALG_AES_CTR, - ODP_AUTH_ALG_NULL, - &aes_ctr_reference[i], - false); - } + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_AES_CTR, + ODP_AUTH_ALG_NULL, + aes_ctr_reference, + ARRAY_SIZE(aes_ctr_reference), + false); } /* This test verifies the correctness of encode (plaintext -> ciphertext) @@ -928,17 +900,12 @@ void crypto_test_enc_alg_aes_ctr(void) * */ void crypto_test_enc_alg_aes_ctr_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(aes_ctr_reference) / - sizeof(aes_ctr_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) { - alg_test(ODP_CRYPTO_OP_ENCODE, - ODP_CIPHER_ALG_AES_CTR, - ODP_AUTH_ALG_NULL, - &aes_ctr_reference[i], - true); - } + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_AES_CTR, + ODP_AUTH_ALG_NULL, + aes_ctr_reference, + ARRAY_SIZE(aes_ctr_reference), + true); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -948,17 +915,12 @@ void crypto_test_enc_alg_aes_ctr_ovr_iv(void) * */ void crypto_test_dec_alg_aes_ctr(void) { - unsigned int test_vec_num = (sizeof(aes_ctr_reference) / - sizeof(aes_ctr_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) { - alg_test(ODP_CRYPTO_OP_DECODE, - ODP_CIPHER_ALG_AES_CTR, - ODP_AUTH_ALG_NULL, - &aes_ctr_reference[i], - false); - } + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_AES_CTR, + ODP_AUTH_ALG_NULL, + aes_ctr_reference, + ARRAY_SIZE(aes_ctr_reference), + false); } /* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -968,17 +930,12 @@ void crypto_test_dec_alg_aes_ctr(void) * */ void crypto_test_dec_alg_aes_ctr_ovr_iv(void) { - unsigned int test_vec_num = (sizeof(aes_ctr_reference) / - sizeof(aes_ctr_reference[0])); - unsigned int i; - - for (i = 0; i < test_vec_num; i++) { - alg_test(ODP_CRYPTO_OP_DECODE, - ODP_CIPHER_ALG_AES_CTR, - ODP_AUTH_ALG_NULL, - &aes_ctr_reference[i], - true); - } + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_AES_CTR, + ODP_AUTH_ALG_NULL, + aes_ctr_reference, + ARRAY_SIZE(aes_ctr_reference), + true); } static int check_alg_hmac_md5(void) @@ -995,30 +952,22 @@ static int check_alg_hmac_md5(void) * */ void crypto_test_gen_alg_hmac_md5(void) { - unsigned int test_vec_num = (sizeof(hmac_md5_reference) / - sizeof(hmac_md5_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_MD5_HMAC, - &hmac_md5_reference[i], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_MD5_HMAC, + hmac_md5_reference, + ARRAY_SIZE(hmac_md5_reference), + false); } void crypto_test_check_alg_hmac_md5(void) { - unsigned int test_vec_num = (sizeof(hmac_md5_reference) / - sizeof(hmac_md5_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_MD5_HMAC, - &hmac_md5_reference[i], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_MD5_HMAC, + hmac_md5_reference, + ARRAY_SIZE(hmac_md5_reference), + false); } static int check_alg_hmac_sha1(void) @@ -1035,30 +984,22 @@ static int check_alg_hmac_sha1(void) * */ void crypto_test_gen_alg_hmac_sha1(void) { - unsigned int test_vec_num = (sizeof(hmac_sha1_reference) / - sizeof(hmac_sha1_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_SHA1_HMAC, - &hmac_sha1_reference[i], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SHA1_HMAC, + hmac_sha1_reference, + ARRAY_SIZE(hmac_sha1_reference), + false); } void crypto_test_check_alg_hmac_sha1(void) { - unsigned int test_vec_num = (sizeof(hmac_sha1_reference) / - sizeof(hmac_sha1_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_SHA1_HMAC, - &hmac_sha1_reference[i], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SHA1_HMAC, + hmac_sha1_reference, + ARRAY_SIZE(hmac_sha1_reference), + false); } static int check_alg_hmac_sha256(void) @@ -1075,30 +1016,22 @@ static int check_alg_hmac_sha256(void) * */ void crypto_test_gen_alg_hmac_sha256(void) { - unsigned int test_vec_num = (sizeof(hmac_sha256_reference) / - sizeof(hmac_sha256_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_SHA256_HMAC, - &hmac_sha256_reference[i], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SHA256_HMAC, + hmac_sha256_reference, + ARRAY_SIZE(hmac_sha256_reference), + false); } void crypto_test_check_alg_hmac_sha256(void) { - unsigned int test_vec_num = (sizeof(hmac_sha256_reference) / - sizeof(hmac_sha256_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_SHA256_HMAC, - &hmac_sha256_reference[i], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SHA256_HMAC, + hmac_sha256_reference, + ARRAY_SIZE(hmac_sha256_reference), + false); } static int check_alg_hmac_sha512(void) @@ -1115,30 +1048,22 @@ static int check_alg_hmac_sha512(void) * */ void crypto_test_gen_alg_hmac_sha512(void) { - unsigned int test_vec_num = (sizeof(hmac_sha512_reference) / - sizeof(hmac_sha512_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_SHA512_HMAC, - &hmac_sha512_reference[i], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SHA512_HMAC, + hmac_sha512_reference, + ARRAY_SIZE(hmac_sha512_reference), + false); } void crypto_test_check_alg_hmac_sha512(void) { - unsigned int test_vec_num = (sizeof(hmac_sha512_reference) / - sizeof(hmac_sha512_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_SHA512_HMAC, - &hmac_sha512_reference[i], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SHA512_HMAC, + hmac_sha512_reference, + ARRAY_SIZE(hmac_sha512_reference), + false); } static int check_alg_aes_gmac(void) @@ -1153,25 +1078,22 @@ void crypto_test_gen_alg_aes_gmac(void) 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], - false); + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_AES_GMAC, + aes_gmac_reference, + ARRAY_SIZE(aes_gmac_reference), + false); } void crypto_test_check_alg_aes_gmac(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], - false); + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_AES_GMAC, + aes_gmac_reference, + ARRAY_SIZE(aes_gmac_reference), + false); } int crypto_suite_sync_init(void) From patchwork Mon Dec 25 17: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: 122698 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp61093qgn; Mon, 25 Dec 2017 09:02:09 -0800 (PST) X-Google-Smtp-Source: ACJfBosQMNzsekui9aV45ezEU4CtIdOpGK7HrglXWitgVqLi9dXxHcmRg2c0+pH1Fz3lIUIcRwmw X-Received: by 10.200.55.75 with SMTP id p11mr31256091qtb.298.1514221329420; Mon, 25 Dec 2017 09:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514221329; cv=none; d=google.com; s=arc-20160816; b=iP78sB11CYFqR9S6XPeks35n0aPytoSmvWcH2twgdJbuICBwb/DGb5Y4Ks8tj/7zcq nqqM0QtKcEdnlJKpeFn1M6xab4YPfqNZIdOl/GEbXXoPjORGm5QuJUaRpDTwI1qlxQK1 EV6rqo2yFc0HNEozMqgjE3jLAjVjwXbAvbXqfnqtEP98FfUSLnHIRPDBVc3a6ScETOWd mIU9QXRm2nwz+O0DeHpU6AT5X27ExuZZxO33kegoGMXg5sdUo1vC+18o36OyRtCtAnKC WUCMzKgL0JlONhQY8Oh9glMhC3zafWJndy/BjZ58GzQm6X3K5+de2mbk8saPNJq3AFuy HcuA== 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=ver1iOmvR+eI0LgWtUfjVPXw6Wqflom+kG97B0T6J24=; b=cJ9iaS2j/5SdbPRGgfhsYYjN3mQH4auBg40EEmYl57W10Gk72Nxohc68pff2BiL0ZK VPo/DAg2BFOWs1x+a5142x72CWYxERvlV4sDvtpSv1ARzWFFt80Y78hJ3VSsS3YzIjGa xcBXx+knI7jUysIXDI5bLJjjR6H/gvM2wxkbfilwW4UYyiAaVDDdgjvXAxZUftJg0FCl RYr6Znviq2fAQjObArb2/uCbHpQubiM/rjOpLxyenwq9eJMfMzLrj4rjYVwIUB3q/oCx cGOdU12/9r4DRusd6VgCW03pVO0ytAiegAWX+w6rxTtlhRMKdybJicpjvdE4U0M3EOw8 aDaQ== 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 x55si1636423qth.63.2017.12.25.09.02.09; Mon, 25 Dec 2017 09:02:09 -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 190DE6092F; Mon, 25 Dec 2017 17:02:09 +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 E8C93608C9; Mon, 25 Dec 2017 17:00:38 +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 D151A6085F; Mon, 25 Dec 2017 17:00:25 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 1B69360386 for ; Mon, 25 Dec 2017 17:00:17 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 4C639134347B for ; Mon, 25 Dec 2017 20:00:15 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hzMKBVfOc0-0FqWnhjr; Mon, 25 Dec 2017 20:00:15 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id eIe5mGadxk-0EtuuI5u; Mon, 25 Dec 2017 20: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: Mon, 25 Dec 2017 20:00:09 +0300 Message-Id: <1514221211-7675-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> References: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 367 Subject: [lng-odp] [PATCH API-NEXT v1 2/4] validation: crypto: add test vectors for full HMAC length 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 for HMAC tests add test vectors covering full HMAC length in addition to truncated tests. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 367 (lumag:crypto-untested) ** https://github.com/Linaro/odp/pull/367 ** Patch: https://github.com/Linaro/odp/pull/367.patch ** Base sha: a5f07dbf95f982b7c5898434e56164ff976c0a0f ** Merge commit sha: 0f2debefe973066bf83f4d93a551f16f758b0c14 **/ test/validation/api/crypto/test_vectors.h | 251 +++++++++++++++++++++++++- test/validation/api/crypto/test_vectors_len.h | 6 +- 2 files changed, 254 insertions(+), 3 deletions(-) diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h index f2ce9eb2f..6592a3357 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/test/validation/api/crypto/test_vectors.h @@ -486,7 +486,7 @@ static crypto_test_reference_t hmac_md5_reference[] = { .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, .digest_length = HMAC_MD5_96_CHECK_LEN, .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, - 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d }, + 0x13, 0xf4, 0x8e, 0xf8 }, }, { @@ -505,7 +505,7 @@ static crypto_test_reference_t hmac_md5_reference[] = { 0x69, 0x6e, 0x67, 0x3f }, .digest_length = HMAC_MD5_96_CHECK_LEN, .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03, - 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 }, + 0xea, 0xa8, 0x6e, 0x31 }, }, { @@ -528,6 +528,61 @@ static crypto_test_reference_t hmac_md5_reference[] = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd }, .digest_length = HMAC_MD5_96_CHECK_LEN, + .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88, + 0xdb, 0xb8, 0xc7, 0x33 } + }, + { + .auth_key_length = HMAC_MD5_KEY_LEN, + .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b }, + .length = 8, + /* "Hi There" */ + .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .digest_length = HMAC_MD5_CHECK_LEN, + .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, + 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d }, + + }, + { + .auth_key_length = HMAC_MD5_KEY_LEN, + /* "Jefe" */ + .auth_key = { 0x4a, 0x65, 0x66, 0x65 }, + .length = 28, + /* what do ya want for nothing?*/ + .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .digest_length = HMAC_MD5_CHECK_LEN, + .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03, + 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 }, + + }, + { + .auth_key_length = HMAC_MD5_KEY_LEN, + .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, + .length = 50, + .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .digest_length = HMAC_MD5_CHECK_LEN, .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88, 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 } } @@ -588,6 +643,64 @@ static crypto_test_reference_t hmac_sha1_reference[] = { .digest_length = HMAC_SHA1_96_CHECK_LEN, .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3, 0x9a, 0xf4 } + }, + { + .auth_key_length = HMAC_SHA1_KEY_LEN, + .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b }, + .length = 8, + /* "Hi There" */ + .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .digest_length = HMAC_SHA1_CHECK_LEN, + .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, + 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, + 0xf1, 0x46, 0xbe, 0x00 } + }, + { + .auth_key_length = HMAC_SHA1_KEY_LEN, + /* "Jefe" */ + .auth_key = { 0x4a, 0x65, 0x66, 0x65 }, + .length = 28, + /* what do ya want for nothing?*/ + .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .digest_length = HMAC_SHA1_CHECK_LEN, + .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, + 0xd2, 0x74, 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, + 0x25, 0x9a, 0x7c, 0x79 } + }, + { + .auth_key_length = HMAC_SHA1_KEY_LEN, + .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }, + .length = 50, + .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .digest_length = HMAC_SHA1_CHECK_LEN, + .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, + 0x91, 0xa3, 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, + 0x63, 0xf1, 0x75, 0xd3 } } }; @@ -646,6 +759,67 @@ static crypto_test_reference_t hmac_sha256_reference[] = { .digest_length = HMAC_SHA256_128_CHECK_LEN, .digest = { 0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7 } + }, + { + .auth_key_length = HMAC_SHA256_KEY_LEN, + .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b }, + .length = 8, + /* "Hi There" */ + .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .digest_length = HMAC_SHA256_CHECK_LEN, + .digest = { 0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, + 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b, + 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, + 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7 } + }, + { + .auth_key_length = HMAC_SHA256_KEY_LEN, + /* "Jefe" */ + .auth_key = { 0x4a, 0x65, 0x66, 0x65 }, + .length = 28, + /* what do ya want for nothing?*/ + .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .digest_length = HMAC_SHA256_CHECK_LEN, + .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, + 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, + 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, + 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 } + }, + { + .auth_key_length = HMAC_SHA256_KEY_LEN, + .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }, + .length = 50, + .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .digest_length = HMAC_SHA256_CHECK_LEN, + .digest = { 0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, + 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7, + 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22, + 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe } } }; @@ -710,6 +884,79 @@ static crypto_test_reference_t hmac_sha512_reference[] = { 0xef, 0xb0, 0xf0, 0x75, 0x6c, 0x89, 0x0b, 0xe9, 0xb1, 0xb5, 0xdb, 0xdd, 0x8e, 0xe8, 0x1a, 0x36, 0x55, 0xf8, 0x3e, 0x33, 0xb2, 0x27, 0x9d, 0x39 } + }, + { + .auth_key_length = HMAC_SHA512_KEY_LEN, + .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b }, + .length = 8, + /* "Hi There" */ + .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, + .digest_length = HMAC_SHA512_CHECK_LEN, + .digest = { 0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d, + 0x4f, 0xf0, 0xb4, 0x24, 0x1a, 0x1d, 0x6c, 0xb0, + 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78, + 0x7a, 0xd0, 0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde, + 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7, 0x02, + 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4, + 0xbe, 0x9d, 0x91, 0x4e, 0xeb, 0x61, 0xf1, 0x70, + 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54 } + }, + { + .auth_key_length = HMAC_SHA512_KEY_LEN, + /* "Jefe" */ + .auth_key = { 0x4a, 0x65, 0x66, 0x65 }, + .length = 28, + /* what do ya want for nothing?*/ + .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, + 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x3f }, + .digest_length = HMAC_SHA512_CHECK_LEN, + .digest = { 0x16, 0x4b, 0x7a, 0x7b, 0xfc, 0xf8, 0x19, 0xe2, + 0xe3, 0x95, 0xfb, 0xe7, 0x3b, 0x56, 0xe0, 0xa3, + 0x87, 0xbd, 0x64, 0x22, 0x2e, 0x83, 0x1f, 0xd6, + 0x10, 0x27, 0x0c, 0xd7, 0xea, 0x25, 0x05, 0x54, + 0x97, 0x58, 0xbf, 0x75, 0xc0, 0x5a, 0x99, 0x4a, + 0x6d, 0x03, 0x4f, 0x65, 0xf8, 0xf0, 0xe6, 0xfd, + 0xca, 0xea, 0xb1, 0xa3, 0x4d, 0x4a, 0x6b, 0x4b, + 0x63, 0x6e, 0x07, 0x0a, 0x38, 0xbc, 0xe7, 0x37 } + }, + { + .auth_key_length = HMAC_SHA512_KEY_LEN, + .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }, + .length = 50, + .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd }, + .digest_length = HMAC_SHA512_CHECK_LEN, + .digest = { 0xfa, 0x73, 0xb0, 0x08, 0x9d, 0x56, 0xa2, 0x84, + 0xef, 0xb0, 0xf0, 0x75, 0x6c, 0x89, 0x0b, 0xe9, + 0xb1, 0xb5, 0xdb, 0xdd, 0x8e, 0xe8, 0x1a, 0x36, + 0x55, 0xf8, 0x3e, 0x33, 0xb2, 0x27, 0x9d, 0x39, + 0xbf, 0x3e, 0x84, 0x82, 0x79, 0xa7, 0x22, 0xc8, + 0x06, 0xb4, 0x85, 0xa4, 0x7e, 0x67, 0xc8, 0x07, + 0xb9, 0x46, 0xa3, 0x37, 0xbe, 0xe8, 0x94, 0x26, + 0x74, 0x27, 0x88, 0x59, 0xe1, 0x32, 0x92, 0xfb } } }; diff --git a/test/validation/api/crypto/test_vectors_len.h b/test/validation/api/crypto/test_vectors_len.h index 0062299e6..140bef2a2 100644 --- a/test/validation/api/crypto/test_vectors_len.h +++ b/test/validation/api/crypto/test_vectors_len.h @@ -57,17 +57,21 @@ /* HMAC-MD5 */ #define HMAC_MD5_KEY_LEN 16 #define HMAC_MD5_96_CHECK_LEN 12 +#define HMAC_MD5_CHECK_LEN 16 /* HMAC-SHA256 */ #define HMAC_SHA256_KEY_LEN 32 -#define HMAC_SHA256_128_CHECK_LEN 16 +#define HMAC_SHA256_128_CHECK_LEN 16 +#define HMAC_SHA256_CHECK_LEN 32 /* HMAC-SHA1 */ #define HMAC_SHA1_KEY_LEN 20 #define HMAC_SHA1_96_CHECK_LEN 12 +#define HMAC_SHA1_CHECK_LEN 20 /* HMAC-SHA512 */ #define HMAC_SHA512_KEY_LEN 64 #define HMAC_SHA512_256_CHECK_LEN 32 +#define HMAC_SHA512_CHECK_LEN 64 #endif From patchwork Mon Dec 25 17:00:10 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: 122697 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp60283qgn; Mon, 25 Dec 2017 09:01:33 -0800 (PST) X-Google-Smtp-Source: ACJfBov4m/EeaYdJvofbBiYlZBab/E9F8JOm5u+zSS2HJzNdJ35khU8oD3iKKBdo4WmRW0pDCJis X-Received: by 10.200.36.212 with SMTP id t20mr31411836qtt.202.1514221293205; Mon, 25 Dec 2017 09:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514221293; cv=none; d=google.com; s=arc-20160816; b=DT7eQQQ4lVK2qjsg3vw0sXgDCkMkUmwXv1gPn4ehTRiqv/wKvoThlzBBQTzPtDIR6A 5HvfmSa9PzAuNTRUmb5D3limywzdpLS/rPSC4zvsBzUtY7RAhSEW2BjxPaicW60uzBxT SknVLuow9xKOevi3M4v+XSJkCgI7QBBLAU6NJY7VC1Y23bUMEcJm6oex1NIf2BkEBHzW VCkgs0Uz51DPYkU96pJ/FJajdTFltPTXech5id6KJT1VBQ4CIruNXGF3V9a3xG/jo/rr JZUzeJHz7XxyIw/VZo8KHP67i+n5qzRMBOYbM7H0pI7MvKWTH5V4wkUp29mMBbuSysG/ BNyA== 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=iuog/wNMo+7TePOxltgMUxE7gM7Odb50hdQNAuHeOos=; b=UH/pqD+r1emXMlnAJLuGpi3An1Huy8m8MVXd+gsYFtZXNH2a49yup+BfKPzEXgQQEX Y+GI2sLY1VUPXXMFp6hrWXO8bm8D++ELhA6s4zB11oHzgNoncOFiDYThANP0vSiNXrHR J6xHSe8vMVveh/wWsBAvRVw64cbaq13DGHZszwmecJ42ZSGl3HFkzaXaYhOSIR2n8CS+ g6iIRkuyLu3KJNL7ScJaOv5/M3AoK6IBOcvEuBbYdR9o4+XWVtZixGSkrZL5KYVT0Ij+ FV9qozU4agK6CFEioB+qfq63p7qUZf7TdxxYX1wEAdDumufSkdJ+WeRaAi43jqYsPCBS h+qg== 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 w33si16437890qtw.449.2017.12.25.09.01.32; Mon, 25 Dec 2017 09:01:33 -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 BA0E460940; Mon, 25 Dec 2017 17:01:32 +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 9871E60862; Mon, 25 Dec 2017 17:00:32 +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 7F25260840; Mon, 25 Dec 2017 17:00:23 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 30C7460840 for ; Mon, 25 Dec 2017 17:00:17 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward103p.mail.yandex.net (Yandex) with ESMTP id DDB8A2182CB7 for ; Mon, 25 Dec 2017 20:00:15 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id pHYT6ndjmp-0FMakWPp; Mon, 25 Dec 2017 20:00:15 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id eIe5mGadxk-0FtOU6ke; Mon, 25 Dec 2017 20: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: Mon, 25 Dec 2017 20:00:10 +0300 Message-Id: <1514221211-7675-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> References: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 367 Subject: [lng-odp] [PATCH API-NEXT v1 3/4] validation: crypto: fail if no tests were executed 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 Fail the test if we were not able to match any test vectors to capabilities. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 367 (lumag:crypto-untested) ** https://github.com/Linaro/odp/pull/367 ** Patch: https://github.com/Linaro/odp/pull/367.patch ** Base sha: a5f07dbf95f982b7c5898434e56164ff976c0a0f ** Merge commit sha: 0f2debefe973066bf83f4d93a551f16f758b0c14 **/ test/validation/api/crypto/odp_crypto_test_inp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 48a1c3a5c..ddf638001 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -434,6 +434,8 @@ static void check_alg(odp_crypto_op_t op, int rc, cipher_num, auth_num, i; odp_bool_t cipher_tested[MAX_ALG_CAPA]; odp_bool_t auth_tested[MAX_ALG_CAPA]; + odp_bool_t cipher_ok = false; + odp_bool_t auth_ok = false; size_t idx; rc = odp_crypto_capability(&capa); @@ -552,21 +554,29 @@ static void check_alg(odp_crypto_op_t op, auth_tested[auth_idx] = true; } - for (i = 0; i < cipher_num; i++) + for (i = 0; i < cipher_num; i++) { + cipher_ok |= cipher_tested[i]; if (!cipher_tested[i]) printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " "iv_len=%" PRIu32 "\n", cipher_alg_name(cipher_alg), cipher_capa[i].key_len, cipher_capa[i].iv_len); + } - for (i = 0; i < auth_num; i++) + for (i = 0; i < auth_num; i++) { + auth_ok |= auth_tested[i]; if (!auth_tested[i]) printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " "digest_len=%" PRIu32 "\n", auth_alg_name(auth_alg), auth_capa[i].key_len, auth_capa[i].digest_len); + } + + /* Verify that we were able to run at least several tests */ + CU_ASSERT(cipher_ok); + CU_ASSERT(auth_ok); } /** From patchwork Mon Dec 25 17:00:11 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: 122696 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp59673qgn; Mon, 25 Dec 2017 09:01:06 -0800 (PST) X-Google-Smtp-Source: ACJfBos45WgDel2u2ZUUm9cWRgVLIwUKng/jQVliV9lPeasXvQ2gCp4oI24SQPM9W5mVt7fE+G7x X-Received: by 10.200.27.36 with SMTP id y33mr32366614qtj.291.1514221266013; Mon, 25 Dec 2017 09:01:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514221266; cv=none; d=google.com; s=arc-20160816; b=Mj0za4eFbfnQTxtiwuGvEPOvZFqzJjAZwxaxp7oaBAKNRH5QXGJpIajL8Qgm3xvOlA 9CoXhBQjMCXsvawOt6B1RzGd11xmi0tfQJ5zf5aCWYSN1YpuFdRpTaPi5HDxMJC45sn4 yxw3BDWdh+rDe3iuA9239ZFcWCFq4YK/e/7l0Rbc7jx0wgEOz+4AG/LzbWy2vALhEaza LhK0jQAzk1FhSGPBF3oIHRUx3enwQUEbuWvyW5wAPaS81Xi8Wp3aW+PxDjdE3wl6eurU k11m7IGz5h9OzHpmyrwASuz1wt39l+CwoH61iHKJAxQwxwbE9H8zezJSsu6ibn0WREW/ yIjw== 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=Cy6pUZCCPO5Z1OxlN2JNZFu+KcGaVfSU/11y8cfyjqM=; b=Sn4YLrsTMc1i0Xr7ZPRnn6yGkMwwWH7cZjSj2ux69yQ9wGVfybJUK8hKH+4it5Owo4 vwlJPC8FHTYNzAvF+gd8WPWeWvv0xWUMFiFdGa7PuXk4O+lbpd0eUo5PrzVi1bmArze/ 9+t2+KPY4SLAnNl11ndnutZkykD9NsuCTYeASmsn1ymdHhB9UkCQ8rlOZu9BRL/mWILy 1u3G88h2+JC2zLzcicA9ICfiR01D2jCC6pH2eNeBjtoYGOlEKorV62Ui1BKa3cVN8rxU yu8llqMYqP6/v5G1L1vCHp7vyg5VK6cAWvqcrudbWszYnEbg1qJadeN7rf0d3vBK1dWy 2rtw== 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 x55si1635086qth.63.2017.12.25.09.01.05; Mon, 25 Dec 2017 09:01: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 B8FFF60940; Mon, 25 Dec 2017 17:01: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=-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 543706038C; Mon, 25 Dec 2017 17:00:29 +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 E11E4608C9; Mon, 25 Dec 2017 17:00:21 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id BAD4D6084A for ; Mon, 25 Dec 2017 17:00:17 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 7EDBA56022F1 for ; Mon, 25 Dec 2017 20:00:16 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GvgugcYOg9-0GF0Xl7G; Mon, 25 Dec 2017 20:00:16 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id eIe5mGadxk-0FtuFsJ4; Mon, 25 Dec 2017 20: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: Mon, 25 Dec 2017 20:00:11 +0300 Message-Id: <1514221211-7675-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> References: <1514221211-7675-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 367 Subject: [lng-odp] [PATCH API-NEXT v1 4/4] validation: crypto: don't output untested cipher for NULL cipher 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 AES-GMAC adds synthetic NULL cipher capability with IV length = 12. Skip CIPHER_ALG_NULL entries when printing untested messages (as untested entry does not really mean a thing for NULL cipher algo). Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 367 (lumag:crypto-untested) ** https://github.com/Linaro/odp/pull/367 ** Patch: https://github.com/Linaro/odp/pull/367.patch ** Base sha: a5f07dbf95f982b7c5898434e56164ff976c0a0f ** Merge commit sha: 0f2debefe973066bf83f4d93a551f16f758b0c14 **/ test/validation/api/crypto/odp_crypto_test_inp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index ddf638001..3f1e4f95c 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -556,12 +556,16 @@ static void check_alg(odp_crypto_op_t op, for (i = 0; i < cipher_num; i++) { cipher_ok |= cipher_tested[i]; - if (!cipher_tested[i]) + if (!cipher_tested[i]) { + /* GMAC-related hacks */ + if (cipher_alg == ODP_CIPHER_ALG_NULL) + continue; printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " "iv_len=%" PRIu32 "\n", cipher_alg_name(cipher_alg), cipher_capa[i].key_len, cipher_capa[i].iv_len); + } } for (i = 0; i < auth_num; i++) {