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(sha512),rfc3686(ctr(aes)))

Test vectors were generated starting from existing RFC3686(CTR(AES)) test
vectors and adding HMAC(SHA512) 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
82fc2b17 2f081427

+296 -1
+5 -1
crypto/testmgr.c
··· 4281 4281 .fips_allowed = 1, 4282 4282 }, { 4283 4283 .alg = "authenc(hmac(sha512),rfc3686(ctr(aes)))", 4284 - .test = alg_test_null, 4284 + .generic_driver = "authenc(hmac-sha512-lib,rfc3686(ctr(aes-lib)))", 4285 + .test = alg_test_aead, 4285 4286 .fips_allowed = 1, 4287 + .suite = { 4288 + .aead = __VECS(hmac_sha512_aes_ctr_rfc3686_tv_temp) 4289 + } 4286 4290 }, { 4287 4291 .alg = "blake2b-160", 4288 4292 .generic_driver = "blake2b-160-lib",
+291
crypto/testmgr.h
··· 17148 17148 }, 17149 17149 }; 17150 17150 17151 + static const struct aead_testvec hmac_sha512_aes_ctr_rfc3686_tv_temp[] = { 17152 + { /* RFC 3686 Case 1 */ 17153 + #ifdef __LITTLE_ENDIAN 17154 + .key = "\x08\x00" /* rta length */ 17155 + "\x01\x00" /* rta type */ 17156 + #else 17157 + .key = "\x00\x08" /* rta length */ 17158 + "\x00\x01" /* rta type */ 17159 + #endif 17160 + "\x00\x00\x00\x14" /* enc key length */ 17161 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17162 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17163 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17164 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17165 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17166 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17167 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17168 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17169 + "\xae\x68\x52\xf8\x12\x10\x67\xcc" 17170 + "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" 17171 + "\x00\x00\x00\x30", 17172 + .klen = 8 + 64 + 20, 17173 + .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", 17174 + .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", 17175 + .alen = 8, 17176 + .ptext = "Single block msg", 17177 + .plen = 16, 17178 + .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" 17179 + "\x2d\x61\x75\xa3\x26\x13\x11\xb8" 17180 + "\xa4\x45\x3a\x44\x9c\xe5\x1c\xd9" 17181 + "\x10\x43\x51\x2e\x76\x5e\xf8\x9d" 17182 + "\x03\x12\x1a\x31\x00\x33\x10\xb4" 17183 + "\x94\x4b\x70\x84\x6c\xda\xb1\x46" 17184 + "\x24\xb6\x3b\x2a\xec\xd5\x67\xb8" 17185 + "\x65\xa2\xbd\xac\x18\xe2\xf8\x55" 17186 + "\xc6\x91\xb0\x92\x84\x2d\x74\x44" 17187 + "\xa7\xee\xc3\x44\xa0\x07\x0e\x62", 17188 + .clen = 16 + 64, 17189 + }, { /* RFC 3686 Case 2 */ 17190 + #ifdef __LITTLE_ENDIAN 17191 + .key = "\x08\x00" /* rta length */ 17192 + "\x01\x00" /* rta type */ 17193 + #else 17194 + .key = "\x00\x08" /* rta length */ 17195 + "\x00\x01" /* rta type */ 17196 + #endif 17197 + "\x00\x00\x00\x14" /* enc key length */ 17198 + "\x20\x21\x22\x23\x24\x25\x26\x27" 17199 + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" 17200 + "\x30\x31\x32\x33\x34\x35\x36\x37" 17201 + "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" 17202 + "\x40\x41\x42\x43\x44\x45\x46\x47" 17203 + "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" 17204 + "\x50\x51\x52\x53\x54\x55\x56\x57" 17205 + "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" 17206 + "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" 17207 + "\x43\xd6\xce\x1f\x32\x53\x91\x63" 17208 + "\x00\x6c\xb6\xdb", 17209 + .klen = 8 + 64 + 20, 17210 + .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", 17211 + .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", 17212 + .alen = 8, 17213 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 17214 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 17215 + "\x10\x11\x12\x13\x14\x15\x16\x17" 17216 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 17217 + .plen = 32, 17218 + .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" 17219 + "\x79\x0d\x41\xee\x8e\xda\xd3\x88" 17220 + "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" 17221 + "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" 17222 + "\xec\x67\x0d\xb3\xbd\x98\x13\x01" 17223 + "\x2b\x04\x9b\xe6\x06\x67\x3c\x76" 17224 + "\xcd\x41\xb7\xcc\x70\x6c\x7f\xc8" 17225 + "\x67\xbd\x22\x39\xb2\xaa\xe8\x88" 17226 + "\xe0\x4f\x81\x52\xdf\xc9\xc3\xd6" 17227 + "\x44\xf4\x66\x33\x87\x64\x61\x02" 17228 + "\x02\xa2\x64\x15\x2b\xe9\x0b\x3d" 17229 + "\x4c\xea\xa1\xa5\xa7\xc9\xd3\x1b", 17230 + .clen = 32 + 64, 17231 + }, { /* RFC 3686 Case 3 */ 17232 + #ifdef __LITTLE_ENDIAN 17233 + .key = "\x08\x00" /* rta length */ 17234 + "\x01\x00" /* rta type */ 17235 + #else 17236 + .key = "\x00\x08" /* rta length */ 17237 + "\x00\x01" /* rta type */ 17238 + #endif 17239 + "\x00\x00\x00\x14" /* enc key length */ 17240 + "\x11\x22\x33\x44\x55\x66\x77\x88" 17241 + "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" 17242 + "\x22\x33\x44\x55\x66\x77\x88\x99" 17243 + "\xaa\xbb\xcc\xdd\xee\xff\x11\x22" 17244 + "\x33\x44\x55\x66\x77\x88\x99\xaa" 17245 + "\xbb\xcc\xdd\xee\xff\x11\x22\x33" 17246 + "\x44\x55\x66\x77\x88\x99\xaa\xbb" 17247 + "\xcc\xdd\xee\xff\x11\x22\x33\x44" 17248 + "\x76\x91\xbe\x03\x5e\x50\x20\xa8" 17249 + "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" 17250 + "\x00\xe0\x01\x7b", 17251 + .klen = 8 + 64 + 20, 17252 + .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", 17253 + .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", 17254 + .alen = 8, 17255 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 17256 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 17257 + "\x10\x11\x12\x13\x14\x15\x16\x17" 17258 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" 17259 + "\x20\x21\x22\x23", 17260 + .plen = 36, 17261 + .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" 17262 + "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" 17263 + "\x45\x40\xa4\x2b\xde\x6d\x78\x36" 17264 + "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" 17265 + "\x25\xb2\x07\x2f" 17266 + "\x6f\x90\xb6\xa3\x35\x43\x59\xff" 17267 + "\x1e\x32\xd6\xfe\xfa\x33\xf9\xf0" 17268 + "\x31\x2f\x03\x2d\x88\x1d\xab\xbf" 17269 + "\x0e\x19\x16\xd9\xf3\x98\x3e\xdd" 17270 + "\x0c\xec\xfe\xe8\x89\x13\x91\x15" 17271 + "\xf6\x61\x65\x5c\x1b\x7d\xde\xc0" 17272 + "\xe4\xba\x6d\x27\xe2\x89\x23\x24" 17273 + "\x15\x82\x37\x3d\x48\xd3\xc9\x32", 17274 + .clen = 36 + 64, 17275 + }, { /* RFC 3686 Case 4 */ 17276 + #ifdef __LITTLE_ENDIAN 17277 + .key = "\x08\x00" /* rta length */ 17278 + "\x01\x00" /* rta type */ 17279 + #else 17280 + .key = "\x00\x08" /* rta length */ 17281 + "\x00\x01" /* rta type */ 17282 + #endif 17283 + "\x00\x00\x00\x1c" /* enc key length */ 17284 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17285 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17286 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17287 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17288 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17289 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17290 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17291 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17292 + "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" 17293 + "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" 17294 + "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" 17295 + "\x00\x00\x00\x48", 17296 + .klen = 8 + 64 + 28, 17297 + .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", 17298 + .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", 17299 + .alen = 8, 17300 + .ptext = "Single block msg", 17301 + .plen = 16, 17302 + .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" 17303 + "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" 17304 + "\x25\xea\xdc\xad\x52\xb8\x0f\x70" 17305 + "\xe7\x39\x83\x80\x10\x3f\x18\xc4" 17306 + "\xf8\x59\x14\x25\x5f\xba\x20\x87" 17307 + "\x0b\x04\x5e\xf7\xde\x41\x39\xff" 17308 + "\xa2\xee\x84\x3f\x9d\x38\xfd\x17" 17309 + "\xc0\x66\x5e\x74\x39\xe3\xd3\xd7" 17310 + "\x3d\xbc\xe3\x99\x2f\xe7\xef\x37" 17311 + "\x61\x03\xf3\x9e\x01\xaf\xba\x9d", 17312 + .clen = 16 + 64, 17313 + }, { /* RFC 3686 Case 5 */ 17314 + #ifdef __LITTLE_ENDIAN 17315 + .key = "\x08\x00" /* rta length */ 17316 + "\x01\x00" /* rta type */ 17317 + #else 17318 + .key = "\x00\x08" /* rta length */ 17319 + "\x00\x01" /* rta type */ 17320 + #endif 17321 + "\x00\x00\x00\x1c" /* enc key length */ 17322 + "\x20\x21\x22\x23\x24\x25\x26\x27" 17323 + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" 17324 + "\x30\x31\x32\x33\x34\x35\x36\x37" 17325 + "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" 17326 + "\x40\x41\x42\x43\x44\x45\x46\x47" 17327 + "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" 17328 + "\x50\x51\x52\x53\x54\x55\x56\x57" 17329 + "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" 17330 + "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" 17331 + "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" 17332 + "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" 17333 + "\x00\x96\xb0\x3b", 17334 + .klen = 8 + 64 + 28, 17335 + .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", 17336 + .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", 17337 + .alen = 8, 17338 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 17339 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 17340 + "\x10\x11\x12\x13\x14\x15\x16\x17" 17341 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 17342 + .plen = 32, 17343 + .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" 17344 + "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" 17345 + "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" 17346 + "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" 17347 + "\x51\xa3\xe6\x1d\x23\x7d\xd1\x18" 17348 + "\x55\x9c\x1c\x92\x2b\xc2\xcd\xfe" 17349 + "\x8a\xa8\xa5\x96\x65\x2e\x9d\xdb" 17350 + "\x06\xd2\x1c\x57\x2b\x76\xb5\x9c" 17351 + "\xd4\x3e\x8b\x61\x54\x2d\x08\xe5" 17352 + "\xb2\xf8\x88\x20\x0c\xad\xe8\x85" 17353 + "\x61\x8e\x5c\xa4\x96\x2c\xe2\x7d" 17354 + "\x4f\xb6\x1d\xb2\x8c\xd7\xe3\x38", 17355 + .clen = 32 + 64, 17356 + }, { /* RFC 3686 Case 7 */ 17357 + #ifdef __LITTLE_ENDIAN 17358 + .key = "\x08\x00" /* rta length */ 17359 + "\x01\x00" /* rta type */ 17360 + #else 17361 + .key = "\x00\x08" /* rta length */ 17362 + "\x00\x01" /* rta type */ 17363 + #endif 17364 + "\x00\x00\x00\x24" /* enc key length */ 17365 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17366 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17367 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17368 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17369 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17370 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17371 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17372 + "\x00\x00\x00\x00\x00\x00\x00\x00" 17373 + "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" 17374 + "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" 17375 + "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" 17376 + "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" 17377 + "\x00\x00\x00\x60", 17378 + .klen = 8 + 64 + 36, 17379 + .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", 17380 + .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", 17381 + .alen = 8, 17382 + .ptext = "Single block msg", 17383 + .plen = 16, 17384 + .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" 17385 + "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" 17386 + "\x6b\x68\x0b\x99\x9a\x4d\xc8\xb9" 17387 + "\x35\xea\xcd\x56\x3f\x40\xa2\xb6" 17388 + "\x68\xda\x59\xd8\xa0\x89\xcd\x52" 17389 + "\xb1\x6e\xed\xc1\x42\x10\xa5\x0f" 17390 + "\x88\x0b\x80\xce\xc4\x67\xf0\x45" 17391 + "\x5d\xb2\x9e\xde\x1c\x79\x52\x0d" 17392 + "\xff\x75\x36\xd5\x0f\x52\x8e\xe5" 17393 + "\x31\x85\xcf\x1d\x31\xf8\x62\x67", 17394 + .clen = 16 + 64, 17395 + }, { /* RFC 3686 Case 8 */ 17396 + #ifdef __LITTLE_ENDIAN 17397 + .key = "\x08\x00" /* rta length */ 17398 + "\x01\x00" /* rta type */ 17399 + #else 17400 + .key = "\x00\x08" /* rta length */ 17401 + "\x00\x01" /* rta type */ 17402 + #endif 17403 + "\x00\x00\x00\x24" /* enc key length */ 17404 + "\x20\x21\x22\x23\x24\x25\x26\x27" 17405 + "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" 17406 + "\x30\x31\x32\x33\x34\x35\x36\x37" 17407 + "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" 17408 + "\x40\x41\x42\x43\x44\x45\x46\x47" 17409 + "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" 17410 + "\x50\x51\x52\x53\x54\x55\x56\x57" 17411 + "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" 17412 + "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" 17413 + "\x07\x96\x36\x58\x79\xef\xf8\x86" 17414 + "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" 17415 + "\x4b\x50\x59\x0c\x87\xa2\x38\x84" 17416 + "\x00\xfa\xac\x24", 17417 + .klen = 8 + 64 + 36, 17418 + .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", 17419 + .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", 17420 + .alen = 8, 17421 + .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" 17422 + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" 17423 + "\x10\x11\x12\x13\x14\x15\x16\x17" 17424 + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 17425 + .plen = 32, 17426 + .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" 17427 + "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" 17428 + "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" 17429 + "\x55\x30\x83\x1d\x93\x44\xaf\x1c" 17430 + "\x9a\xac\x38\xbd\xf3\xcf\xd5\xd0" 17431 + "\x09\x07\xa6\xe1\x7f\xd6\x79\x98" 17432 + "\x4e\x90\x0e\xc0\x3d\xa0\xf2\x12" 17433 + "\x52\x79\x9c\x17\xff\xb9\xb8\xe3" 17434 + "\x2f\x31\xcb\xbd\x63\x70\x72\x7b" 17435 + "\x4e\x1e\xd1\xde\xb5\x6b\x7d\x54" 17436 + "\x68\x56\xdd\xe5\x53\xee\x29\xd2" 17437 + "\x85\xa1\x73\x61\x00\xa9\x26\x8f", 17438 + .clen = 32 + 64, 17439 + }, 17440 + }; 17441 + 17151 17442 static const struct aead_testvec hmac_sha1_des_cbc_tv_temp[] = { 17152 17443 { /*Generated with cryptopp*/ 17153 17444 #ifdef __LITTLE_ENDIAN