poly1305_internal_test.c 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576
  1. /*
  2. * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. /* Internal tests for the poly1305 module */
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include "testutil.h"
  13. #include "internal/poly1305.h"
  14. #include "../crypto/poly1305/poly1305_local.h"
  15. #include "internal/nelem.h"
  16. typedef struct {
  17. size_t size;
  18. const unsigned char data[1024];
  19. } SIZED_DATA;
  20. typedef struct {
  21. SIZED_DATA input;
  22. SIZED_DATA key;
  23. SIZED_DATA expected;
  24. } TESTDATA;
  25. /**********************************************************************
  26. *
  27. * Test of poly1305 internal functions
  28. *
  29. ***/
  30. static TESTDATA tests[] = {
  31. /*
  32. * RFC7539
  33. */
  34. {
  35. {
  36. 34,
  37. {
  38. 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x67, 0x72,
  39. 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x46, 0x6f,
  40. 0x72, 0x75, 0x6d, 0x20, 0x52, 0x65, 0x73, 0x65,
  41. 0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6f,
  42. 0x75, 0x70
  43. }
  44. },
  45. {
  46. 32,
  47. {
  48. 0x85, 0xd6, 0xbe, 0x78, 0x57, 0x55, 0x6d, 0x33,
  49. 0x7f, 0x44, 0x52, 0xfe, 0x42, 0xd5, 0x06, 0xa8,
  50. 0x01, 0x03, 0x80, 0x8a, 0xfb, 0x0d, 0xb2, 0xfd,
  51. 0x4a, 0xbf, 0xf6, 0xaf, 0x41, 0x49, 0xf5, 0x1b
  52. }
  53. },
  54. {
  55. 16,
  56. {
  57. 0xa8, 0x06, 0x1d, 0xc1, 0x30, 0x51, 0x36, 0xc6,
  58. 0xc2, 0x2b, 0x8b, 0xaf, 0x0c, 0x01, 0x27, 0xa9
  59. }
  60. }
  61. },
  62. /*
  63. * test vectors from "The Poly1305-AES message-authentication code"
  64. */
  65. {
  66. {
  67. 2,
  68. {
  69. 0xf3, 0xf6
  70. }
  71. },
  72. {
  73. 32,
  74. {
  75. 0x85, 0x1f, 0xc4, 0x0c, 0x34, 0x67, 0xac, 0x0b,
  76. 0xe0, 0x5c, 0xc2, 0x04, 0x04, 0xf3, 0xf7, 0x00,
  77. 0x58, 0x0b, 0x3b, 0x0f, 0x94, 0x47, 0xbb, 0x1e,
  78. 0x69, 0xd0, 0x95, 0xb5, 0x92, 0x8b, 0x6d, 0xbc
  79. }
  80. },
  81. {
  82. 16,
  83. {
  84. 0xf4, 0xc6, 0x33, 0xc3, 0x04, 0x4f, 0xc1, 0x45,
  85. 0xf8, 0x4f, 0x33, 0x5c, 0xb8, 0x19, 0x53, 0xde
  86. }
  87. }
  88. },
  89. {
  90. {
  91. 0,
  92. {
  93. 0
  94. }
  95. },
  96. {
  97. 32,
  98. {
  99. 0xa0, 0xf3, 0x08, 0x00, 0x00, 0xf4, 0x64, 0x00,
  100. 0xd0, 0xc7, 0xe9, 0x07, 0x6c, 0x83, 0x44, 0x03,
  101. 0xdd, 0x3f, 0xab, 0x22, 0x51, 0xf1, 0x1a, 0xc7,
  102. 0x59, 0xf0, 0x88, 0x71, 0x29, 0xcc, 0x2e, 0xe7
  103. }
  104. },
  105. {
  106. 16,
  107. {
  108. 0xdd, 0x3f, 0xab, 0x22, 0x51, 0xf1, 0x1a, 0xc7,
  109. 0x59, 0xf0, 0x88, 0x71, 0x29, 0xcc, 0x2e, 0xe7
  110. }
  111. }
  112. },
  113. {
  114. {
  115. 32,
  116. {
  117. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  118. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  119. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  120. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
  121. }
  122. },
  123. {
  124. 32,
  125. {
  126. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  127. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  128. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  129. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef
  130. }
  131. },
  132. {
  133. 16,
  134. {
  135. 0x0e, 0xe1, 0xc1, 0x6b, 0xb7, 0x3f, 0x0f, 0x4f,
  136. 0xd1, 0x98, 0x81, 0x75, 0x3c, 0x01, 0xcd, 0xbe
  137. }
  138. }
  139. },
  140. {
  141. {
  142. 63,
  143. {
  144. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  145. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  146. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  147. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  148. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  149. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  150. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  151. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9
  152. }
  153. },
  154. {
  155. 32,
  156. {
  157. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  158. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  159. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  160. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  161. }
  162. },
  163. {
  164. 16,
  165. {
  166. 0x51, 0x54, 0xad, 0x0d, 0x2c, 0xb2, 0x6e, 0x01,
  167. 0x27, 0x4f, 0xc5, 0x11, 0x48, 0x49, 0x1f, 0x1b
  168. }
  169. },
  170. },
  171. /*
  172. * self-generated vectors exercise "significant" lengths, such that
  173. * are handled by different code paths
  174. */
  175. {
  176. {
  177. 64,
  178. {
  179. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  180. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  181. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  182. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  183. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  184. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  185. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  186. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf
  187. }
  188. },
  189. {
  190. 32,
  191. {
  192. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  193. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  194. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  195. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  196. }
  197. },
  198. {
  199. 16,
  200. {
  201. 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
  202. 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66
  203. }
  204. },
  205. },
  206. {
  207. {
  208. 48,
  209. {
  210. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  211. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  212. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  213. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  214. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  215. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67
  216. }
  217. },
  218. {
  219. 32,
  220. {
  221. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  222. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  223. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  224. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  225. }
  226. },
  227. {
  228. 16,
  229. {
  230. 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
  231. 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61
  232. }
  233. },
  234. },
  235. {
  236. {
  237. 96,
  238. {
  239. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  240. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  241. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  242. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  243. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  244. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  245. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  246. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  247. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  248. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  249. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  250. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
  251. }
  252. },
  253. {
  254. 32,
  255. {
  256. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  257. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  258. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  259. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  260. }
  261. },
  262. {
  263. 16,
  264. {
  265. 0xbb, 0xb6, 0x13, 0xb2, 0xb6, 0xd7, 0x53, 0xba,
  266. 0x07, 0x39, 0x5b, 0x91, 0x6a, 0xae, 0xce, 0x15
  267. }
  268. },
  269. },
  270. {
  271. {
  272. 112,
  273. {
  274. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  275. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  276. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  277. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  278. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  279. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  280. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  281. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  282. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  283. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  284. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  285. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  286. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  287. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24
  288. }
  289. },
  290. {
  291. 32,
  292. {
  293. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  294. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  295. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  296. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  297. }
  298. },
  299. {
  300. 16,
  301. {
  302. 0xc7, 0x94, 0xd7, 0x05, 0x7d, 0x17, 0x78, 0xc4,
  303. 0xbb, 0xee, 0x0a, 0x39, 0xb3, 0xd9, 0x73, 0x42
  304. }
  305. },
  306. },
  307. {
  308. {
  309. 128,
  310. {
  311. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  312. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  313. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  314. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  315. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  316. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  317. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  318. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  319. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  320. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  321. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  322. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  323. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  324. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  325. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  326. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
  327. }
  328. },
  329. {
  330. 32,
  331. {
  332. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  333. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  334. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  335. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  336. }
  337. },
  338. {
  339. 16,
  340. {
  341. 0xff, 0xbc, 0xb9, 0xb3, 0x71, 0x42, 0x31, 0x52,
  342. 0xd7, 0xfc, 0xa5, 0xad, 0x04, 0x2f, 0xba, 0xa9
  343. }
  344. },
  345. },
  346. {
  347. {
  348. 144,
  349. {
  350. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  351. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  352. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  353. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  354. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  355. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  356. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  357. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  358. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  359. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  360. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  361. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  362. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  363. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  364. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  365. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
  366. 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
  367. 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66
  368. }
  369. },
  370. {
  371. 32,
  372. {
  373. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  374. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  375. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  376. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  377. }
  378. },
  379. {
  380. 16,
  381. {
  382. 0x06, 0x9e, 0xd6, 0xb8, 0xef, 0x0f, 0x20, 0x7b,
  383. 0x3e, 0x24, 0x3b, 0xb1, 0x01, 0x9f, 0xe6, 0x32
  384. }
  385. },
  386. },
  387. {
  388. {
  389. 160,
  390. {
  391. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  392. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  393. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  394. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  395. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  396. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  397. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  398. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  399. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  400. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  401. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  402. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  403. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  404. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  405. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  406. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
  407. 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
  408. 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
  409. 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
  410. 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61
  411. }
  412. },
  413. {
  414. 32,
  415. {
  416. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  417. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  418. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  419. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  420. }
  421. },
  422. {
  423. 16,
  424. {
  425. 0xcc, 0xa3, 0x39, 0xd9, 0xa4, 0x5f, 0xa2, 0x36,
  426. 0x8c, 0x2c, 0x68, 0xb3, 0xa4, 0x17, 0x91, 0x33
  427. }
  428. },
  429. },
  430. {
  431. {
  432. 288,
  433. {
  434. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  435. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  436. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  437. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  438. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  439. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  440. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  441. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  442. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  443. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  444. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  445. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  446. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  447. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  448. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  449. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
  450. 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
  451. 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
  452. 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
  453. 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61,
  454. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  455. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  456. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  457. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  458. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  459. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  460. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  461. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  462. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  463. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  464. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  465. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  466. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  467. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  468. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  469. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
  470. }
  471. },
  472. {
  473. 32,
  474. {
  475. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  476. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  477. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  478. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  479. }
  480. },
  481. {
  482. 16,
  483. {
  484. 0x53, 0xf6, 0xe8, 0x28, 0xa2, 0xf0, 0xfe, 0x0e,
  485. 0xe8, 0x15, 0xbf, 0x0b, 0xd5, 0x84, 0x1a, 0x34
  486. }
  487. },
  488. },
  489. {
  490. {
  491. 320,
  492. {
  493. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  494. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  495. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  496. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  497. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  498. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  499. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  500. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  501. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  502. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  503. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  504. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  505. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  506. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  507. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  508. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
  509. 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
  510. 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
  511. 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
  512. 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61,
  513. 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
  514. 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
  515. 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
  516. 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
  517. 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
  518. 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
  519. 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
  520. 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
  521. 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
  522. 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
  523. 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
  524. 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
  525. 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
  526. 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
  527. 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
  528. 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
  529. 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
  530. 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
  531. 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
  532. 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61
  533. }
  534. },
  535. {
  536. 32,
  537. {
  538. 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
  539. 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
  540. 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
  541. 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
  542. }
  543. },
  544. {
  545. 16,
  546. {
  547. 0xb8, 0x46, 0xd4, 0x4e, 0x9b, 0xbd, 0x53, 0xce,
  548. 0xdf, 0xfb, 0xfb, 0xb6, 0xb7, 0xfa, 0x49, 0x33
  549. }
  550. },
  551. },
  552. /*
  553. * 4th power of the key spills to 131th bit in SIMD key setup
  554. */
  555. {
  556. {
  557. 256,
  558. {
  559. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  560. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  561. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  562. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  563. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  564. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  565. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  566. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  567. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  568. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  569. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  570. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  571. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  572. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  573. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  574. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  575. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  576. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  577. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  578. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  579. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  580. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  581. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  582. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  583. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  584. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  585. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  586. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  587. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  588. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  589. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  590. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  591. }
  592. },
  593. {
  594. 32,
  595. {
  596. 0xad, 0x62, 0x81, 0x07, 0xe8, 0x35, 0x1d, 0x0f,
  597. 0x2c, 0x23, 0x1a, 0x05, 0xdc, 0x4a, 0x41, 0x06,
  598. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  599. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  600. }
  601. },
  602. {
  603. 16,
  604. {
  605. 0x07, 0x14, 0x5a, 0x4c, 0x02, 0xfe, 0x5f, 0xa3,
  606. 0x20, 0x36, 0xde, 0x68, 0xfa, 0xbe, 0x90, 0x66
  607. }
  608. },
  609. },
  610. /*
  611. * poly1305_ieee754.c failed this in final stage
  612. */
  613. {
  614. {
  615. 252,
  616. {
  617. 0x84, 0x23, 0x64, 0xe1, 0x56, 0x33, 0x6c, 0x09,
  618. 0x98, 0xb9, 0x33, 0xa6, 0x23, 0x77, 0x26, 0x18,
  619. 0x0d, 0x9e, 0x3f, 0xdc, 0xbd, 0xe4, 0xcd, 0x5d,
  620. 0x17, 0x08, 0x0f, 0xc3, 0xbe, 0xb4, 0x96, 0x14,
  621. 0xd7, 0x12, 0x2c, 0x03, 0x74, 0x63, 0xff, 0x10,
  622. 0x4d, 0x73, 0xf1, 0x9c, 0x12, 0x70, 0x46, 0x28,
  623. 0xd4, 0x17, 0xc4, 0xc5, 0x4a, 0x3f, 0xe3, 0x0d,
  624. 0x3c, 0x3d, 0x77, 0x14, 0x38, 0x2d, 0x43, 0xb0,
  625. 0x38, 0x2a, 0x50, 0xa5, 0xde, 0xe5, 0x4b, 0xe8,
  626. 0x44, 0xb0, 0x76, 0xe8, 0xdf, 0x88, 0x20, 0x1a,
  627. 0x1c, 0xd4, 0x3b, 0x90, 0xeb, 0x21, 0x64, 0x3f,
  628. 0xa9, 0x6f, 0x39, 0xb5, 0x18, 0xaa, 0x83, 0x40,
  629. 0xc9, 0x42, 0xff, 0x3c, 0x31, 0xba, 0xf7, 0xc9,
  630. 0xbd, 0xbf, 0x0f, 0x31, 0xae, 0x3f, 0xa0, 0x96,
  631. 0xbf, 0x8c, 0x63, 0x03, 0x06, 0x09, 0x82, 0x9f,
  632. 0xe7, 0x2e, 0x17, 0x98, 0x24, 0x89, 0x0b, 0xc8,
  633. 0xe0, 0x8c, 0x31, 0x5c, 0x1c, 0xce, 0x2a, 0x83,
  634. 0x14, 0x4d, 0xbb, 0xff, 0x09, 0xf7, 0x4e, 0x3e,
  635. 0xfc, 0x77, 0x0b, 0x54, 0xd0, 0x98, 0x4a, 0x8f,
  636. 0x19, 0xb1, 0x47, 0x19, 0xe6, 0x36, 0x35, 0x64,
  637. 0x1d, 0x6b, 0x1e, 0xed, 0xf6, 0x3e, 0xfb, 0xf0,
  638. 0x80, 0xe1, 0x78, 0x3d, 0x32, 0x44, 0x54, 0x12,
  639. 0x11, 0x4c, 0x20, 0xde, 0x0b, 0x83, 0x7a, 0x0d,
  640. 0xfa, 0x33, 0xd6, 0xb8, 0x28, 0x25, 0xff, 0xf4,
  641. 0x4c, 0x9a, 0x70, 0xea, 0x54, 0xce, 0x47, 0xf0,
  642. 0x7d, 0xf6, 0x98, 0xe6, 0xb0, 0x33, 0x23, 0xb5,
  643. 0x30, 0x79, 0x36, 0x4a, 0x5f, 0xc3, 0xe9, 0xdd,
  644. 0x03, 0x43, 0x92, 0xbd, 0xde, 0x86, 0xdc, 0xcd,
  645. 0xda, 0x94, 0x32, 0x1c, 0x5e, 0x44, 0x06, 0x04,
  646. 0x89, 0x33, 0x6c, 0xb6, 0x5b, 0xf3, 0x98, 0x9c,
  647. 0x36, 0xf7, 0x28, 0x2c, 0x2f, 0x5d, 0x2b, 0x88,
  648. 0x2c, 0x17, 0x1e, 0x74
  649. }
  650. },
  651. {
  652. 32,
  653. {
  654. 0x95, 0xd5, 0xc0, 0x05, 0x50, 0x3e, 0x51, 0x0d,
  655. 0x8c, 0xd0, 0xaa, 0x07, 0x2c, 0x4a, 0x4d, 0x06,
  656. 0x6e, 0xab, 0xc5, 0x2d, 0x11, 0x65, 0x3d, 0xf4,
  657. 0x7f, 0xbf, 0x63, 0xab, 0x19, 0x8b, 0xcc, 0x26
  658. }
  659. },
  660. {
  661. 16,
  662. {
  663. 0xf2, 0x48, 0x31, 0x2e, 0x57, 0x8d, 0x9d, 0x58,
  664. 0xf8, 0xb7, 0xbb, 0x4d, 0x19, 0x10, 0x54, 0x31
  665. }
  666. },
  667. },
  668. /*
  669. * AVX2 in poly1305-x86.pl failed this with 176+32 split
  670. */
  671. {
  672. {
  673. 208,
  674. {
  675. 0x24, 0x8a, 0xc3, 0x10, 0x85, 0xb6, 0xc2, 0xad,
  676. 0xaa, 0xa3, 0x82, 0x59, 0xa0, 0xd7, 0x19, 0x2c,
  677. 0x5c, 0x35, 0xd1, 0xbb, 0x4e, 0xf3, 0x9a, 0xd9,
  678. 0x4c, 0x38, 0xd1, 0xc8, 0x24, 0x79, 0xe2, 0xdd,
  679. 0x21, 0x59, 0xa0, 0x77, 0x02, 0x4b, 0x05, 0x89,
  680. 0xbc, 0x8a, 0x20, 0x10, 0x1b, 0x50, 0x6f, 0x0a,
  681. 0x1a, 0xd0, 0xbb, 0xab, 0x76, 0xe8, 0x3a, 0x83,
  682. 0xf1, 0xb9, 0x4b, 0xe6, 0xbe, 0xae, 0x74, 0xe8,
  683. 0x74, 0xca, 0xb6, 0x92, 0xc5, 0x96, 0x3a, 0x75,
  684. 0x43, 0x6b, 0x77, 0x61, 0x21, 0xec, 0x9f, 0x62,
  685. 0x39, 0x9a, 0x3e, 0x66, 0xb2, 0xd2, 0x27, 0x07,
  686. 0xda, 0xe8, 0x19, 0x33, 0xb6, 0x27, 0x7f, 0x3c,
  687. 0x85, 0x16, 0xbc, 0xbe, 0x26, 0xdb, 0xbd, 0x86,
  688. 0xf3, 0x73, 0x10, 0x3d, 0x7c, 0xf4, 0xca, 0xd1,
  689. 0x88, 0x8c, 0x95, 0x21, 0x18, 0xfb, 0xfb, 0xd0,
  690. 0xd7, 0xb4, 0xbe, 0xdc, 0x4a, 0xe4, 0x93, 0x6a,
  691. 0xff, 0x91, 0x15, 0x7e, 0x7a, 0xa4, 0x7c, 0x54,
  692. 0x44, 0x2e, 0xa7, 0x8d, 0x6a, 0xc2, 0x51, 0xd3,
  693. 0x24, 0xa0, 0xfb, 0xe4, 0x9d, 0x89, 0xcc, 0x35,
  694. 0x21, 0xb6, 0x6d, 0x16, 0xe9, 0xc6, 0x6a, 0x37,
  695. 0x09, 0x89, 0x4e, 0x4e, 0xb0, 0xa4, 0xee, 0xdc,
  696. 0x4a, 0xe1, 0x94, 0x68, 0xe6, 0x6b, 0x81, 0xf2,
  697. 0x71, 0x35, 0x1b, 0x1d, 0x92, 0x1e, 0xa5, 0x51,
  698. 0x04, 0x7a, 0xbc, 0xc6, 0xb8, 0x7a, 0x90, 0x1f,
  699. 0xde, 0x7d, 0xb7, 0x9f, 0xa1, 0x81, 0x8c, 0x11,
  700. 0x33, 0x6d, 0xbc, 0x07, 0x24, 0x4a, 0x40, 0xeb
  701. }
  702. },
  703. {
  704. 32,
  705. {
  706. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  707. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  708. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  709. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  710. }
  711. },
  712. {
  713. 16,
  714. {
  715. 0xbc, 0x93, 0x9b, 0xc5, 0x28, 0x14, 0x80, 0xfa,
  716. 0x99, 0xc6, 0xd6, 0x8c, 0x25, 0x8e, 0xc4, 0x2f
  717. }
  718. },
  719. },
  720. /*
  721. * test vectors from Google
  722. */
  723. {
  724. {
  725. 0,
  726. {
  727. 0x00,
  728. }
  729. },
  730. {
  731. 32,
  732. {
  733. 0xc8, 0xaf, 0xaa, 0xc3, 0x31, 0xee, 0x37, 0x2c,
  734. 0xd6, 0x08, 0x2d, 0xe1, 0x34, 0x94, 0x3b, 0x17,
  735. 0x47, 0x10, 0x13, 0x0e, 0x9f, 0x6f, 0xea, 0x8d,
  736. 0x72, 0x29, 0x38, 0x50, 0xa6, 0x67, 0xd8, 0x6c
  737. }
  738. },
  739. {
  740. 16,
  741. {
  742. 0x47, 0x10, 0x13, 0x0e, 0x9f, 0x6f, 0xea, 0x8d,
  743. 0x72, 0x29, 0x38, 0x50, 0xa6, 0x67, 0xd8, 0x6c
  744. }
  745. },
  746. },
  747. {
  748. {
  749. 12,
  750. {
  751. 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f,
  752. 0x72, 0x6c, 0x64, 0x21
  753. }
  754. },
  755. {
  756. 32,
  757. {
  758. 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
  759. 0x33, 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20,
  760. 0x6b, 0x65, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20,
  761. 0x50, 0x6f, 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35
  762. }
  763. },
  764. {
  765. 16,
  766. {
  767. 0xa6, 0xf7, 0x45, 0x00, 0x8f, 0x81, 0xc9, 0x16,
  768. 0xa2, 0x0d, 0xcc, 0x74, 0xee, 0xf2, 0xb2, 0xf0
  769. }
  770. },
  771. },
  772. {
  773. {
  774. 32,
  775. {
  776. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  777. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  778. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  779. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  780. }
  781. },
  782. {
  783. 32,
  784. {
  785. 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
  786. 0x33, 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20,
  787. 0x6b, 0x65, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20,
  788. 0x50, 0x6f, 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35
  789. }
  790. },
  791. {
  792. 16,
  793. {
  794. 0x49, 0xec, 0x78, 0x09, 0x0e, 0x48, 0x1e, 0xc6,
  795. 0xc2, 0x6b, 0x33, 0xb9, 0x1c, 0xcc, 0x03, 0x07
  796. }
  797. },
  798. },
  799. {
  800. {
  801. 128,
  802. {
  803. 0x89, 0xda, 0xb8, 0x0b, 0x77, 0x17, 0xc1, 0xdb,
  804. 0x5d, 0xb4, 0x37, 0x86, 0x0a, 0x3f, 0x70, 0x21,
  805. 0x8e, 0x93, 0xe1, 0xb8, 0xf4, 0x61, 0xfb, 0x67,
  806. 0x7f, 0x16, 0xf3, 0x5f, 0x6f, 0x87, 0xe2, 0xa9,
  807. 0x1c, 0x99, 0xbc, 0x3a, 0x47, 0xac, 0xe4, 0x76,
  808. 0x40, 0xcc, 0x95, 0xc3, 0x45, 0xbe, 0x5e, 0xcc,
  809. 0xa5, 0xa3, 0x52, 0x3c, 0x35, 0xcc, 0x01, 0x89,
  810. 0x3a, 0xf0, 0xb6, 0x4a, 0x62, 0x03, 0x34, 0x27,
  811. 0x03, 0x72, 0xec, 0x12, 0x48, 0x2d, 0x1b, 0x1e,
  812. 0x36, 0x35, 0x61, 0x69, 0x8a, 0x57, 0x8b, 0x35,
  813. 0x98, 0x03, 0x49, 0x5b, 0xb4, 0xe2, 0xef, 0x19,
  814. 0x30, 0xb1, 0x7a, 0x51, 0x90, 0xb5, 0x80, 0xf1,
  815. 0x41, 0x30, 0x0d, 0xf3, 0x0a, 0xdb, 0xec, 0xa2,
  816. 0x8f, 0x64, 0x27, 0xa8, 0xbc, 0x1a, 0x99, 0x9f,
  817. 0xd5, 0x1c, 0x55, 0x4a, 0x01, 0x7d, 0x09, 0x5d,
  818. 0x8c, 0x3e, 0x31, 0x27, 0xda, 0xf9, 0xf5, 0x95
  819. }
  820. },
  821. {
  822. 32,
  823. {
  824. 0x2d, 0x77, 0x3b, 0xe3, 0x7a, 0xdb, 0x1e, 0x4d,
  825. 0x68, 0x3b, 0xf0, 0x07, 0x5e, 0x79, 0xc4, 0xee,
  826. 0x03, 0x79, 0x18, 0x53, 0x5a, 0x7f, 0x99, 0xcc,
  827. 0xb7, 0x04, 0x0f, 0xb5, 0xf5, 0xf4, 0x3a, 0xea
  828. }
  829. },
  830. {
  831. 16,
  832. {
  833. 0xc8, 0x5d, 0x15, 0xed, 0x44, 0xc3, 0x78, 0xd6,
  834. 0xb0, 0x0e, 0x23, 0x06, 0x4c, 0x7b, 0xcd, 0x51
  835. }
  836. },
  837. },
  838. {
  839. {
  840. 528,
  841. {
  842. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b,
  843. 0x17, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
  844. 0x06, 0xdb, 0x1f, 0x1f, 0x36, 0x8d, 0x69, 0x6a,
  845. 0x81, 0x0a, 0x34, 0x9c, 0x0c, 0x71, 0x4c, 0x9a,
  846. 0x5e, 0x78, 0x50, 0xc2, 0x40, 0x7d, 0x72, 0x1a,
  847. 0xcd, 0xed, 0x95, 0xe0, 0x18, 0xd7, 0xa8, 0x52,
  848. 0x66, 0xa6, 0xe1, 0x28, 0x9c, 0xdb, 0x4a, 0xeb,
  849. 0x18, 0xda, 0x5a, 0xc8, 0xa2, 0xb0, 0x02, 0x6d,
  850. 0x24, 0xa5, 0x9a, 0xd4, 0x85, 0x22, 0x7f, 0x3e,
  851. 0xae, 0xdb, 0xb2, 0xe7, 0xe3, 0x5e, 0x1c, 0x66,
  852. 0xcd, 0x60, 0xf9, 0xab, 0xf7, 0x16, 0xdc, 0xc9,
  853. 0xac, 0x42, 0x68, 0x2d, 0xd7, 0xda, 0xb2, 0x87,
  854. 0xa7, 0x02, 0x4c, 0x4e, 0xef, 0xc3, 0x21, 0xcc,
  855. 0x05, 0x74, 0xe1, 0x67, 0x93, 0xe3, 0x7c, 0xec,
  856. 0x03, 0xc5, 0xbd, 0xa4, 0x2b, 0x54, 0xc1, 0x14,
  857. 0xa8, 0x0b, 0x57, 0xaf, 0x26, 0x41, 0x6c, 0x7b,
  858. 0xe7, 0x42, 0x00, 0x5e, 0x20, 0x85, 0x5c, 0x73,
  859. 0xe2, 0x1d, 0xc8, 0xe2, 0xed, 0xc9, 0xd4, 0x35,
  860. 0xcb, 0x6f, 0x60, 0x59, 0x28, 0x00, 0x11, 0xc2,
  861. 0x70, 0xb7, 0x15, 0x70, 0x05, 0x1c, 0x1c, 0x9b,
  862. 0x30, 0x52, 0x12, 0x66, 0x20, 0xbc, 0x1e, 0x27,
  863. 0x30, 0xfa, 0x06, 0x6c, 0x7a, 0x50, 0x9d, 0x53,
  864. 0xc6, 0x0e, 0x5a, 0xe1, 0xb4, 0x0a, 0xa6, 0xe3,
  865. 0x9e, 0x49, 0x66, 0x92, 0x28, 0xc9, 0x0e, 0xec,
  866. 0xb4, 0xa5, 0x0d, 0xb3, 0x2a, 0x50, 0xbc, 0x49,
  867. 0xe9, 0x0b, 0x4f, 0x4b, 0x35, 0x9a, 0x1d, 0xfd,
  868. 0x11, 0x74, 0x9c, 0xd3, 0x86, 0x7f, 0xcf, 0x2f,
  869. 0xb7, 0xbb, 0x6c, 0xd4, 0x73, 0x8f, 0x6a, 0x4a,
  870. 0xd6, 0xf7, 0xca, 0x50, 0x58, 0xf7, 0x61, 0x88,
  871. 0x45, 0xaf, 0x9f, 0x02, 0x0f, 0x6c, 0x3b, 0x96,
  872. 0x7b, 0x8f, 0x4c, 0xd4, 0xa9, 0x1e, 0x28, 0x13,
  873. 0xb5, 0x07, 0xae, 0x66, 0xf2, 0xd3, 0x5c, 0x18,
  874. 0x28, 0x4f, 0x72, 0x92, 0x18, 0x60, 0x62, 0xe1,
  875. 0x0f, 0xd5, 0x51, 0x0d, 0x18, 0x77, 0x53, 0x51,
  876. 0xef, 0x33, 0x4e, 0x76, 0x34, 0xab, 0x47, 0x43,
  877. 0xf5, 0xb6, 0x8f, 0x49, 0xad, 0xca, 0xb3, 0x84,
  878. 0xd3, 0xfd, 0x75, 0xf7, 0x39, 0x0f, 0x40, 0x06,
  879. 0xef, 0x2a, 0x29, 0x5c, 0x8c, 0x7a, 0x07, 0x6a,
  880. 0xd5, 0x45, 0x46, 0xcd, 0x25, 0xd2, 0x10, 0x7f,
  881. 0xbe, 0x14, 0x36, 0xc8, 0x40, 0x92, 0x4a, 0xae,
  882. 0xbe, 0x5b, 0x37, 0x08, 0x93, 0xcd, 0x63, 0xd1,
  883. 0x32, 0x5b, 0x86, 0x16, 0xfc, 0x48, 0x10, 0x88,
  884. 0x6b, 0xc1, 0x52, 0xc5, 0x32, 0x21, 0xb6, 0xdf,
  885. 0x37, 0x31, 0x19, 0x39, 0x32, 0x55, 0xee, 0x72,
  886. 0xbc, 0xaa, 0x88, 0x01, 0x74, 0xf1, 0x71, 0x7f,
  887. 0x91, 0x84, 0xfa, 0x91, 0x64, 0x6f, 0x17, 0xa2,
  888. 0x4a, 0xc5, 0x5d, 0x16, 0xbf, 0xdd, 0xca, 0x95,
  889. 0x81, 0xa9, 0x2e, 0xda, 0x47, 0x92, 0x01, 0xf0,
  890. 0xed, 0xbf, 0x63, 0x36, 0x00, 0xd6, 0x06, 0x6d,
  891. 0x1a, 0xb3, 0x6d, 0x5d, 0x24, 0x15, 0xd7, 0x13,
  892. 0x51, 0xbb, 0xcd, 0x60, 0x8a, 0x25, 0x10, 0x8d,
  893. 0x25, 0x64, 0x19, 0x92, 0xc1, 0xf2, 0x6c, 0x53,
  894. 0x1c, 0xf9, 0xf9, 0x02, 0x03, 0xbc, 0x4c, 0xc1,
  895. 0x9f, 0x59, 0x27, 0xd8, 0x34, 0xb0, 0xa4, 0x71,
  896. 0x16, 0xd3, 0x88, 0x4b, 0xbb, 0x16, 0x4b, 0x8e,
  897. 0xc8, 0x83, 0xd1, 0xac, 0x83, 0x2e, 0x56, 0xb3,
  898. 0x91, 0x8a, 0x98, 0x60, 0x1a, 0x08, 0xd1, 0x71,
  899. 0x88, 0x15, 0x41, 0xd5, 0x94, 0xdb, 0x39, 0x9c,
  900. 0x6a, 0xe6, 0x15, 0x12, 0x21, 0x74, 0x5a, 0xec,
  901. 0x81, 0x4c, 0x45, 0xb0, 0xb0, 0x5b, 0x56, 0x54,
  902. 0x36, 0xfd, 0x6f, 0x13, 0x7a, 0xa1, 0x0a, 0x0c,
  903. 0x0b, 0x64, 0x37, 0x61, 0xdb, 0xd6, 0xf9, 0xa9,
  904. 0xdc, 0xb9, 0x9b, 0x1a, 0x6e, 0x69, 0x08, 0x54,
  905. 0xce, 0x07, 0x69, 0xcd, 0xe3, 0x97, 0x61, 0xd8,
  906. 0x2f, 0xcd, 0xec, 0x15, 0xf0, 0xd9, 0x2d, 0x7d,
  907. 0x8e, 0x94, 0xad, 0xe8, 0xeb, 0x83, 0xfb, 0xe0
  908. }
  909. },
  910. {
  911. 32,
  912. {
  913. 0x99, 0xe5, 0x82, 0x2d, 0xd4, 0x17, 0x3c, 0x99,
  914. 0x5e, 0x3d, 0xae, 0x0d, 0xde, 0xfb, 0x97, 0x74,
  915. 0x3f, 0xde, 0x3b, 0x08, 0x01, 0x34, 0xb3, 0x9f,
  916. 0x76, 0xe9, 0xbf, 0x8d, 0x0e, 0x88, 0xd5, 0x46
  917. }
  918. },
  919. {
  920. 16,
  921. {
  922. 0x26, 0x37, 0x40, 0x8f, 0xe1, 0x30, 0x86, 0xea,
  923. 0x73, 0xf9, 0x71, 0xe3, 0x42, 0x5e, 0x28, 0x20
  924. }
  925. },
  926. },
  927. /*
  928. * test vectors from Hanno Böck
  929. */
  930. {
  931. {
  932. 257,
  933. {
  934. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  935. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  936. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  937. 0xcc, 0x80, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  938. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  939. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  940. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  941. 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0xcc, 0xcc, 0xcc,
  942. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  943. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xc5,
  944. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  945. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  946. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xe3, 0xcc, 0xcc,
  947. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  948. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  949. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  950. 0xcc, 0xcc, 0xcc, 0xcc, 0xac, 0xcc, 0xcc, 0xcc,
  951. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xe6,
  952. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00,
  953. 0xaf, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
  954. 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xf5, 0x00, 0x00,
  955. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  956. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  957. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  958. 0x00, 0xff, 0xff, 0xff, 0xe7, 0x00, 0x00, 0x00,
  959. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  960. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  961. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  962. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  963. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  964. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  965. 0x00, 0x00, 0x71, 0x92, 0x05, 0xa8, 0x52, 0x1d,
  966. 0xfc
  967. }
  968. },
  969. {
  970. 32,
  971. {
  972. 0x7f, 0x1b, 0x02, 0x64, 0x00, 0x00, 0x00, 0x00,
  973. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  974. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  975. 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc
  976. }
  977. },
  978. {
  979. 16,
  980. {
  981. 0x85, 0x59, 0xb8, 0x76, 0xec, 0xee, 0xd6, 0x6e,
  982. 0xb3, 0x77, 0x98, 0xc0, 0x45, 0x7b, 0xaf, 0xf9
  983. }
  984. },
  985. },
  986. {
  987. {
  988. 39,
  989. {
  990. 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
  991. 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
  992. 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
  993. 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00,
  994. 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x64
  995. }
  996. },
  997. {
  998. 32,
  999. {
  1000. 0xe0, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00,
  1001. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1002. 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
  1003. 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa
  1004. }
  1005. },
  1006. {
  1007. 16,
  1008. {
  1009. 0x00, 0xbd, 0x12, 0x58, 0x97, 0x8e, 0x20, 0x54,
  1010. 0x44, 0xc9, 0xaa, 0xaa, 0x82, 0x00, 0x6f, 0xed
  1011. }
  1012. },
  1013. },
  1014. {
  1015. {
  1016. 2,
  1017. {
  1018. 0x02, 0xfc
  1019. }
  1020. },
  1021. {
  1022. 32,
  1023. {
  1024. 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
  1025. 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
  1026. 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
  1027. 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c
  1028. }
  1029. },
  1030. {
  1031. 16,
  1032. {
  1033. 0x06, 0x12, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
  1034. 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c
  1035. }
  1036. },
  1037. },
  1038. {
  1039. {
  1040. 415,
  1041. {
  1042. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1043. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1044. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1045. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1046. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7a, 0x7b,
  1047. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1048. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1049. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1050. 0x7b, 0x7b, 0x5c, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1051. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1052. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1053. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1054. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1055. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1056. 0x7b, 0x7b, 0x7b, 0x7b, 0x6e, 0x7b, 0x00, 0x7b,
  1057. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1058. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1059. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1060. 0x7b, 0x7b, 0x7b, 0x7a, 0x7b, 0x7b, 0x7b, 0x7b,
  1061. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1062. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1063. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x5c,
  1064. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1065. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1066. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1067. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1068. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1069. 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
  1070. 0x7b, 0x6e, 0x7b, 0x00, 0x13, 0x00, 0x00, 0x00,
  1071. 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1072. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1073. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1074. 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1075. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1076. 0x00, 0x00, 0x00, 0x20, 0x00, 0xef, 0xff, 0x00,
  1077. 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1078. 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
  1079. 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x00,
  1080. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1081. 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00,
  1082. 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1083. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1084. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2,
  1085. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1086. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1087. 0x00, 0x00, 0x20, 0x00, 0xef, 0xff, 0x00, 0x09,
  1088. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1089. 0x00, 0x7a, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
  1090. 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
  1091. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1092. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1093. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc
  1094. }
  1095. },
  1096. {
  1097. 32,
  1098. {
  1099. 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1100. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1101. 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
  1102. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7b
  1103. }
  1104. },
  1105. {
  1106. 16,
  1107. {
  1108. 0x33, 0x20, 0x5b, 0xbf, 0x9e, 0x9f, 0x8f, 0x72,
  1109. 0x12, 0xab, 0x9e, 0x2a, 0xb9, 0xb7, 0xe4, 0xa5
  1110. }
  1111. },
  1112. },
  1113. {
  1114. {
  1115. 118,
  1116. {
  1117. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1118. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1119. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1120. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1121. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1122. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1123. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1124. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1125. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
  1126. 0x77, 0x77, 0x77, 0x77, 0xff, 0xff, 0xff, 0xe9,
  1127. 0xe9, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
  1128. 0xac, 0xac, 0xac, 0xac, 0x00, 0x00, 0xac, 0xac,
  1129. 0xec, 0x01, 0x00, 0xac, 0xac, 0xac, 0x2c, 0xac,
  1130. 0xa2, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
  1131. 0xac, 0xac, 0xac, 0xac, 0x64, 0xf2
  1132. }
  1133. },
  1134. {
  1135. 32,
  1136. {
  1137. 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f,
  1138. 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
  1139. 0x00, 0x00, 0xcf, 0x77, 0x77, 0x77, 0x77, 0x77,
  1140. 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77
  1141. }
  1142. },
  1143. {
  1144. 16,
  1145. {
  1146. 0x02, 0xee, 0x7c, 0x8c, 0x54, 0x6d, 0xde, 0xb1,
  1147. 0xa4, 0x67, 0xe4, 0xc3, 0x98, 0x11, 0x58, 0xb9
  1148. }
  1149. },
  1150. },
  1151. /*
  1152. * test vectors from Andrew Moon
  1153. */
  1154. { /* nacl */
  1155. {
  1156. 131,
  1157. {
  1158. 0x8e, 0x99, 0x3b, 0x9f, 0x48, 0x68, 0x12, 0x73,
  1159. 0xc2, 0x96, 0x50, 0xba, 0x32, 0xfc, 0x76, 0xce,
  1160. 0x48, 0x33, 0x2e, 0xa7, 0x16, 0x4d, 0x96, 0xa4,
  1161. 0x47, 0x6f, 0xb8, 0xc5, 0x31, 0xa1, 0x18, 0x6a,
  1162. 0xc0, 0xdf, 0xc1, 0x7c, 0x98, 0xdc, 0xe8, 0x7b,
  1163. 0x4d, 0xa7, 0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72,
  1164. 0x71, 0xd2, 0xc2, 0x0f, 0x9b, 0x92, 0x8f, 0xe2,
  1165. 0x27, 0x0d, 0x6f, 0xb8, 0x63, 0xd5, 0x17, 0x38,
  1166. 0xb4, 0x8e, 0xee, 0xe3, 0x14, 0xa7, 0xcc, 0x8a,
  1167. 0xb9, 0x32, 0x16, 0x45, 0x48, 0xe5, 0x26, 0xae,
  1168. 0x90, 0x22, 0x43, 0x68, 0x51, 0x7a, 0xcf, 0xea,
  1169. 0xbd, 0x6b, 0xb3, 0x73, 0x2b, 0xc0, 0xe9, 0xda,
  1170. 0x99, 0x83, 0x2b, 0x61, 0xca, 0x01, 0xb6, 0xde,
  1171. 0x56, 0x24, 0x4a, 0x9e, 0x88, 0xd5, 0xf9, 0xb3,
  1172. 0x79, 0x73, 0xf6, 0x22, 0xa4, 0x3d, 0x14, 0xa6,
  1173. 0x59, 0x9b, 0x1f, 0x65, 0x4c, 0xb4, 0x5a, 0x74,
  1174. 0xe3, 0x55, 0xa5
  1175. }
  1176. },
  1177. {
  1178. 32,
  1179. {
  1180. 0xee, 0xa6, 0xa7, 0x25, 0x1c, 0x1e, 0x72, 0x91,
  1181. 0x6d, 0x11, 0xc2, 0xcb, 0x21, 0x4d, 0x3c, 0x25,
  1182. 0x25, 0x39, 0x12, 0x1d, 0x8e, 0x23, 0x4e, 0x65,
  1183. 0x2d, 0x65, 0x1f, 0xa4, 0xc8, 0xcf, 0xf8, 0x80
  1184. }
  1185. },
  1186. {
  1187. 16,
  1188. {
  1189. 0xf3, 0xff, 0xc7, 0x70, 0x3f, 0x94, 0x00, 0xe5,
  1190. 0x2a, 0x7d, 0xfb, 0x4b, 0x3d, 0x33, 0x05, 0xd9
  1191. }
  1192. },
  1193. },
  1194. { /* wrap 2^130-5 */
  1195. {
  1196. 16,
  1197. {
  1198. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1199. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  1200. }
  1201. },
  1202. {
  1203. 32,
  1204. {
  1205. 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1206. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1207. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1208. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1209. }
  1210. },
  1211. {
  1212. 16,
  1213. {
  1214. 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1215. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1216. }
  1217. },
  1218. },
  1219. { /* wrap 2^128 */
  1220. {
  1221. 16,
  1222. {
  1223. 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1224. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1225. }
  1226. },
  1227. {
  1228. 32,
  1229. {
  1230. 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1231. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1232. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1233. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  1234. }
  1235. },
  1236. {
  1237. 16,
  1238. {
  1239. 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1240. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1241. }
  1242. },
  1243. },
  1244. { /* limb carry */
  1245. {
  1246. 48,
  1247. {
  1248. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1249. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1250. 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1251. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1252. 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1253. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1254. }
  1255. },
  1256. {
  1257. 32,
  1258. {
  1259. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1260. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1261. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1262. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1263. }
  1264. },
  1265. {
  1266. 16,
  1267. {
  1268. 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1269. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1270. }
  1271. },
  1272. },
  1273. { /* 2^130-5 */
  1274. {
  1275. 48,
  1276. {
  1277. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1278. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1279. 0xfb, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
  1280. 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
  1281. 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  1282. 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
  1283. }
  1284. },
  1285. {
  1286. 32,
  1287. {
  1288. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1289. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1290. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1291. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1292. }
  1293. },
  1294. {
  1295. 16,
  1296. {
  1297. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1298. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1299. }
  1300. },
  1301. },
  1302. { /* 2^130-6 */
  1303. {
  1304. 16,
  1305. {
  1306. 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1307. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  1308. }
  1309. },
  1310. {
  1311. 32,
  1312. {
  1313. 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1314. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1315. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1316. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1317. }
  1318. },
  1319. {
  1320. 16,
  1321. {
  1322. 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1323. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  1324. }
  1325. },
  1326. },
  1327. { /* 5*H+L reduction intermediate */
  1328. {
  1329. 64,
  1330. {
  1331. 0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
  1332. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1333. 0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
  1334. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1335. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1336. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1337. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1338. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1339. }
  1340. },
  1341. {
  1342. 32,
  1343. {
  1344. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1345. 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1346. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1347. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1348. }
  1349. },
  1350. {
  1351. 16,
  1352. {
  1353. 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1354. 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1355. }
  1356. },
  1357. },
  1358. { /* 5*H+L reduction final */
  1359. {
  1360. 48,
  1361. {
  1362. 0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
  1363. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1364. 0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
  1365. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1366. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1367. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1368. }
  1369. },
  1370. {
  1371. 32,
  1372. {
  1373. 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1374. 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1375. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1376. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1377. }
  1378. },
  1379. {
  1380. 16,
  1381. {
  1382. 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1383. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  1384. }
  1385. }
  1386. }
  1387. };
  1388. static int test_poly1305(int idx)
  1389. {
  1390. POLY1305 poly1305;
  1391. const TESTDATA test = tests[idx];
  1392. const unsigned char *in = test.input.data;
  1393. size_t inlen = test.input.size;
  1394. const unsigned char *key = test.key.data;
  1395. const unsigned char *expected = test.expected.data;
  1396. size_t expectedlen = test.expected.size;
  1397. unsigned char out[16];
  1398. if (!TEST_size_t_eq(expectedlen, sizeof(out)))
  1399. return 0;
  1400. Poly1305_Init(&poly1305, key);
  1401. Poly1305_Update(&poly1305, in, inlen);
  1402. Poly1305_Final(&poly1305, out);
  1403. if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
  1404. TEST_info("Poly1305 test #%d failed.", idx);
  1405. return 0;
  1406. }
  1407. if (inlen > 16) {
  1408. Poly1305_Init(&poly1305, key);
  1409. Poly1305_Update(&poly1305, in, 1);
  1410. Poly1305_Update(&poly1305, in+1, inlen-1);
  1411. Poly1305_Final(&poly1305, out);
  1412. if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
  1413. TEST_info("Poly1305 test #%d/1+(N-1) failed.", idx);
  1414. return 0;
  1415. }
  1416. }
  1417. if (inlen > 32) {
  1418. size_t half = inlen / 2;
  1419. Poly1305_Init(&poly1305, key);
  1420. Poly1305_Update(&poly1305, in, half);
  1421. Poly1305_Update(&poly1305, in+half, inlen-half);
  1422. Poly1305_Final(&poly1305, out);
  1423. if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
  1424. TEST_info("Poly1305 test #%d/2 failed.", idx);
  1425. return 0;
  1426. }
  1427. for (half = 16; half < inlen; half += 16) {
  1428. Poly1305_Init(&poly1305, key);
  1429. Poly1305_Update(&poly1305, in, half);
  1430. Poly1305_Update(&poly1305, in+half, inlen-half);
  1431. Poly1305_Final(&poly1305, out);
  1432. if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
  1433. TEST_info("Poly1305 test #%d/%zu+%zu failed.",
  1434. idx, half, inlen-half);
  1435. return 0;
  1436. }
  1437. }
  1438. }
  1439. return 1;
  1440. }
  1441. int setup_tests(void)
  1442. {
  1443. ADD_ALL_TESTS(test_poly1305, OSSL_NELEM(tests));
  1444. return 1;
  1445. }