testmngr.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. /****************************************************************************
  2. * include/crypto/testmngr.h
  3. *
  4. * Copyright (C) 2014 Gregory Nutt. All rights reserved.
  5. * Author: Max Nekludov <macscomp@gmail.com>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. * 3. Neither the name NuttX nor the names of its contributors may be
  18. * used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. * POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ****************************************************************************/
  35. #ifndef __CRYPTO_TESTMNGR_H
  36. #define __CRYPTO_TESTMNGR_H
  37. /****************************************************************************
  38. * Included Files
  39. ****************************************************************************/
  40. #include <nuttx/config.h>
  41. /****************************************************************************
  42. * Pre-processor Definitions
  43. ****************************************************************************/
  44. struct cipher_testvec
  45. {
  46. FAR char *key;
  47. FAR char *iv;
  48. FAR char *input;
  49. FAR char *result;
  50. int np;
  51. unsigned char fail;
  52. unsigned char wk;
  53. unsigned char klen;
  54. unsigned short ilen;
  55. unsigned short rlen;
  56. };
  57. #if defined(CONFIG_CRYPTO_AES)
  58. /* AES test vectors */
  59. static struct cipher_testvec aes_enc_tv_template[] =
  60. {
  61. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  62. { /* From FIPS-197 */
  63. .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
  64. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  65. .klen = 16,
  66. .input = "\x00\x11\x22\x33\x44\x55\x66\x77"
  67. "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
  68. .ilen = 16,
  69. .result = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30"
  70. "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a",
  71. .rlen = 16,
  72. },
  73. #endif
  74. #ifndef CONFIG_CRYPTO_AES192_DISABLE
  75. {
  76. .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
  77. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
  78. "\x10\x11\x12\x13\x14\x15\x16\x17",
  79. .klen = 24,
  80. .input = "\x00\x11\x22\x33\x44\x55\x66\x77"
  81. "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
  82. .ilen = 16,
  83. .result = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0"
  84. "\x6e\xaf\x70\xa0\xec\x0d\x71\x91",
  85. .rlen = 16,
  86. },
  87. #endif
  88. #ifndef CONFIG_CRYPTO_AES256_DISABLE
  89. {
  90. .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
  91. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
  92. "\x10\x11\x12\x13\x14\x15\x16\x17"
  93. "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
  94. .klen = 32,
  95. .input = "\x00\x11\x22\x33\x44\x55\x66\x77"
  96. "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
  97. .ilen = 16,
  98. .result = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf"
  99. "\xea\xfc\x49\x90\x4b\x49\x60\x89",
  100. .rlen = 16,
  101. },
  102. #endif
  103. };
  104. static struct cipher_testvec aes_dec_tv_template[] =
  105. {
  106. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  107. { /* From FIPS-197 */
  108. .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
  109. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  110. .klen = 16,
  111. .input = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30"
  112. "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a",
  113. .ilen = 16,
  114. .result = "\x00\x11\x22\x33\x44\x55\x66\x77"
  115. "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
  116. .rlen = 16,
  117. },
  118. #endif
  119. #ifndef CONFIG_CRYPTO_AES192_DISABLE
  120. {
  121. .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
  122. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
  123. "\x10\x11\x12\x13\x14\x15\x16\x17",
  124. .klen = 24,
  125. .input = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0"
  126. "\x6e\xaf\x70\xa0\xec\x0d\x71\x91",
  127. .ilen = 16,
  128. .result = "\x00\x11\x22\x33\x44\x55\x66\x77"
  129. "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
  130. .rlen = 16,
  131. },
  132. #endif
  133. #ifndef CONFIG_CRYPTO_AES256_DISABLE
  134. {
  135. .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
  136. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
  137. "\x10\x11\x12\x13\x14\x15\x16\x17"
  138. "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
  139. .klen = 32,
  140. .input = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf"
  141. "\xea\xfc\x49\x90\x4b\x49\x60\x89",
  142. .ilen = 16,
  143. .result = "\x00\x11\x22\x33\x44\x55\x66\x77"
  144. "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
  145. .rlen = 16,
  146. },
  147. #endif
  148. };
  149. static struct cipher_testvec aes_cbc_enc_tv_template[] =
  150. {
  151. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  152. { /* From RFC 3602 */
  153. .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b"
  154. "\x51\x2e\x03\xd5\x34\x12\x00\x06",
  155. .klen = 16,
  156. .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30"
  157. "\xb4\x22\xda\x80\x2c\x9f\xac\x41",
  158. .input = "Single block msg",
  159. .ilen = 16,
  160. .result = "\xe3\x53\x77\x9c\x10\x79\xae\xb8"
  161. "\x27\x08\x94\x2d\xbe\x77\x18\x1a",
  162. .rlen = 16,
  163. },
  164. #endif
  165. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  166. {
  167. .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0"
  168. "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a",
  169. .klen = 16,
  170. .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28"
  171. "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58",
  172. .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
  173. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
  174. "\x10\x11\x12\x13\x14\x15\x16\x17"
  175. "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
  176. .ilen = 32,
  177. .result = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a"
  178. "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a"
  179. "\x75\x86\x60\x2d\x25\x3c\xff\xf9"
  180. "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1",
  181. .rlen = 32,
  182. },
  183. #endif
  184. #ifndef CONFIG_CRYPTO_AES192_DISABLE
  185. { /* From NIST SP800-38A */
  186. .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
  187. "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
  188. "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
  189. .klen = 24,
  190. .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
  191. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  192. .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  193. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  194. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  195. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  196. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  197. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  198. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  199. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  200. .ilen = 64,
  201. .result = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d"
  202. "\x71\x78\x18\x3a\x9f\xa0\x71\xe8"
  203. "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4"
  204. "\xe5\xe7\x38\x76\x3f\x69\x14\x5a"
  205. "\x57\x1b\x24\x20\x12\xfb\x7a\xe0"
  206. "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0"
  207. "\x08\xb0\xe2\x79\x88\x59\x88\x81"
  208. "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd",
  209. .rlen = 64,
  210. },
  211. #endif
  212. #ifndef CONFIG_CRYPTO_AES256_DISABLE
  213. {
  214. .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
  215. "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
  216. "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
  217. "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
  218. .klen = 32,
  219. .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
  220. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  221. .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  222. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  223. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  224. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  225. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  226. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  227. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  228. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  229. .ilen = 64,
  230. .result = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba"
  231. "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6"
  232. "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d"
  233. "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d"
  234. "\x39\xf2\x33\x69\xa9\xd9\xba\xcf"
  235. "\xa5\x30\xe2\x63\x04\x23\x14\x61"
  236. "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc"
  237. "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b",
  238. .rlen = 64,
  239. },
  240. #endif
  241. };
  242. static struct cipher_testvec aes_cbc_dec_tv_template[] =
  243. {
  244. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  245. { /* From RFC 3602 */
  246. .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b"
  247. "\x51\x2e\x03\xd5\x34\x12\x00\x06",
  248. .klen = 16,
  249. .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30"
  250. "\xb4\x22\xda\x80\x2c\x9f\xac\x41",
  251. .input = "\xe3\x53\x77\x9c\x10\x79\xae\xb8"
  252. "\x27\x08\x94\x2d\xbe\x77\x18\x1a",
  253. .ilen = 16,
  254. .result = "Single block msg",
  255. .rlen = 16,
  256. },
  257. #endif
  258. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  259. {
  260. .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0"
  261. "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a",
  262. .klen = 16,
  263. .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28"
  264. "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58",
  265. .input = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a"
  266. "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a"
  267. "\x75\x86\x60\x2d\x25\x3c\xff\xf9"
  268. "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1",
  269. .ilen = 32,
  270. .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
  271. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
  272. "\x10\x11\x12\x13\x14\x15\x16\x17"
  273. "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
  274. .rlen = 32,
  275. },
  276. #endif
  277. #ifndef CONFIG_CRYPTO_AES192_DISABLE
  278. { /* From NIST SP800-38A */
  279. .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
  280. "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
  281. "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
  282. .klen = 24,
  283. .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
  284. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  285. .input = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d"
  286. "\x71\x78\x18\x3a\x9f\xa0\x71\xe8"
  287. "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4"
  288. "\xe5\xe7\x38\x76\x3f\x69\x14\x5a"
  289. "\x57\x1b\x24\x20\x12\xfb\x7a\xe0"
  290. "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0"
  291. "\x08\xb0\xe2\x79\x88\x59\x88\x81"
  292. "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd",
  293. .ilen = 64,
  294. .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  295. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  296. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  297. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  298. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  299. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  300. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  301. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  302. .rlen = 64,
  303. },
  304. #endif
  305. #ifndef CONFIG_CRYPTO_AES256_DISABLE
  306. {
  307. .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
  308. "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
  309. "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
  310. "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
  311. .klen = 32,
  312. .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
  313. "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  314. .input = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba"
  315. "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6"
  316. "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d"
  317. "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d"
  318. "\x39\xf2\x33\x69\xa9\xd9\xba\xcf"
  319. "\xa5\x30\xe2\x63\x04\x23\x14\x61"
  320. "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc"
  321. "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b",
  322. .ilen = 64,
  323. .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  324. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  325. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  326. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  327. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  328. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  329. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  330. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  331. .rlen = 64,
  332. },
  333. #endif
  334. };
  335. static struct cipher_testvec aes_ctr_enc_tv_template[] =
  336. {
  337. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  338. { /* From NIST Special Publication 800-38A, Appendix F.5 */
  339. .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
  340. "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
  341. .klen = 16,
  342. .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
  343. "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
  344. .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  345. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  346. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  347. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  348. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  349. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  350. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  351. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  352. .ilen = 64,
  353. .result = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
  354. "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
  355. "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
  356. "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
  357. "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
  358. "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
  359. "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
  360. "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
  361. .rlen = 64,
  362. },
  363. #endif
  364. #ifndef CONFIG_CRYPTO_AES192_DISABLE
  365. {
  366. .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
  367. "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
  368. "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
  369. .klen = 24,
  370. .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
  371. "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
  372. .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  373. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  374. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  375. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  376. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  377. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  378. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  379. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  380. .ilen = 64,
  381. .result = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
  382. "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
  383. "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
  384. "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
  385. "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
  386. "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
  387. "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
  388. "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
  389. .rlen = 64,
  390. },
  391. #endif
  392. #ifndef CONFIG_CRYPTO_AES256_DISABLE
  393. {
  394. .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
  395. "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
  396. "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
  397. "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
  398. .klen = 32,
  399. .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
  400. "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
  401. .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  402. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  403. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  404. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  405. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  406. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  407. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  408. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  409. .ilen = 64,
  410. .result = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
  411. "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
  412. "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
  413. "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
  414. "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
  415. "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
  416. "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
  417. "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
  418. .rlen = 64,
  419. }
  420. #endif
  421. };
  422. static struct cipher_testvec aes_ctr_dec_tv_template[] =
  423. {
  424. #ifndef CONFIG_CRYPTO_AES128_DISABLE
  425. { /* From NIST Special Publication 800-38A, Appendix F.5 */
  426. .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
  427. "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
  428. .klen = 16,
  429. .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
  430. "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
  431. .input = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
  432. "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
  433. "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
  434. "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
  435. "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
  436. "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
  437. "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
  438. "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
  439. .ilen = 64,
  440. .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  441. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  442. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  443. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  444. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  445. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  446. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  447. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  448. .rlen = 64,
  449. },
  450. #endif
  451. #ifndef CONFIG_CRYPTO_AES192_DISABLE
  452. {
  453. .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
  454. "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
  455. "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
  456. .klen = 24,
  457. .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
  458. "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
  459. .input = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
  460. "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
  461. "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
  462. "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
  463. "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
  464. "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
  465. "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
  466. "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
  467. .ilen = 64,
  468. .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  469. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  470. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  471. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  472. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  473. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  474. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  475. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  476. .rlen = 64,
  477. },
  478. #endif
  479. #ifndef CONFIG_CRYPTO_AES256_DISABLE
  480. {
  481. .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
  482. "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
  483. "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
  484. "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
  485. .klen = 32,
  486. .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
  487. "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
  488. .input = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
  489. "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
  490. "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
  491. "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
  492. "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
  493. "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
  494. "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
  495. "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
  496. .ilen = 64,
  497. .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  498. "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  499. "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  500. "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  501. "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  502. "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  503. "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  504. "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  505. .rlen = 64,
  506. }
  507. #endif
  508. };
  509. #endif /* CONFIG_CRYPTO_AES */
  510. #endif /* __CRYPTO_TESTMNGR_H */