1 /*- 2 * BSD LICENSE 3 * 4 * Copyright(c) 2016 Intel Corporation. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * * Neither the name of Intel Corporation nor the names of its 17 * contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #ifndef APP_TEST_TEST_CRYPTODEV_HMAC_TEST_VECTORS_H_ 34 #define APP_TEST_TEST_CRYPTODEV_HMAC_TEST_VECTORS_H_ 35 36 /* *** MD5 test vectors *** */ 37 38 #define MD5_DIGEST_LEN 16 39 40 struct HMAC_MD5_vector { 41 struct { 42 uint8_t data[64]; 43 uint16_t len; 44 } key; 45 46 struct { 47 uint8_t data[1024]; 48 uint16_t len; 49 } plaintext; 50 51 struct { 52 uint8_t data[16]; 53 uint16_t len; 54 } auth_tag; 55 }; 56 57 static const struct 58 HMAC_MD5_vector HMAC_MD5_test_case_1 = { 59 .key = { 60 .data = { 61 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, 62 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD 63 }, 64 .len = 16 65 }, 66 .plaintext = { 67 .data = { 68 0x87, 0x4D, 0x61, 0x91, 0xB6, 0x20, 0xE3, 0x26, 69 0x1B, 0xEF, 0x68, 0x64, 0x99, 0x0D, 0xB6, 0xCE, 70 0x98, 0x06, 0xF6, 0x6B, 0x79, 0x70, 0xFD, 0xFF, 71 0x86, 0x17, 0x18, 0x7B, 0xB9, 0xFF, 0xFD, 0xFF, 72 0x5A, 0xE4, 0xDF, 0x3E, 0xDB, 0xD5, 0xD3, 0x5E, 73 0x5B, 0x4F, 0x09, 0x02, 0x0D, 0xB0, 0x3E, 0xAB, 74 0x1E, 0x03, 0x1D, 0xDA, 0x2F, 0xBE, 0x03, 0xD1, 75 0x79, 0x21, 0x70, 0xA0, 0xF3, 0x00, 0x9C, 0xEE 76 }, 77 .len = 64 78 }, 79 .auth_tag = { 80 .data = { 81 0x67, 0x83, 0xE1, 0x0F, 0xB0, 0xBF, 0x33, 0x49, 82 0x22, 0x04, 0x89, 0xDF, 0x86, 0xD0, 0x5F, 0x0C 83 }, 84 .len = MD5_DIGEST_LEN 85 } 86 }; 87 88 static const struct 89 HMAC_MD5_vector HMAC_MD5_test_case_2 = { 90 .key = { 91 .data = { 92 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, 93 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, 94 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, 95 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD 96 }, 97 .len = 32 98 }, 99 .plaintext = { 100 .data = { 101 0x87, 0x4D, 0x61, 0x91, 0xB6, 0x20, 0xE3, 0x26, 102 0x1B, 0xEF, 0x68, 0x64, 0x99, 0x0D, 0xB6, 0xCE, 103 0x98, 0x06, 0xF6, 0x6B, 0x79, 0x70, 0xFD, 0xFF, 104 0x86, 0x17, 0x18, 0x7B, 0xB9, 0xFF, 0xFD, 0xFF, 105 0x5A, 0xE4, 0xDF, 0x3E, 0xDB, 0xD5, 0xD3, 0x5E, 106 0x5B, 0x4F, 0x09, 0x02, 0x0D, 0xB0, 0x3E, 0xAB, 107 0x1E, 0x03, 0x1D, 0xDA, 0x2F, 0xBE, 0x03, 0xD1, 108 0x79, 0x21, 0x70, 0xA0, 0xF3, 0x00, 0x9C, 0xEE 109 }, 110 .len = 64 111 }, 112 .auth_tag = { 113 .data = { 114 0x39, 0x24, 0x70, 0x7A, 0x30, 0x38, 0x1E, 0x2B, 115 0x9F, 0x6B, 0xD9, 0x3C, 0xAD, 0xC2, 0x73, 0x52 116 }, 117 .len = MD5_DIGEST_LEN 118 } 119 }; 120 121 #endif /* APP_TEST_TEST_CRYPTODEV_HMAC_TEST_VECTORS_H_ */ 122