Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: testmgr - Add test vectors for authenc(hmac(sha256),rfc3686(ctr(aes)))

Test vectors were generated starting from existing RFC3686(CTR(AES)) test
vectors and adding HMAC(SHA256) computed with software implementation.
Then, the results were double-checked on Mediatek MT7986 (safexcel).
Platform pass self-tests.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Aleksander Jan Bajkowski and committed by
Herbert Xu
5ac6b904 d46c27c0

+240 -1
+5 -1
crypto/testmgr.c
··· 4206 4206 } 4207 4207 }, { 4208 4208 .alg = "authenc(hmac(sha256),rfc3686(ctr(aes)))", 4209 - .test = alg_test_null, 4209 + .generic_driver = "authenc(hmac-sha256-lib,rfc3686(ctr(aes-lib)))", 4210 + .test = alg_test_aead, 4210 4211 .fips_allowed = 1, 4212 + .suite = { 4213 + .aead = __VECS(hmac_sha256_aes_ctr_rfc3686_tv_temp) 4214 + } 4211 4215 }, { 4212 4216 .alg = "authenc(hmac(sha384),cbc(aes))", 4213 4217 .generic_driver = "authenc(hmac-sha384-lib,cbc(aes-generic))",
+235
crypto/testmgr.h
··· 15943 15943 }, 15944 15944 }; 15945 15945 15946 + static const struct aead_testvec hmac_sha256_aes_ctr_rfc3686_tv_temp[] = { 15947 + { /* RFC 3686 Case 1 */ 15948 + #ifdef __LITTLE_ENDIAN 15949 + .key = "\x08\x00" /* rta length */ 15950 + "\x01\x00" /* rta type */ 15951 + #else 15952 + .key = "\x00\x08" /* rta length */ 15953 + "\x00\x01" /* rta type */ 15954 + #endif 15955 + "\x00\x00\x00\x14" /* enc key length */ 15956 + "\x00\x00\x00\x00\x00\x00\x00\x00" 15957 + "\x00\x00\x00\x00\x00\x00\x00\x00" 15958 + "\x00\x00\x00\x00\x00\x00\x00\x00" 15959 + "\x00\x00\x00\x00\x00\x00\x00\x00" 15960 + "\xae\x68\x52\xf8\x12\x10\x67\xcc" 15961 + "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" 15962 + "\x00\x00\x00\x30", 15963 + .klen = 8 + 32 + 20, 15964 + .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", 15965 + .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", 15966 + .alen = 8, 15967 + .ptext = "Single block msg", 15968 + .plen = 16, 15969 + .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" 15970 + "\x2d\x61\x75\xa3\x26\x13\x11\xb8" 15971 + "\x9b\xa2\x34\x62\xe5\xb3\xe8\x2d" 15972 + "\x6d\xdb\x93\x64\xa5\x08\x2e\x77" 15973 + "\x72\x1f\x21\x94\xc7\xbe\x14\xa6" 15974 + "\xcd\xea\x96\xa1\x29\x8f\x30\xc3", 15975 + .clen = 16 + 32, 15976 + }, { /* RFC 3686 Case 2 */ 15977 + #ifdef __LITTLE_ENDIAN 15978 + .key = "\x08\x00" /* rta length */ 15979 + "\x01\x00" /* rta type */ 15980 + #else 15981 + .key = "\x00\x08" /* rta length */ 15982 + "\x00\x01" /* rta type */ 15983 + #endif 15984 + "\x00\x00\x00\x14" /* enc key length */ 15985 + "\x20\x21\x22\x23\x24\x25\x26\x27" 15986 + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" 15987 + "\x30\x31\x32\x33\x34\x35\x36\x37" 15988 + "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" 15989 + "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" 15990 + "\x43\xd6\xce\x1f\x32\x53\x91\x63" 15991 + "\x00\x6c\xb6\xdb", 15992 + .klen = 8 + 32 + 20, 15993 + .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", 15994 + .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", 15995 + .alen = 8, 15996 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 15997 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 15998 + "\x10\x11\x12\x13\x14\x15\x16\x17" 15999 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 16000 + .plen = 32, 16001 + .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" 16002 + "\x79\x0d\x41\xee\x8e\xda\xd3\x88" 16003 + "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" 16004 + "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" 16005 + "\x22\xf7\x95\xa8\xbb\xcd\x19\xf4" 16006 + "\x58\x16\x54\x28\x2b\xf4\x52\xe7" 16007 + "\x5c\x6c\xe1\x44\x0b\xd5\x10\x6e" 16008 + "\xe1\xf7\x04\xc4\x2c\xab\x93\xdd", 16009 + .clen = 32 + 32, 16010 + }, { /* RFC 3686 Case 3 */ 16011 + #ifdef __LITTLE_ENDIAN 16012 + .key = "\x08\x00" /* rta length */ 16013 + "\x01\x00" /* rta type */ 16014 + #else 16015 + .key = "\x00\x08" /* rta length */ 16016 + "\x00\x01" /* rta type */ 16017 + #endif 16018 + "\x00\x00\x00\x14" /* enc key length */ 16019 + "\x11\x22\x33\x44\x55\x66\x77\x88" 16020 + "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" 16021 + "\x22\x33\x44\x55\x66\x77\x88\x99" 16022 + "\xaa\xbb\xcc\xdd\xee\xff\x11\x22" 16023 + "\x76\x91\xbe\x03\x5e\x50\x20\xa8" 16024 + "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" 16025 + "\x00\xe0\x01\x7b", 16026 + .klen = 8 + 32 + 20, 16027 + .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", 16028 + .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", 16029 + .alen = 8, 16030 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 16031 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 16032 + "\x10\x11\x12\x13\x14\x15\x16\x17" 16033 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" 16034 + "\x20\x21\x22\x23", 16035 + .plen = 36, 16036 + .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" 16037 + "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" 16038 + "\x45\x40\xa4\x2b\xde\x6d\x78\x36" 16039 + "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" 16040 + "\x25\xb2\x07\x2f" 16041 + "\x1d\x05\x5f\x77\x3b\x4f\x5c\x21" 16042 + "\x29\xea\xf1\xa8\x71\x49\x7b\x0b" 16043 + "\x66\x0d\xff\x18\x81\x63\xfc\xc3" 16044 + "\x91\xb6\x38\xc8\xcd\x2d\x39\x83", 16045 + .clen = 36 + 32, 16046 + }, { /* RFC 3686 Case 4 */ 16047 + #ifdef __LITTLE_ENDIAN 16048 + .key = "\x08\x00" /* rta length */ 16049 + "\x01\x00" /* rta type */ 16050 + #else 16051 + .key = "\x00\x08" /* rta length */ 16052 + "\x00\x01" /* rta type */ 16053 + #endif 16054 + "\x00\x00\x00\x1c" /* enc key length */ 16055 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16056 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16057 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16058 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16059 + "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" 16060 + "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" 16061 + "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" 16062 + "\x00\x00\x00\x48", 16063 + .klen = 8 + 32 + 28, 16064 + .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", 16065 + .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", 16066 + .alen = 8, 16067 + .ptext = "Single block msg", 16068 + .plen = 16, 16069 + .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" 16070 + "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" 16071 + "\x8d\x03\x77\xb2\x1c\xc9\xe0\xac" 16072 + "\xde\x69\xbe\x8a\xef\x5b\x13\x74" 16073 + "\x1d\x39\xbc\xdc\x95\xa4\xbf\xc3" 16074 + "\xd5\xc6\xd1\xda\xda\x3b\xca\x78", 16075 + .clen = 16 + 32, 16076 + }, { /* RFC 3686 Case 5 */ 16077 + #ifdef __LITTLE_ENDIAN 16078 + .key = "\x08\x00" /* rta length */ 16079 + "\x01\x00" /* rta type */ 16080 + #else 16081 + .key = "\x00\x08" /* rta length */ 16082 + "\x00\x01" /* rta type */ 16083 + #endif 16084 + "\x00\x00\x00\x1c" /* enc key length */ 16085 + "\x20\x21\x22\x23\x24\x25\x26\x27" 16086 + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" 16087 + "\x30\x31\x32\x33\x34\x35\x36\x37" 16088 + "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" 16089 + "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" 16090 + "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" 16091 + "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" 16092 + "\x00\x96\xb0\x3b", 16093 + .klen = 8 + 32 + 28, 16094 + .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", 16095 + .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", 16096 + .alen = 8, 16097 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 16098 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 16099 + "\x10\x11\x12\x13\x14\x15\x16\x17" 16100 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 16101 + .plen = 32, 16102 + .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" 16103 + "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" 16104 + "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" 16105 + "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" 16106 + "\x34\x06\x2b\x3d\xf1\xa8\x3d\xf1" 16107 + "\xa6\x5e\x5c\x1a\xdb\x0c\xb5\x1e" 16108 + "\x8f\xdb\xf4\xca\x7d\x09\x5e\x81" 16109 + "\xdb\x32\x07\x4a\x1d\x1c\x6d\x83", 16110 + .clen = 32 + 32, 16111 + }, { /* RFC 3686 Case 7 */ 16112 + #ifdef __LITTLE_ENDIAN 16113 + .key = "\x08\x00" /* rta length */ 16114 + "\x01\x00" /* rta type */ 16115 + #else 16116 + .key = "\x00\x08" /* rta length */ 16117 + "\x00\x01" /* rta type */ 16118 + #endif 16119 + "\x00\x00\x00\x24" /* enc key length */ 16120 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16121 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16122 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16123 + "\x00\x00\x00\x00\x00\x00\x00\x00" 16124 + "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" 16125 + "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" 16126 + "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" 16127 + "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" 16128 + "\x00\x00\x00\x60", 16129 + .klen = 8 + 32 + 36, 16130 + .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", 16131 + .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", 16132 + .alen = 8, 16133 + .ptext = "Single block msg", 16134 + .plen = 16, 16135 + .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" 16136 + "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" 16137 + "\xc3\xb4\x5f\xb0\xbf\xf5\x1b\xff" 16138 + "\x7c\xf1\x79\x00\x63\x50\xdd\x77" 16139 + "\xc0\x4a\xba\xcd\xdc\x47\x05\x2a" 16140 + "\x5d\x85\x2d\x83\x44\xca\x79\x2c", 16141 + .clen = 16 + 32, 16142 + }, { /* RFC 3686 Case 8 */ 16143 + #ifdef __LITTLE_ENDIAN 16144 + .key = "\x08\x00" /* rta length */ 16145 + "\x01\x00" /* rta type */ 16146 + #else 16147 + .key = "\x00\x08" /* rta length */ 16148 + "\x00\x01" /* rta type */ 16149 + #endif 16150 + "\x00\x00\x00\x24" /* enc key length */ 16151 + "\x20\x21\x22\x23\x24\x25\x26\x27" 16152 + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" 16153 + "\x30\x31\x32\x33\x34\x35\x36\x37" 16154 + "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" 16155 + "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" 16156 + "\x07\x96\x36\x58\x79\xef\xf8\x86" 16157 + "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" 16158 + "\x4b\x50\x59\x0c\x87\xa2\x38\x84" 16159 + "\x00\xfa\xac\x24", 16160 + .klen = 8 + 32 + 36, 16161 + .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", 16162 + .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", 16163 + .alen = 8, 16164 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 16165 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 16166 + "\x10\x11\x12\x13\x14\x15\x16\x17" 16167 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 16168 + .plen = 32, 16169 + .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" 16170 + "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" 16171 + "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" 16172 + "\x55\x30\x83\x1d\x93\x44\xaf\x1c" 16173 + "\xc8\x59\x5d\xe1\xba\xac\x13\x82" 16174 + "\xfd\x21\x7c\x8c\x23\x31\x04\x02" 16175 + "\x9e\x69\x5b\x57\xa8\x13\xe7\x21" 16176 + "\x60\x0c\x24\xc2\x80\x4a\x93\x6e", 16177 + .clen = 32 + 32, 16178 + }, 16179 + }; 16180 + 15946 16181 static const struct aead_testvec hmac_sha384_aes_cbc_tv_temp[] = { 15947 16182 { /* RFC 3602 Case 1 */ 15948 16183 #ifdef __LITTLE_ENDIAN