/* Test vectors : FIPS Known answer tests for QCEDEV . * * Copyright (c) 2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __CRYPTO_MSM_QCEDEV_FIPS_H #define __CRYPTO_MSM_QCEDEV_FIPS_H #include "qce.h" static uint8_t _std_init_vector_sha1_uint8[] = { 0x67, 0x45, 0x23, 0x01, 0xEF, 0xCD, 0xAB, 0x89, 0x98, 0xBA, 0xDC, 0xFE, 0x10, 0x32, 0x54, 0x76, 0xC3, 0xD2, 0xE1, 0xF0 }; /* standard initialization vector for SHA-256, source: FIPS 180-2 */ static uint8_t _std_init_vector_sha256_uint8[] = { 0x6A, 0x09, 0xE6, 0x67, 0xBB, 0x67, 0xAE, 0x85, 0x3C, 0x6E, 0xF3, 0x72, 0xA5, 0x4F, 0xF5, 0x3A, 0x51, 0x0E, 0x52, 0x7F, 0x9B, 0x05, 0x68, 0x8C, 0x1F, 0x83, 0xD9, 0xAB, 0x5B, 0xE0, 0xCD, 0x19 }; /* * For Hashing / HMAC algorithms */ struct _fips_test_vector_sha_hmac { char *key; unsigned char klen; char *input; unsigned char ilen; char *digest; unsigned char diglen; enum qcedev_sha_alg_enum hash_alg; }; /* * For cipher algorithms */ struct _fips_test_vector_cipher { char *key; unsigned char klen; char *iv; unsigned char ivlen; char *pln_txt; unsigned int pln_txt_len; char *enc_txt; unsigned int enc_txt_len; enum qcedev_cipher_alg_enum enc_alg; enum qcedev_cipher_mode_enum mode; }; /* * Test vectors sha and hmac algorothms */ static struct _fips_test_vector_sha_hmac fips_test_vector_sha_hmac[] = { /* http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA1.pdf */ {/* SHA1 */ .hash_alg = QCEDEV_ALG_SHA1, .input = "abc", .ilen = 3, .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a" "\xba\x3e\x25\x71\x78\x50\xc2\x6c" "\x9c\xd0\xd8\x9d", .diglen = SHA1_DIGEST_SIZE, }, /* http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA256.pdf */ {/* SHA256 */ .hash_alg = QCEDEV_ALG_SHA256, .input = "abc", .ilen = 3, .digest = "\xba\x78\x16\xbf\x8f\x01\xcf\xea" "\x41\x41\x40\xde\x5d\xae\x22\x23" "\xb0\x03\x61\xa3\x96\x17\x7a\x9c" "\xb4\x10\xff\x61\xf2\x00\x15\xad", .diglen = SHA256_DIGEST_SIZE, }, /* http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/HMAC_SHA1.pdf */ {/* HMAC-SHA1 */ .hash_alg = QCEDEV_ALG_SHA1_HMAC, .key = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13", .klen = 20, .input = "Sample message for keylen