X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_cryptodev_hash_test_vectors.h;h=d11d7cee7ee12121645c7079c3410ee0190f3a40;hb=ea31f2b4f547a767b9d3af80da77fbdcd9587986;hp=a8f9da0aa622f31a6b7b990011e36fd6fab92098;hpb=8772c3f713e268456a4dd597e782701ca6a98d0f;p=dpdk.git diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index a8f9da0aa6..d11d7cee7e 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -1,38 +1,14 @@ -/* - * BSD LICENSE - * - * Copyright(c) 2016 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ #define TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ +#ifdef RTE_LIBRTE_PMD_AESNI_MB +#include +#endif + static const uint8_t plaintext_hash[] = { "What a lousy earth! He wondered how many people " "were destitute that same night even in his own " @@ -115,7 +91,8 @@ sha1_test_vector = { 0x35, 0x62, 0xFB, 0xFA, 0x93, 0xFD, 0x7D, 0x70, 0xA6, 0x7D, 0x45, 0xCA }, - .len = 20 + .len = 20, + .truncated_len = 20 } }; @@ -159,7 +136,8 @@ sha224_test_vector = { 0x39, 0x26, 0xDF, 0xB5, 0x78, 0x62, 0xB2, 0x6E, 0x5E, 0x8F, 0x25, 0x84 }, - .len = 28 + .len = 28, + .truncated_len = 28 } }; @@ -205,7 +183,8 @@ sha256_test_vector = { 0x1F, 0xC7, 0x84, 0xEE, 0x76, 0xA6, 0x39, 0x15, 0x76, 0x2F, 0x87, 0xF9, 0x01, 0x06, 0xF3, 0xB7 }, - .len = 32 + .len = 32, + .truncated_len = 32 } }; @@ -253,7 +232,8 @@ sha384_test_vector = { 0xAD, 0x41, 0xAB, 0x15, 0xB0, 0x03, 0x15, 0xEC, 0x9E, 0x3D, 0xED, 0xCB, 0x80, 0x7B, 0xF4, 0xB6 }, - .len = 48 + .len = 48, + .truncated_len = 48 } }; @@ -307,7 +287,8 @@ sha512_test_vector = { 0x64, 0x4E, 0x15, 0x68, 0x12, 0x67, 0x26, 0x0F, 0x2C, 0x3C, 0x83, 0x25, 0x27, 0x86, 0xF0, 0xDB }, - .len = 64 + .len = 64, + .truncated_len = 64 } }; @@ -347,163 +328,255 @@ hmac_sha512_test_vector = { } }; +static const struct blockcipher_test_data +cmac_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .digest = { + .data = { + 0x4C, 0x77, 0x87, 0xA0, 0x78, 0x8E, 0xEA, 0x96, + 0xC1, 0xEB, 0x1E, 0x4E, 0x95, 0x8F, 0xED, 0x27 + }, + .len = 16, + .truncated_len = 16 + } +}; + +static const struct blockcipher_test_data +null_auth_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .ciphertext = { /* arbitrary data - shouldn't be used */ + .data = plaintext_hash, + .len = 512 + }, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +static const struct blockcipher_test_data +cmac_test_vector_12 = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .digest = { + .data = { + 0x4C, 0x77, 0x87, 0xA0, 0x78, 0x8E, 0xEA, 0x96, + 0xC1, 0xEB, 0x1E, 0x4E, 0x95, 0x8F, 0xED, 0x27 + }, + .len = 12, + .truncated_len = 12 + } +}; + static const struct blockcipher_test_case hash_test_cases[] = { { .test_descr = "MD5 Digest", .test_data = &md5_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "MD5 Digest Verify", .test_data = &md5_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "HMAC-MD5 Digest", .test_data = &hmac_md5_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "HMAC-MD5 Digest Verify", .test_data = &hmac_md5_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "SHA1 Digest", .test_data = &sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "SHA1 Digest Verify", .test_data = &sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "HMAC-SHA1 Digest", .test_data = &hmac_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr = "HMAC-SHA1 Digest Scatter Gather", + .test_data = &hmac_sha1_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, }, { .test_descr = "HMAC-SHA1 Digest Verify", .test_data = &hmac_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr = "HMAC-SHA1 Digest Verify Scatter Gather", + .test_data = &hmac_sha1_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, }, { .test_descr = "SHA224 Digest", .test_data = &sha224_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "SHA224 Digest Verify", .test_data = &sha224_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "HMAC-SHA224 Digest", .test_data = &hmac_sha224_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "HMAC-SHA224 Digest Verify", .test_data = &hmac_sha224_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "SHA256 Digest", .test_data = &sha256_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "SHA256 Digest Verify", .test_data = &sha256_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "HMAC-SHA256 Digest", .test_data = &hmac_sha256_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "HMAC-SHA256 Digest Verify", .test_data = &hmac_sha256_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "SHA384 Digest", .test_data = &sha384_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "SHA384 Digest Verify", .test_data = &sha384_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "HMAC-SHA384 Digest", .test_data = &hmac_sha384_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "HMAC-SHA384 Digest Verify", .test_data = &hmac_sha384_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "SHA512 Digest", .test_data = &sha512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "SHA512 Digest Verify", .test_data = &sha512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL }, { .test_descr = "HMAC-SHA512 Digest", .test_data = &hmac_sha512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "HMAC-SHA512 Digest Verify", .test_data = &hmac_sha512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_MB }, + { + .test_descr = "CMAC Digest 12B", + .test_data = &cmac_test_vector_12, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "CMAC Digest Verify 12B", + .test_data = &cmac_test_vector_12, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "CMAC Digest 16B", + .test_data = &cmac_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "CMAC Digest Verify 16B", + .test_data = &cmac_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "NULL algo - auth generate", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "NULL algo - auth verify", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "NULL algo - auth generate - OOP", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + }, + { + .test_descr = "NULL algo - auth verify - OOP", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + }, + }; #endif /* TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ */