fq12-test.cc 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  1. /*############################################################################
  2. # Copyright 2017 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################*/
  16. /// Unit tests of Fq12 implementation.
  17. /*! \file */
  18. #include <gtest/gtest.h>
  19. #include "epid/member/tiny/math/unittests/cmp-testhelper.h"
  20. extern "C" {
  21. #include "epid/member/tiny/math/fq12.h"
  22. #include "epid/member/tiny/math/mathtypes.h"
  23. }
  24. namespace {
  25. ////////////////////////////////////////////////////////////////////////
  26. // Fq12Add
  27. TEST(TinyFq12Test, Fq12AddWorks) {
  28. Fq12Elem expected = {{{{0xf8898202, 0xb45883e0, 0x8d18168d, 0xf67a4288,
  29. 0xec7c2a8a, 0xfa6f0441, 0xff5583e2, 0x32d88286},
  30. {0x304722d5, 0x113e09d3, 0xeaf32297, 0x32d71c16,
  31. 0x1cb0685b, 0xe3315524, 0xafd38377, 0xfeae3272}},
  32. {{0xc82d8518, 0x99cec06c, 0xe8d7d62b, 0x2f00d5c5,
  33. 0x0620146e, 0x2741e62b, 0x9e7557ca, 0xeb019297},
  34. {0x15cfc66e, 0x55ba87c0, 0xf1060150, 0xb91180f6,
  35. 0xb0d77f5f, 0xc7fa8733, 0x7dc697f1, 0x1e6b8e24}},
  36. {{0x1400db26, 0x0760a0b1, 0x1a64565f, 0x27b5641e,
  37. 0xd96484ed, 0x54b02297, 0xa2a57172, 0xc3a04c1c},
  38. {0x17ff87fb, 0x6294fcdb, 0x8f7c4bc2, 0xd0802fe6,
  39. 0xee3d7f1b, 0xf19d63af, 0xdb1d00ae, 0x80df53e6}}},
  40. {{{0xc8c6cded, 0x0a290583, 0xd4ab7f8b, 0x867f6ac5,
  41. 0x791662bb, 0x893f1baa, 0xfc911068, 0xe97be9e3},
  42. {0xdb9666f2, 0x1ff150ee, 0xd8691261, 0x5efee8a7,
  43. 0x0c67c4e5, 0x1501f7e4, 0xde7e72d8, 0x01ab1a71}},
  44. {{0x85a5659c, 0xcfd4464f, 0xea3b0e64, 0x4a85994f,
  45. 0x0e842121, 0x939ca516, 0x55e1a4b6, 0xb92af8fa},
  46. {0xb2bfc7eb, 0x71e5dd9d, 0x16b23032, 0x8590e174,
  47. 0x88a246af, 0x7d317c63, 0xc8f3a39a, 0x903a091d}},
  48. {{0xf0df5efe, 0x5a88ee12, 0xb0d81569, 0x70172a9f,
  49. 0xa330fbf2, 0x36a7ea66, 0x95287dc2, 0x99c6386b},
  50. {0x875888c7, 0xa3fa338b, 0x52d41dbe, 0x36960893,
  51. 0xfdf09874, 0x3986d2ba, 0xa9eb891e, 0x5cf05c6f}}}};
  52. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  53. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  54. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  55. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  56. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  57. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  58. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  59. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  60. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  61. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  62. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  63. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  64. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  65. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  66. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  67. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  68. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  69. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  70. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  71. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  72. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  73. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  74. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  75. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  76. Fq12Elem right = {{{{0x848cdb73, 0x6399829e, 0xcaa20cc0, 0x1b02bff6,
  77. 0x2b477bd2, 0xf9d48534, 0xff7929a0, 0xd4745161},
  78. {0xe323d956, 0xf8a05a85, 0xe02d5e1e, 0xfd533966,
  79. 0xe7d31209, 0xc7786143, 0x91b441f6, 0x7409d67d}},
  80. {{0xc763c01c, 0x8d45cdc1, 0xe46054e2, 0xc6216337,
  81. 0x97589d24, 0xe57d5f07, 0xeec3f4b6, 0xfe2a593f},
  82. {0x96748337, 0x31fbd2e4, 0x72e72c33, 0x96fe633a,
  83. 0x4f48fed2, 0xf6a92484, 0x5e7de24a, 0x8a963657}},
  84. {{0x48a24137, 0xc529544f, 0xe83111bc, 0xbd151156,
  85. 0x6b0c7ee2, 0x1bc18974, 0x01193d6b, 0x6b716d4d},
  86. {0x90c2469b, 0xb1ae7b57, 0x22ce6905, 0x58c5a086,
  87. 0xc750dfa2, 0x28ea9d9d, 0x6134f34f, 0x68cf7885}}},
  88. {{{0x771f4d50, 0x113c642f, 0x983d5b97, 0xd8fed4c2,
  89. 0x166e53b0, 0x4797d81c, 0x9955788c, 0xbd7c6c23},
  90. {0xd9d2246a, 0x092e1780, 0xd8a1ac25, 0xc23607e5,
  91. 0x8c58b02e, 0x2c543c7e, 0x4c082083, 0xc4577f4d}},
  92. {{0xb433c5de, 0x6ab7893e, 0x5ff5e970, 0x24de35b6,
  93. 0x65b8022c, 0x89c649d3, 0x7629ec0b, 0x6046bfbd},
  94. {0xcdab3158, 0xefd0e691, 0xeb7ca8b3, 0xbbe4015c,
  95. 0xcb5d6828, 0xd313d3ec, 0x0b0125d2, 0xac823c7f}},
  96. {{0x3e500486, 0xd17db7a2, 0x8d174e88, 0x8504ae57,
  97. 0x1d09fdcb, 0xeda97288, 0xd8a573c9, 0x32233b3f},
  98. {0x41145b9e, 0x4f61f713, 0xd1caf67d, 0x3299a2ff,
  99. 0x3586b78d, 0x6b31995f, 0xe51708e4, 0x9eab4090}}}};
  100. Fq12Elem actual = {0};
  101. Fq12Add(&actual, &left, &right);
  102. EXPECT_EQ(expected, actual);
  103. }
  104. ////////////////////////////////////////////////////////////////////////
  105. // Fq12Sub
  106. TEST(TinyFq12Test, Fq12SubWorks) {
  107. Fq12Elem expected = {{{{0x4d162b42, 0x9377da5b, 0x1d041212, 0xda2d8e91,
  108. 0x72d07c24, 0x9491de97, 0x005d123b, 0x89efdfc3},
  109. {0x69ff7029, 0x1ffd54c7, 0x2a986659, 0x3830a949,
  110. 0x4d0a4447, 0x5440929c, 0x8c6aff8a, 0x169a8577}},
  111. {{0x970c6506, 0x259580a0, 0x4547416c, 0xbc76db4c,
  112. 0xb4522362, 0xea130cd9, 0xc0e74ff6, 0xeeace017},
  113. {0x97b9f013, 0xc4ec0fd2, 0x1dcfb36c, 0x97f1207d,
  114. 0x00b72659, 0x218e308a, 0xc0c7c429, 0x093f2175}},
  115. {{0x318f88cb, 0x503725ee, 0x5c9a3d68, 0xba67a76b,
  116. 0xf1bd2bc6, 0x6413020d, 0xa06fe769, 0xecbd7182},
  117. {0xa54e2ad8, 0xd2613407, 0x5c778439, 0x2bd154d5,
  118. 0x4e0d6476, 0xe6ae1ad3, 0x18b00add, 0xaf4062dc}}},
  119. {{{0x895b6360, 0xbad96b00, 0xb6c8d2df, 0xe15e273b,
  120. 0x3aab5ff8, 0x40f55dd1, 0xc9e3101d, 0x6e83119c},
  121. {0x85987e44, 0xb3e77da4, 0x4c55cf1c, 0xf44ba4d2,
  122. 0xd099adc5, 0x4a2563a4, 0x4668136c, 0x78fc1bd7}},
  123. {{0xcc1109f3, 0xcd8e61ad, 0x3ce74606, 0x0da593de,
  124. 0x3185c168, 0xc6f603ce, 0x698abd6c, 0xf89d797f},
  125. {0xc63c954e, 0x656d3e55, 0x5250e94d, 0x1aa544b5,
  126. 0xe0591afd, 0x1defc6e8, 0xb2ee48c2, 0x3735901f}},
  127. {{0x743f55f2, 0xb78d7ece, 0x96a97857, 0x660dcdf0,
  128. 0x691d005b, 0x5b550556, 0xe3dd962e, 0x357fc1eb},
  129. {0xb403019e, 0xd85f7340, 0xc1d63b46, 0xde3f288e,
  130. 0x8154cdf8, 0xaa09925b, 0xdfba6822, 0x1f99db4d}}}};
  131. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  132. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  133. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  134. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  135. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  136. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  137. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  138. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  139. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  140. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  141. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  142. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  143. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  144. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  145. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  146. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  147. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  148. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  149. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  150. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  151. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  152. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  153. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  154. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  155. Fq12Elem right = {{{{0x848cdb73, 0x6399829e, 0xcaa20cc0, 0x1b02bff6,
  156. 0x2b477bd2, 0xf9d48534, 0xff7929a0, 0xd4745161},
  157. {0xe323d956, 0xf8a05a85, 0xe02d5e1e, 0xfd533966,
  158. 0xe7d31209, 0xc7786143, 0x91b441f6, 0x7409d67d}},
  159. {{0xc763c01c, 0x8d45cdc1, 0xe46054e2, 0xc6216337,
  160. 0x97589d24, 0xe57d5f07, 0xeec3f4b6, 0xfe2a593f},
  161. {0x96748337, 0x31fbd2e4, 0x72e72c33, 0x96fe633a,
  162. 0x4f48fed2, 0xf6a92484, 0x5e7de24a, 0x8a963657}},
  163. {{0x48a24137, 0xc529544f, 0xe83111bc, 0xbd151156,
  164. 0x6b0c7ee2, 0x1bc18974, 0x01193d6b, 0x6b716d4d},
  165. {0x90c2469b, 0xb1ae7b57, 0x22ce6905, 0x58c5a086,
  166. 0xc750dfa2, 0x28ea9d9d, 0x6134f34f, 0x68cf7885}}},
  167. {{{0x771f4d50, 0x113c642f, 0x983d5b97, 0xd8fed4c2,
  168. 0x166e53b0, 0x4797d81c, 0x9955788c, 0xbd7c6c23},
  169. {0xd9d2246a, 0x092e1780, 0xd8a1ac25, 0xc23607e5,
  170. 0x8c58b02e, 0x2c543c7e, 0x4c082083, 0xc4577f4d}},
  171. {{0xb433c5de, 0x6ab7893e, 0x5ff5e970, 0x24de35b6,
  172. 0x65b8022c, 0x89c649d3, 0x7629ec0b, 0x6046bfbd},
  173. {0xcdab3158, 0xefd0e691, 0xeb7ca8b3, 0xbbe4015c,
  174. 0xcb5d6828, 0xd313d3ec, 0x0b0125d2, 0xac823c7f}},
  175. {{0x3e500486, 0xd17db7a2, 0x8d174e88, 0x8504ae57,
  176. 0x1d09fdcb, 0xeda97288, 0xd8a573c9, 0x32233b3f},
  177. {0x41145b9e, 0x4f61f713, 0xd1caf67d, 0x3299a2ff,
  178. 0x3586b78d, 0x6b31995f, 0xe51708e4, 0x9eab4090}}}};
  179. Fq12Elem actual = {0};
  180. Fq12Sub(&actual, &left, &right);
  181. EXPECT_EQ(expected, actual);
  182. }
  183. ////////////////////////////////////////////////////////////////////////
  184. // Fq12Square
  185. TEST(TinyFq12Test, Fq12SquareWorks) {
  186. Fq12Elem expected = {{{{0xb2718e2f, 0x5acdc81c, 0x00964828, 0x20087676,
  187. 0x5ae15b61, 0x4fd4da11, 0xe092dfeb, 0x58534fb6},
  188. {0xccc9dc07, 0x1004c642, 0x4d95229d, 0x82350b1c,
  189. 0x9771ce95, 0xd9a24ede, 0xbd10467b, 0xc7ed3445}},
  190. {{0xbde22884, 0x8354762f, 0x86ba1554, 0x63db32bb,
  191. 0x0bae02fd, 0x6d0d96e8, 0xcf9ffd11, 0xb8fe4b31},
  192. {0x2d04f196, 0x23e1a987, 0x99e976e3, 0xa037f309,
  193. 0xe90221d9, 0x201fec2a, 0x46d79de9, 0xc93a6bd2}},
  194. {{0x5c58af07, 0xd9343489, 0xb4f19136, 0xff508b82,
  195. 0xc14265f4, 0xa4d22c7b, 0x6e928f38, 0xe279749e},
  196. {0xa1d790b2, 0xcf37602c, 0xc842e733, 0x72c2773a,
  197. 0xc4d0ad50, 0x707594fb, 0x969b8864, 0x0979561b}}},
  198. {{{0x24a687fb, 0xfb396e79, 0xc34718eb, 0x2b491ee6,
  199. 0xba812deb, 0xc6dfa2d8, 0x4c2bd958, 0x692fc435},
  200. {0x0b3d5a09, 0xb3310b79, 0xcb0179fe, 0x8e8a4e82,
  201. 0x79cf9278, 0x1b884773, 0xe7bfdc35, 0xb64b17bf}},
  202. {{0x7928c472, 0xbc2fe39f, 0xa4eff880, 0xd700813f,
  203. 0x555725f0, 0x43a4f63e, 0x857b8b39, 0x96614e14},
  204. {0x0ba1d9bb, 0x78f7e930, 0x13c1d603, 0xe2f9587b,
  205. 0x19c67a04, 0x3931bdf3, 0x3c6271ae, 0xdde60cd5}},
  206. {{0xa376e35d, 0xd157352f, 0x040e0af6, 0x0e36afd1,
  207. 0x9cfbfb84, 0x9cd3d83a, 0x94b83ec5, 0x1de41161},
  208. {0xf1424d67, 0x5ecaee6f, 0x25a809b2, 0x00abd96d,
  209. 0x2b2da6c7, 0xbcfeab22, 0x6072fb3a, 0x75474592}}}};
  210. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  211. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  212. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  213. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  214. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  215. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  216. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  217. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  218. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  219. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  220. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  221. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  222. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  223. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  224. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  225. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  226. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  227. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  228. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  229. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  230. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  231. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  232. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  233. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  234. Fq12Elem actual = {0};
  235. Fq12Square(&actual, &left);
  236. EXPECT_EQ(expected, actual);
  237. }
  238. ////////////////////////////////////////////////////////////////////////
  239. // Fq12Mul
  240. TEST(TinyFq12Test, Fq12MultWorks) {
  241. Fq12Elem expected = {{{{0x054b2248, 0x40490d13, 0xa309fba1, 0xcda4a1ef,
  242. 0xe6efd6b9, 0x6dbdd131, 0xfde112e9, 0xaf90b12e},
  243. {0x4e21c944, 0x03e20ec3, 0xed4543f5, 0x7a577659,
  244. 0x81d1fd42, 0xea9a8c1c, 0x791b36af, 0x870740ff}},
  245. {{0x8d2c2a6e, 0xe8ce5ca0, 0xe528c957, 0x84cd9406,
  246. 0x34a3c63a, 0x2b928ab5, 0x66655119, 0x91ff61ee},
  247. {0x4c30c782, 0x4fd5522a, 0xfd8d17f1, 0xa3a6f430,
  248. 0x37bf9b7b, 0x72928155, 0x66037689, 0x4c8e67bc}},
  249. {{0x35a5ce87, 0x1b25e22e, 0x2313705b, 0x9e3e6eb6,
  250. 0x8675e450, 0x33d9cdc4, 0x569c1b3e, 0xd9027fce},
  251. {0x4f74f503, 0xecbc164d, 0x48ce7250, 0x32b9fb72,
  252. 0x8b726b18, 0xc0872542, 0xcb8d6a0b, 0xfecc8ed3}}},
  253. {{{0x1a907f78, 0x04356cb2, 0x03360ad2, 0xba867ae8,
  254. 0xa1d5266f, 0xb5896fcf, 0x7013d8a3, 0x587b138f},
  255. {0x30de9fe0, 0xacde6ad3, 0xdb1dcd3d, 0x765f2eac,
  256. 0x7f665d4e, 0xedc431a0, 0xd9057e43, 0x1bd63b89}},
  257. {{0x16e913c4, 0xdc0a393e, 0xa9780dac, 0xa0e35293,
  258. 0x99e4eb2f, 0x80654405, 0x9a51d4b9, 0x890d2fa3},
  259. {0x7a415a23, 0x7252917f, 0xb05a73ac, 0xe8a7f092,
  260. 0x9e68afd0, 0xfe5b63d2, 0x68ecfa20, 0xe3a9f4e0}},
  261. {{0x3a77ca45, 0x282422b7, 0x613276da, 0x5bc45097,
  262. 0x95ea8ee4, 0x4a7a7633, 0xc9bb3324, 0xe396b7b4},
  263. {0xf37c26a1, 0x8009faaa, 0x0779b7c1, 0x6ef10242,
  264. 0xcd5a86eb, 0x2dd2897e, 0x2b5f0b01, 0x0b79178d}}}};
  265. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  266. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  267. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  268. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  269. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  270. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  271. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  272. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  273. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  274. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  275. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  276. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  277. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  278. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  279. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  280. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  281. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  282. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  283. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  284. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  285. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  286. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  287. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  288. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  289. Fq12Elem right = {{{{0x848cdb73, 0x6399829e, 0xcaa20cc0, 0x1b02bff6,
  290. 0x2b477bd2, 0xf9d48534, 0xff7929a0, 0xd4745161},
  291. {0xe323d956, 0xf8a05a85, 0xe02d5e1e, 0xfd533966,
  292. 0xe7d31209, 0xc7786143, 0x91b441f6, 0x7409d67d}},
  293. {{0xc763c01c, 0x8d45cdc1, 0xe46054e2, 0xc6216337,
  294. 0x97589d24, 0xe57d5f07, 0xeec3f4b6, 0xfe2a593f},
  295. {0x96748337, 0x31fbd2e4, 0x72e72c33, 0x96fe633a,
  296. 0x4f48fed2, 0xf6a92484, 0x5e7de24a, 0x8a963657}},
  297. {{0x48a24137, 0xc529544f, 0xe83111bc, 0xbd151156,
  298. 0x6b0c7ee2, 0x1bc18974, 0x01193d6b, 0x6b716d4d},
  299. {0x90c2469b, 0xb1ae7b57, 0x22ce6905, 0x58c5a086,
  300. 0xc750dfa2, 0x28ea9d9d, 0x6134f34f, 0x68cf7885}}},
  301. {{{0x771f4d50, 0x113c642f, 0x983d5b97, 0xd8fed4c2,
  302. 0x166e53b0, 0x4797d81c, 0x9955788c, 0xbd7c6c23},
  303. {0xd9d2246a, 0x092e1780, 0xd8a1ac25, 0xc23607e5,
  304. 0x8c58b02e, 0x2c543c7e, 0x4c082083, 0xc4577f4d}},
  305. {{0xb433c5de, 0x6ab7893e, 0x5ff5e970, 0x24de35b6,
  306. 0x65b8022c, 0x89c649d3, 0x7629ec0b, 0x6046bfbd},
  307. {0xcdab3158, 0xefd0e691, 0xeb7ca8b3, 0xbbe4015c,
  308. 0xcb5d6828, 0xd313d3ec, 0x0b0125d2, 0xac823c7f}},
  309. {{0x3e500486, 0xd17db7a2, 0x8d174e88, 0x8504ae57,
  310. 0x1d09fdcb, 0xeda97288, 0xd8a573c9, 0x32233b3f},
  311. {0x41145b9e, 0x4f61f713, 0xd1caf67d, 0x3299a2ff,
  312. 0x3586b78d, 0x6b31995f, 0xe51708e4, 0x9eab4090}}}};
  313. Fq12Elem actual = {0};
  314. Fq12Mul(&actual, &left, &right);
  315. EXPECT_EQ(expected, actual);
  316. }
  317. ////////////////////////////////////////////////////////////////////////
  318. // Fq12Inv
  319. TEST(TinyFq12Test, Fq12InvWorks) {
  320. Fq12Elem expected = {{{{0xcf7ba426, 0x4bb2c4c3, 0xfb50fa73, 0xb70c280d,
  321. 0xb5cf02c7, 0xb047bc29, 0x7cd8b4d1, 0xc238e14d},
  322. {0xd1bc45de, 0xc113277d, 0x5189b836, 0x49694d5b,
  323. 0xc4084edb, 0xc837f717, 0xf65566eb, 0x519dad22}},
  324. {{0x62b12d6e, 0xc2a49558, 0x0f36f3b8, 0x2274fc44,
  325. 0xd7ef63a2, 0x7a0f59da, 0xc4fa06c3, 0x812be980},
  326. {0xc887fc84, 0xbeb1803c, 0x5ec3d49f, 0x7c32ae46,
  327. 0x97fb66b2, 0x470acb13, 0x2e9d2992, 0x88dd93d5}},
  328. {{0x47087924, 0x143c1bba, 0x4fe23ddb, 0x6be4e322,
  329. 0x3cabd640, 0xdf2f66c9, 0x2d309380, 0xa244260f},
  330. {0xf899db8a, 0xb5a83982, 0x264e1961, 0xe8a8ce8c,
  331. 0xe94ceacf, 0xd18bd271, 0x67f10894, 0xc82e0f88}}},
  332. {{{0x61170257, 0x9740a14e, 0xdd90ec1f, 0xfc1a7d8b,
  333. 0x2a37d62c, 0xa6577bc2, 0xe610b5d6, 0xe0b70389},
  334. {0x8192b447, 0x2fd37cbc, 0xc3f80c5b, 0x618f95a1,
  335. 0x21e22c0c, 0xf35bd82b, 0xbf635e7d, 0x990ac1f2}},
  336. {{0x790d6584, 0xf40c0f6e, 0x83ca3d0f, 0x96f7c28d,
  337. 0x8a2662fa, 0xc83bfe45, 0x8be01843, 0x87a00b86},
  338. {0x6020320a, 0x73199db4, 0x4d5dd850, 0x14cf247d,
  339. 0x34fb1d44, 0x8ababc0d, 0x7c849de5, 0x81226e85}},
  340. {{0x6453b966, 0xbbd595ea, 0x704c45e2, 0x5d4cd2a1,
  341. 0x8ee6cc5e, 0x336a21d8, 0x87955196, 0xc9e0915a},
  342. {0x83330d6a, 0x200dbac0, 0x6b9e8ee8, 0xe6a33cf8,
  343. 0x4dc48908, 0xd0a02fdb, 0x0f715987, 0x5f4b9d5b}}}};
  344. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  345. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  346. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  347. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  348. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  349. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  350. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  351. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  352. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  353. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  354. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  355. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  356. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  357. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  358. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  359. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  360. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  361. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  362. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  363. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  364. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  365. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  366. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  367. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  368. Fq12Elem actual = {0};
  369. Fq12Inv(&actual, &left);
  370. EXPECT_EQ(expected, actual);
  371. }
  372. ////////////////////////////////////////////////////////////////////////
  373. // Fq12Neg
  374. TEST(TinyFq12Test, Fq12NegWorks) {
  375. Fq12Elem expected = {{{{0x8c035971, 0xaf40febd, 0x3d89f632, 0x24887d6e,
  376. 0x3ecb5147, 0xff6580f2, 0x0023a5bd, 0xa19bcedb},
  377. {0x61afe694, 0xba8b7e8e, 0x07d2460a, 0xd758834b,
  378. 0xb9944e4d, 0x2b2cfe7e, 0xe1ddaf4c, 0x755ba40a}},
  379. {{0xff363b04, 0xf3770d54, 0xfb887eb6, 0x97208d71,
  380. 0x913888b6, 0xbe3b78dc, 0x504e9cec, 0x1328c6a8},
  381. {0x80a4bcc9, 0xdc414b24, 0x81e12ae2, 0xddece243,
  382. 0x9e717f72, 0x2eae9d50, 0xe0b74a59, 0x6c2aa832}},
  383. {{0xe3749624, 0x90f1e179, 0xe064c5e0, 0xa23c1333,
  384. 0x80199e94, 0x0df7593b, 0x5e70bcc6, 0xa7d12130},
  385. {0x2795eeb3, 0x2242ac58, 0xa5ea27c6, 0x9521d69a,
  386. 0xc7850525, 0x7e332c4c, 0x8614e36d, 0xe7f0249e}}},
  387. {{{0x5d2baf76, 0xda3c8c87, 0xd629e68e, 0x5f5bcff7,
  388. 0x8bc99594, 0x053eaed0, 0x9cc158f1, 0xd400823f},
  389. {0xfe3bbd78, 0xe93cc691, 0x003899c3, 0x63371f3e,
  390. 0x7ff0eb49, 0x1752449a, 0x6d89adab, 0xc2ac64db}},
  391. {{0xdd619055, 0x6e0c70ca, 0x8852e58e, 0xe7350261,
  392. 0x45a585a9, 0x3d0f971c, 0x20453822, 0xa71bc6c3},
  393. {0x1aeb696d, 0x7deb08f4, 0xd4ca7881, 0x36531fe8,
  394. 0x42bb2179, 0x55e25789, 0x420d8238, 0x1c483361}},
  395. {{0xfc43d59b, 0x4a1df76a, 0xeed743a2, 0x21c9e9b2,
  396. 0x684aa678, 0xfde77a80, 0x4379e6d4, 0x985d02d4},
  397. {0xb9bbd2d7, 0xab67c387, 0x7ef6d8be, 0xfc039a6c,
  398. 0x37961f18, 0x31aac6a4, 0x3b2b7fc6, 0x41bae421}}}};
  399. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  400. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  401. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  402. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  403. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  404. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  405. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  406. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  407. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  408. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  409. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  410. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  411. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  412. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  413. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  414. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  415. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  416. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  417. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  418. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  419. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  420. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  421. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  422. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  423. Fq12Elem actual = {0};
  424. Fq12Neg(&actual, &left);
  425. EXPECT_EQ(expected, actual);
  426. }
  427. ////////////////////////////////////////////////////////////////////////
  428. // Fq12Set
  429. TEST(TinyFq12Test, Fq12SetWorks) {
  430. Fq12Elem result = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  431. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  432. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  433. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  434. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  435. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  436. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  437. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  438. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  439. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  440. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  441. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  442. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  443. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  444. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  445. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  446. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  447. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  448. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  449. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  450. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  451. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  452. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  453. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  454. Fq12Elem expected = {{{{0x00000010, 0}, {0}}}};
  455. uint32_t val = 0x10;
  456. Fq12Set(&result, val);
  457. EXPECT_EQ(expected, result);
  458. }
  459. ////////////////////////////////////////////////////////////////////////
  460. // Fq12Exp
  461. TEST(TinyFq12Test, Fq12ExpWorks) {
  462. Fq12Elem expected = {{{{0x07770c93, 0x5820d5a9, 0x65189432, 0x5f5d67ff,
  463. 0xe257644a, 0x41318fa0, 0x6ab6be96, 0xf104adf8},
  464. {0x6d5cae3a, 0x2e43c14b, 0xede9dbfe, 0x6743d276,
  465. 0x35d13a61, 0xf25d3672, 0x6a36930c, 0x9bdbed9d}},
  466. {{0x12fc551f, 0x9ff0f349, 0x4131b828, 0x50c353ed,
  467. 0x785d7e8b, 0xbb894c96, 0xee86c2d1, 0x8af21330},
  468. {0x45a7337a, 0xb0f0d8c5, 0xacfb0dbd, 0x1f775366,
  469. 0x12303719, 0x6f7208bd, 0x68c1bf17, 0x14b60ae7}},
  470. {{0xcdf00f9c, 0xbd6529d8, 0x693b8a51, 0xcb9eb968,
  471. 0x46c25f48, 0x39cbf307, 0xd7283cd4, 0x8cbb7dd9},
  472. {0xb18b24c2, 0x5a98714f, 0x0782ea19, 0x8af18c94,
  473. 0x22373570, 0xe24e7fef, 0x0510369a, 0xc5399438}}},
  474. {{{0x141a7578, 0x05e94e05, 0x08ec385f, 0x3a5ae1ef,
  475. 0xccd4f61a, 0x3291d9f6, 0xb7b07242, 0xb1742404},
  476. {0xec5f69b1, 0x68fbad6b, 0x167e8ec8, 0x67c97e56,
  477. 0x1ac21584, 0x783e2b30, 0x8c2dd9dd, 0xd4ed7488}},
  478. {{0xb591926f, 0x97f68a1f, 0xd3bccfb8, 0x9a58152b,
  479. 0x9e12cf14, 0x0a82dfd6, 0x8c246e88, 0x94bcbc8a},
  480. {0xa95962fe, 0x342b7e99, 0xddc1c0d9, 0x15a4e0f8,
  481. 0x64475d29, 0xbce1bd39, 0xa79dd2ee, 0xee505176}},
  482. {{0xdb49f8cf, 0x10cdb302, 0xf5c48053, 0x83ce1f18,
  483. 0x988d4d5c, 0xd305fb4e, 0xbb11f2bb, 0x2f391894},
  484. {0x084c02ad, 0x26eae084, 0x4d81e78d, 0x9750454d,
  485. 0xdb062196, 0xae6ad23e, 0x18588c31, 0xb3d78420}}}};
  486. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  487. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  488. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  489. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  490. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  491. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  492. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  493. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  494. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  495. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  496. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  497. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  498. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  499. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  500. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  501. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  502. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  503. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  504. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  505. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  506. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  507. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  508. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  509. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  510. VeryLargeInt exponent = {0x76abb18a, 0x92c0f7b9, 0x2c1a37e0, 0x7fdf6ca1,
  511. 0xe3401760, 0x66eb7d52, 0x918d50a7, 0x12a65bd6};
  512. Fq12Elem actual = {0};
  513. Fq12Exp(&actual, &left, &exponent);
  514. EXPECT_EQ(expected, actual);
  515. }
  516. ////////////////////////////////////////////////////////////////////////
  517. // Fq12MultiExp
  518. TEST(TinyFq12Test, Fq12MultiExpWorks) {
  519. Fq12Elem expected = {{{{0x9b800ac0, 0x1fb360b8, 0x9af601c4, 0x4931f447,
  520. 0x31152f7c, 0x7f6b2489, 0x2fbeed91, 0xcc7a6ac0},
  521. {0xb76c0d77, 0x5b09b4be, 0x4a8fc1d4, 0x2e5222d1,
  522. 0x6b6e41e6, 0x9ea53fff, 0x6daabae4, 0x591274a2}},
  523. {{0xb669c611, 0xc8b0430b, 0xa7c054c3, 0x360bd4bc,
  524. 0xf09ef81c, 0x4d5bb8b1, 0x9333c78f, 0x32ff73b8},
  525. {0x90ec74e4, 0xe1e77b28, 0xb453b94a, 0xf7bf242c,
  526. 0xdbee7487, 0x29b8c962, 0x31bcb2b5, 0x06737ced}},
  527. {{0x26f4def9, 0xc706336d, 0x18aae9bf, 0x9b568de1,
  528. 0x4e0fa721, 0x10695d37, 0x44a446e4, 0x1f90fc31},
  529. {0xec9525dc, 0x4f63a5d6, 0x07e9f19c, 0x982ac0b8,
  530. 0x818c07fc, 0x2603a2c4, 0x44e6a144, 0xb8a617a5}}},
  531. {{{0x34f08dcb, 0x0afd33cc, 0x38921139, 0x10c707ef,
  532. 0x1bcd1d79, 0x1cee939a, 0x08831471, 0x2318f2b4},
  533. {0x8e4f9261, 0x37304a70, 0xb24df55d, 0xd93a8a20,
  534. 0x32ff13b2, 0x342ce4a7, 0x25185cd0, 0xd974dca3}},
  535. {{0x0a83a8aa, 0xf2e71e4e, 0x0e0af78b, 0x85363dfa,
  536. 0xf825e945, 0x01d733f5, 0xf54d7f42, 0x3c77fa71},
  537. {0xb5a7931b, 0x25c5c577, 0x6d21b52e, 0xbc951e9b,
  538. 0x51dd45b9, 0x743e886f, 0x6bc839d4, 0xd7deccd5}},
  539. {{0x947af194, 0xd0239f95, 0x1dde9421, 0x59369d3e,
  540. 0xd9863881, 0xb9c24b75, 0xcbdb4021, 0x4c940810},
  541. {0x96070307, 0x4f68fbf2, 0x5a719a10, 0x73b7cc22,
  542. 0x4ef192e7, 0xbb5b635e, 0xdeb5746b, 0x89b5a530}}}};
  543. Fq12Elem pairing_out = {{{{0x50ab7bc6, 0xd28d33ca, 0xa7de4ce1, 0x162996ed,
  544. 0xad5ee231, 0x4fc0a501, 0x468be932, 0xba101ff6},
  545. {0x14d36207, 0x34c44c84, 0xdfa22b9e, 0x1f4d1fc0,
  546. 0xcb0454f2, 0xc4077c42, 0xebde30b6, 0x15eb79f4}},
  547. {{0xf91d7519, 0xc456caad, 0xb908d0d3, 0x31b0be8c,
  548. 0x1c0def81, 0x80e14649, 0x4657b6e7, 0xf18b84d1},
  549. {0xec73b557, 0xf8acbc05, 0x2e5f0a7e, 0xf485e0eb,
  550. 0x6fd516b6, 0xb7190100, 0xc1fa4e50, 0x3fee7c43}},
  551. {{0xb3ebe0e5, 0xc572866a, 0xa10be392, 0x2d6f653d,
  552. 0x138bb1b6, 0x87cf70ba, 0xbbef8650, 0xe3b31829},
  553. {0x4ba31303, 0x8d1afe6e, 0xe7138780, 0x36a08173,
  554. 0xcdc3182a, 0x1ecb0486, 0xd5a961a5, 0xda0e5787}}},
  555. {{{0x0b13b454, 0xa62f5fbf, 0xa4bed641, 0xd3632805,
  556. 0xe8010941, 0x72cebb51, 0x8aaa0095, 0x669e804d},
  557. {0xe49b7149, 0x8fc69d31, 0x956d88ab, 0x265c926b,
  558. 0x3bb2f1d4, 0xbfc206ea, 0x6f29d6da, 0x5b5065dc}},
  559. {{0x0ff0848e, 0x1f3fdf5c, 0xb3533098, 0x1a434003,
  560. 0xc80d2a60, 0x4ac6aa4a, 0xc99fbca8, 0xe0ce978f},
  561. {0x3357d172, 0xf5f8a018, 0x5908b3da, 0xe540395c,
  562. 0xb654a226, 0x89cef58e, 0x47786d9f, 0x5a5d41d2}},
  563. {{0x788a3989, 0x49a5f719, 0x5a0042e3, 0x92f94303,
  564. 0x1bd0e6c8, 0x81c5ac15, 0xe8a05ec8, 0xbbba6ced},
  565. {0x6d17dc8e, 0xaf351b75, 0xba6e2c36, 0x2a04ea26,
  566. 0x421e1737, 0x16fd0bfe, 0x4bb33376, 0x32aebf4d}}}};
  567. Fq12Elem pairing_inv = {{{{0x50ab7bc6, 0xd28d33ca, 0xa7de4ce1, 0x162996ed,
  568. 0xad5ee231, 0x4fc0a501, 0x468be932, 0xba101ff6},
  569. {0x14d36207, 0x34c44c84, 0xdfa22b9e, 0x1f4d1fc0,
  570. 0xcb0454f2, 0xc4077c42, 0xebde30b6, 0x15eb79f4}},
  571. {{0xf91d7519, 0xc456caad, 0xb908d0d3, 0x31b0be8c,
  572. 0x1c0def81, 0x80e14649, 0x4657b6e7, 0xf18b84d1},
  573. {0xec73b557, 0xf8acbc05, 0x2e5f0a7e, 0xf485e0eb,
  574. 0x6fd516b6, 0xb7190100, 0xc1fa4e50, 0x3fee7c43}},
  575. {{0xb3ebe0e5, 0xc572866a, 0xa10be392, 0x2d6f653d,
  576. 0x138bb1b6, 0x87cf70ba, 0xbbef8650, 0xe3b31829},
  577. {0x4ba31303, 0x8d1afe6e, 0xe7138780, 0x36a08173,
  578. 0xcdc3182a, 0x1ecb0486, 0xd5a961a5, 0xda0e5787}}},
  579. {{{0xa3bf7bbf, 0x2cf9ce1c, 0x6dd93441, 0x39793df5,
  580. 0x06709b5d, 0xd417370d, 0x7552f037, 0x99617fb2},
  581. {0xca37beca, 0x436290a9, 0x7d2a81d7, 0xe67fd38f,
  582. 0xb2beb2ca, 0x8723eb74, 0x90d319f2, 0xa4af9a23}},
  583. {{0x9ee2ab85, 0xb3e94e7f, 0x5f44d9ea, 0xf29925f7,
  584. 0x26647a3e, 0xfc1f4814, 0x365d3424, 0x1f316870},
  585. {0x7b7b5ea1, 0xdd308dc3, 0xb98f56a7, 0x279c2c9e,
  586. 0x381d0278, 0xbd16fcd0, 0xb884832d, 0xa5a2be2d}},
  587. {{0x3648f68a, 0x898336c2, 0xb897c79f, 0x79e322f7,
  588. 0xd2a0bdd6, 0xc5204649, 0x175c9204, 0x44459312},
  589. {0x41bb5385, 0x23f41266, 0x5829de4c, 0xe2d77bd4,
  590. 0xac538d67, 0x2fe8e660, 0xb449bd57, 0xcd5140b2}}}};
  591. VeryLargeInt exponent = {0x76abb18a, 0x92c0f7b9, 0x2c1a37e0, 0x7fdf6ca1,
  592. 0xe3401760, 0x66eb7d52, 0x918d50a7, 0x12a65bd6};
  593. Fq12Elem b1 = pairing_inv;
  594. Fq12Elem b2 = pairing_out;
  595. Fq12Elem b3 = pairing_out;
  596. VeryLargeInt e1 = exponent;
  597. VeryLargeInt e2 = {0};
  598. VeryLargeInt e3 = exponent;
  599. // pairing_out^exp * pairing_out^(-exp) * pairing_out^0 * pairing_out^exp ==
  600. // pairing_out^exp
  601. Fq12Elem actual = {0};
  602. Fq12MultiExp(&actual, &pairing_out, &exponent, &b1, &e1, &b2, &e2, &b3, &e3);
  603. EXPECT_EQ(expected, actual);
  604. }
  605. ////////////////////////////////////////////////////////////////////////
  606. // Fq12Eq
  607. TEST(TinyFq12Test, Fq12EqPasses) {
  608. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  609. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  610. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  611. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  612. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  613. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  614. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  615. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  616. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  617. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  618. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  619. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  620. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  621. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  622. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  623. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  624. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  625. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  626. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  627. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  628. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  629. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  630. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  631. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  632. Fq12Elem left2 = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  633. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  634. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  635. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  636. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  637. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  638. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  639. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  640. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  641. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  642. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  643. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  644. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  645. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  646. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  647. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  648. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  649. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  650. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  651. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  652. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  653. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  654. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  655. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  656. EXPECT_TRUE(Fq12Eq(&left, &left2));
  657. }
  658. TEST(TinyFq12Test, Fq12EqFails) {
  659. Fq12Elem left = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  660. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  661. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  662. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  663. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  664. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  665. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  666. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  667. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  668. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  669. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  670. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  671. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  672. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  673. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  674. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  675. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  676. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  677. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  678. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  679. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  680. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  681. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  682. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  683. Fq12Elem right = {{{{0x848cdb73, 0x6399829e, 0xcaa20cc0, 0x1b02bff6,
  684. 0x2b477bd2, 0xf9d48534, 0xff7929a0, 0xd4745161},
  685. {0xe323d956, 0xf8a05a85, 0xe02d5e1e, 0xfd533966,
  686. 0xe7d31209, 0xc7786143, 0x91b441f6, 0x7409d67d}},
  687. {{0xc763c01c, 0x8d45cdc1, 0xe46054e2, 0xc6216337,
  688. 0x97589d24, 0xe57d5f07, 0xeec3f4b6, 0xfe2a593f},
  689. {0x96748337, 0x31fbd2e4, 0x72e72c33, 0x96fe633a,
  690. 0x4f48fed2, 0xf6a92484, 0x5e7de24a, 0x8a963657}},
  691. {{0x48a24137, 0xc529544f, 0xe83111bc, 0xbd151156,
  692. 0x6b0c7ee2, 0x1bc18974, 0x01193d6b, 0x6b716d4d},
  693. {0x90c2469b, 0xb1ae7b57, 0x22ce6905, 0x58c5a086,
  694. 0xc750dfa2, 0x28ea9d9d, 0x6134f34f, 0x68cf7885}}},
  695. {{{0x771f4d50, 0x113c642f, 0x983d5b97, 0xd8fed4c2,
  696. 0x166e53b0, 0x4797d81c, 0x9955788c, 0xbd7c6c23},
  697. {0xd9d2246a, 0x092e1780, 0xd8a1ac25, 0xc23607e5,
  698. 0x8c58b02e, 0x2c543c7e, 0x4c082083, 0xc4577f4d}},
  699. {{0xb433c5de, 0x6ab7893e, 0x5ff5e970, 0x24de35b6,
  700. 0x65b8022c, 0x89c649d3, 0x7629ec0b, 0x6046bfbd},
  701. {0xcdab3158, 0xefd0e691, 0xeb7ca8b3, 0xbbe4015c,
  702. 0xcb5d6828, 0xd313d3ec, 0x0b0125d2, 0xac823c7f}},
  703. {{0x3e500486, 0xd17db7a2, 0x8d174e88, 0x8504ae57,
  704. 0x1d09fdcb, 0xeda97288, 0xd8a573c9, 0x32233b3f},
  705. {0x41145b9e, 0x4f61f713, 0xd1caf67d, 0x3299a2ff,
  706. 0x3586b78d, 0x6b31995f, 0xe51708e4, 0x9eab4090}}}};
  707. EXPECT_FALSE(Fq12Eq(&left, &right));
  708. }
  709. ////////////////////////////////////////////////////////////////////////
  710. // Fq12Conj
  711. TEST(TinyFq12Test, Fq12ConjWorks) {
  712. Fq12Elem expected = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  713. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  714. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  715. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  716. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  717. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  718. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  719. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  720. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  721. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  722. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  723. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  724. {{{0x5d2baf76, 0xda3c8c87, 0xd629e68e, 0x5f5bcff7,
  725. 0x8bc99594, 0x053eaed0, 0x9cc158f1, 0xd400823f},
  726. {0xfe3bbd78, 0xe93cc691, 0x003899c3, 0x63371f3e,
  727. 0x7ff0eb49, 0x1752449a, 0x6d89adab, 0xc2ac64db}},
  728. {{0xdd619055, 0x6e0c70ca, 0x8852e58e, 0xe7350261,
  729. 0x45a585a9, 0x3d0f971c, 0x20453822, 0xa71bc6c3},
  730. {0x1aeb696d, 0x7deb08f4, 0xd4ca7881, 0x36531fe8,
  731. 0x42bb2179, 0x55e25789, 0x420d8238, 0x1c483361}},
  732. {{0xfc43d59b, 0x4a1df76a, 0xeed743a2, 0x21c9e9b2,
  733. 0x684aa678, 0xfde77a80, 0x4379e6d4, 0x985d02d4},
  734. {0xb9bbd2d7, 0xab67c387, 0x7ef6d8be, 0xfc039a6c,
  735. 0x37961f18, 0x31aac6a4, 0x3b2b7fc6, 0x41bae421}}}};
  736. Fq12Elem input = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c,
  737. 0xafa65357, 0x4780716c, 0xffd94b0f, 0x5e643124},
  738. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0,
  739. 0x34dd5651, 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  740. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889,
  741. 0x5d391be8, 0x88aa7982, 0xafae53e0, 0xecd73957},
  742. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7,
  743. 0x5000252c, 0x1837550e, 0x1f45a674, 0x93d557cd}},
  744. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7,
  745. 0x6e58060a, 0x38ee9923, 0xa18c3407, 0x582edecf},
  746. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60,
  747. 0x26ec9f79, 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  748. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603,
  749. 0x62a80f0a, 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  750. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd,
  751. 0x6e80b955, 0x2f93adc4, 0x92734322, 0x3d539b24}},
  752. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399,
  753. 0xa8cc1ef5, 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  754. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612,
  755. 0xabb68325, 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  756. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48,
  757. 0x8626fe26, 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  758. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e,
  759. 0xb6db8586, 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  760. Fq12Elem actual = {0};
  761. Fq12Conj(&actual, &input);
  762. EXPECT_EQ(expected, actual);
  763. }
  764. ////////////////////////////////////////////////////////////////////////
  765. // Fq12ExpCyc
  766. TEST(TinyFq12Test, Fq12ExpCycWorks) {
  767. Fq12Elem expected = {{{{0x44415742, 0xce586503, 0xe5cc514f, 0x731d97a3,
  768. 0xe8c98357, 0xb1de361d, 0x15cf9bfc, 0x4ca54124},
  769. {0x7decae5a, 0x572ae946, 0x4244f518, 0x1490b9e4,
  770. 0xbbbafdb2, 0xb2d13f3f, 0xae1de024, 0xe224dc2f}},
  771. {{0x876377f0, 0x2c75d3ab, 0x5aa65a1d, 0x42ff41fa,
  772. 0x2729ff86, 0x8f76d40f, 0x2c224666, 0xce3d5926},
  773. {0x4f0b47eb, 0xa45887d9, 0xf4407be2, 0xaaedbf4a,
  774. 0x9f8a426e, 0x809a601a, 0xea000edd, 0x4fe97056}},
  775. {{0x7eb3ea97, 0xd6769b11, 0x2f2bed07, 0x6fbb5801,
  776. 0x1e67136e, 0x2fd1e9a3, 0x242559de, 0x5a018155},
  777. {0xb66ad800, 0x51924848, 0xdecddaa8, 0x3eed0649,
  778. 0xcf7f3edb, 0x17dcaa6e, 0x27cd41c7, 0x055a6039}}},
  779. {{{0x09d45f4f, 0x3d360f00, 0x7561c4fb, 0x70500d0f,
  780. 0x20851a64, 0x5c5ed2a6, 0x6118fe9e, 0xfa05dc75},
  781. {0x57b872d1, 0x9a19e54d, 0x3395e069, 0x29d98c64,
  782. 0xcdbdda55, 0x001f07e7, 0x8aeaca7f, 0x747c1dc8}},
  783. {{0x0c0cb22d, 0x75ca59be, 0x202684e4, 0xec1b56c5,
  784. 0x46434c3f, 0x55f52f7a, 0xfcb5686b, 0x0a1172be},
  785. {0xf0b043af, 0xbb2ae039, 0xccbdac3c, 0x8f42a6f2,
  786. 0x06c264ab, 0xa47599b7, 0xc6a8c454, 0xa5b257e3}},
  787. {{0x8700f8b7, 0x4090b69d, 0x20e35539, 0xfd30e911,
  788. 0xa08ecbf5, 0xb038eb7b, 0x6ea872c3, 0xdfa0f669},
  789. {0x5600be7b, 0x43ec3905, 0xc830ae6e, 0xd9780bec,
  790. 0xe7d288c3, 0xcff72a6e, 0x059b9c31, 0x66ebb803}}}};
  791. Fq12Elem input = {{{{0x4200e30a, 0xebf627b9, 0x607ebce6, 0x7848a894,
  792. 0xe1b736d1, 0x4c9dd307, 0x9e1301e3, 0x07256eb7},
  793. {0xe17a0b54, 0x0e02f2d5, 0x3df772e0, 0x9155aaa2,
  794. 0x3c5ffcc6, 0x8427940b, 0x362f51ee, 0x331e0c73}},
  795. {{0x954eecdb, 0x970bc820, 0x92d1776a, 0x02f81e51,
  796. 0x8a7a9216, 0x6172111f, 0x9bd29665, 0x9612d47d},
  797. {0x8fceb2c7, 0xb3f7eced, 0xa3d0a21e, 0xd66c6583,
  798. 0xf273f385, 0x827df9e6, 0x503de81c, 0x5b2cae32}},
  799. {{0xf08207ed, 0x7ab76686, 0xb681b701, 0x9d19d066,
  800. 0x81956e08, 0x2ca17f37, 0x65d1d24e, 0x0cff7cb8},
  801. {0xf9cd6e9e, 0x4821363b, 0xb0bc2b8c, 0xa380ecbb,
  802. 0x7b04aea0, 0x396f0948, 0x93619efe, 0x42aa1fd4}}},
  803. {{{0x805b8aa4, 0x23ab6f9a, 0x937ea209, 0x9dba1ab2,
  804. 0x426d02b7, 0x36782ff4, 0xe371d373, 0x66873347},
  805. {0x51d27dea, 0xd40cd434, 0xd5627a4d, 0xbcc747de,
  806. 0xa54b31ec, 0x3e2c2fa4, 0x4f07b689, 0xb33b79bc}},
  807. {{0xfeea300c, 0x26ab30d9, 0x92c098e9, 0x192c191b,
  808. 0xeefd498c, 0x3cd4e4ac, 0xe9a3f142, 0x00bdca46},
  809. {0xeb1edad0, 0xd4c2439e, 0x51025e46, 0x006cfb7c,
  810. 0x04b6efda, 0x159f7c19, 0xa1085a5e, 0x459833d5}},
  811. {{0xeb08632d, 0x3c4ecf58, 0x02624178, 0xf65dbcf5,
  812. 0xeb320af5, 0xce34c3db, 0x799ea805, 0x1f944aa2},
  813. {0x6f488ba6, 0x07f9f8dc, 0x690e6d4b, 0xa45b11be,
  814. 0x8d39f017, 0x96619fec, 0x6100af71, 0x16201c36}}}};
  815. VeryLargeInt pairing_t = {0x30b0a801, 0x6882f5c0, 0x00000000, 0x00000000,
  816. 0x00000000, 0x00000000, 0x00000000, 0x00000000};
  817. Fq12Elem actual = {0};
  818. Fq12ExpCyc(&actual, &input, &pairing_t);
  819. EXPECT_EQ(expected, actual);
  820. }
  821. ////////////////////////////////////////////////////////////////////////
  822. // Fq12SqCyc
  823. TEST(TinyFq12Test, Fq12SqCycWorks) {
  824. const Fq12Elem a = {{{{0x4200e30a, 0xebf627b9, 0x607ebce6, 0x7848a894,
  825. 0xe1b736d1, 0x4c9dd307, 0x9e1301e3, 0x07256eb7},
  826. {0xe17a0b54, 0x0e02f2d5, 0x3df772e0, 0x9155aaa2,
  827. 0x3c5ffcc6, 0x8427940b, 0x362f51ee, 0x331e0c73}},
  828. {{0x954eecdb, 0x970bc820, 0x92d1776a, 0x02f81e51,
  829. 0x8a7a9216, 0x6172111f, 0x9bd29665, 0x9612d47d},
  830. {0x8fceb2c7, 0xb3f7eced, 0xa3d0a21e, 0xd66c6583,
  831. 0xf273f385, 0x827df9e6, 0x503de81c, 0x5b2cae32}},
  832. {{0xf08207ed, 0x7ab76686, 0xb681b701, 0x9d19d066,
  833. 0x81956e08, 0x2ca17f37, 0x65d1d24e, 0x0cff7cb8},
  834. {0xf9cd6e9e, 0x4821363b, 0xb0bc2b8c, 0xa380ecbb,
  835. 0x7b04aea0, 0x396f0948, 0x93619efe, 0x42aa1fd4}}},
  836. {{{0x805b8aa4, 0x23ab6f9a, 0x937ea209, 0x9dba1ab2,
  837. 0x426d02b7, 0x36782ff4, 0xe371d373, 0x66873347},
  838. {0x51d27dea, 0xd40cd434, 0xd5627a4d, 0xbcc747de,
  839. 0xa54b31ec, 0x3e2c2fa4, 0x4f07b689, 0xb33b79bc}},
  840. {{0xfeea300c, 0x26ab30d9, 0x92c098e9, 0x192c191b,
  841. 0xeefd498c, 0x3cd4e4ac, 0xe9a3f142, 0x00bdca46},
  842. {0xeb1edad0, 0xd4c2439e, 0x51025e46, 0x006cfb7c,
  843. 0x04b6efda, 0x159f7c19, 0xa1085a5e, 0x459833d5}},
  844. {{0xeb08632d, 0x3c4ecf58, 0x02624178, 0xf65dbcf5,
  845. 0xeb320af5, 0xce34c3db, 0x799ea805, 0x1f944aa2},
  846. {0x6f488ba6, 0x07f9f8dc, 0x690e6d4b, 0xa45b11be,
  847. 0x8d39f017, 0x96619fec, 0x6100af71, 0x16201c36}}}};
  848. const Fq12Elem expected = {
  849. {{{0x526a44b5, 0x9ad9e0d5, 0x7fc8d87d, 0xdac7f569, 0xb7160629, 0xc5073804,
  850. 0x217aac0c, 0x71b7efa7},
  851. {0xd0accd40, 0x66aed48f, 0x3e8cb003, 0x54d56ad9, 0x5f6d6996, 0x0be42117,
  852. 0xa36948ed, 0xbb155b11}},
  853. {{0x806eec23, 0xf4e66785, 0xaffdc175, 0xa19e8e95, 0xa11edc9d, 0xfad5f701,
  854. 0x4bf831bc, 0xe743b59e},
  855. {0xfc57a415, 0xb843987c, 0x3aabe4e3, 0xb23ed43d, 0xc418a1cd, 0xc46cc003,
  856. 0xb646c6b0, 0x32af93c9}},
  857. {{0x20c76439, 0xc9915b9f, 0x34fae4ad, 0x952c702a, 0xf2edbbd9, 0x06aa03db,
  858. 0x10219f83, 0x905d0b4c},
  859. {0xab64286e, 0xb368606d, 0xa469d731, 0xbc1f7604, 0xeae89f06, 0xd6d6b335,
  860. 0x68da2258, 0x4ab0021e}}},
  861. {{{0xa69a08d7, 0xbac72f6e, 0xaf9c76c7, 0x67d54f71, 0x41aea080, 0x36129b92,
  862. 0xd25549e1, 0xa261f5ef},
  863. {0xd663885e, 0xd0de96b5, 0x6631c5ab, 0x1826eea2, 0xab116580, 0xc41e9bd7,
  864. 0x935a4539, 0x1283ccf4}},
  865. {{0xc279b3a5, 0x750dcbe7, 0x8f96e4ba, 0xd3321942, 0xf837f073, 0x11ed32b8,
  866. 0x26691990, 0x06c077da},
  867. {0x4d690c41, 0x47d447a7, 0xb0ecd6ca, 0xbab6e94b, 0xb1984cb4, 0xb104eb7f,
  868. 0xd0b8e924, 0xe8c70bef}},
  869. {{0x1c750b7c, 0x9923d34c, 0xc88a0dda, 0x2e14c6ca, 0x6748bad3, 0x50d05e2b,
  870. 0x14f32504, 0x2dc7a9d3},
  871. {0xa1c4328d, 0x9e8f16d8, 0xd31d739a, 0x0c9da028, 0x613f8c91, 0x75fbf7f3,
  872. 0x78575301, 0x496c9a7b}}}};
  873. Fq12Elem res;
  874. Fq12SqCyc(&res, &a);
  875. EXPECT_EQ(expected, res);
  876. }
  877. ////////////////////////////////////////////////////////////////////////
  878. // Fq12MulSpecial
  879. TEST(TinyFq12Test, Fq12MulSpecialWorks) {
  880. const Fq12Elem left = {{{{0xbee28a1d, 0x57d6402c, 0x61cd0458, 0x194e2452,
  881. 0x1c223de9, 0x6546ced9, 0xdcd0878f, 0xc55048e3},
  882. {0x6a8d5fe2, 0xfcf17083, 0xb608693b, 0x981bd9fe,
  883. 0x54a9e8fa, 0x0e8250f4, 0x93430f47, 0xf862d9af}},
  884. {{0x57975e42, 0xf57416a0, 0x08a35031, 0x9d28f11c,
  885. 0xa9467df1, 0x58159cfa, 0x48cb43f1, 0x7f6f1e63},
  886. {0xb6199d76, 0xf0ee74eb, 0xc2413051, 0x5ee7af00,
  887. 0xed646e81, 0xa34adbc8, 0xb30cb947, 0xc256758a}},
  888. {{0xd2100f2c, 0x34bef28c, 0xe6ffd998, 0x3f8de361,
  889. 0x711229db, 0x143ccdbf, 0x4fad6107, 0x35365f92},
  890. {0xea2fbf36, 0x14a160b2, 0x5051bd0f, 0x6f056434,
  891. 0x2d53ef9f, 0x00d84656, 0xc8535c97, 0x23aaa4e4}}},
  892. {{{0xfa291b36, 0xdff94440, 0xc016a92d, 0xe44a0e69,
  893. 0xdb2d97f6, 0xb1747475, 0x1cbc7fc4, 0x0e94ef53},
  894. {0x0ea6037c, 0x9a639210, 0xd84404c5, 0x4b8c16ef,
  895. 0xfc9e6161, 0x3914ae4c, 0xd1b76423, 0x63ef638b}},
  896. {{0xfbe030a1, 0x2a114147, 0x6639fbac, 0x0349a4a5,
  897. 0x5c7d47de, 0x63888f75, 0x7224cc85, 0x4c1bfeb3},
  898. {0xb214f453, 0x403afc2f, 0xa61d5e45, 0x4392c48a,
  899. 0xc4f5aec3, 0xce77b85a, 0xc8d59c7e, 0xd0060196}},
  900. {{0x00000000, 0x00000000, 0x00000000, 0x00000000,
  901. 0x00000000, 0x00000000, 0x00000000, 0x00000000},
  902. {0x00000000, 0x00000000, 0x00000000, 0x00000000,
  903. 0x00000000, 0x00000000, 0x00000000, 0x00000000}}}};
  904. const Fq12Elem right = {{{{0xd878f624, 0xb6e07457, 0x64c79fdf, 0x0b8cebe9,
  905. 0x97be762b, 0xbc4aea64, 0xf72d75cc, 0xdc8ed85d},
  906. {0x65847e3a, 0x2a2ff0f3, 0x87af7204, 0xfb4cba91,
  907. 0x0df3d736, 0x77e1a4e0, 0x138efcca, 0xc427f6ab}},
  908. {{0x00000000, 0x00000000, 0x00000000, 0x00000000,
  909. 0x00000000, 0x00000000, 0x00000000, 0x00000000},
  910. {0x00000000, 0x00000000, 0x00000000, 0x00000000,
  911. 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
  912. {{0x00000000, 0x00000000, 0x00000000, 0x00000000,
  913. 0x00000000, 0x00000000, 0x00000000, 0x00000000},
  914. {0x00000000, 0x00000000, 0x00000000, 0x00000000,
  915. 0x00000000, 0x00000000, 0x00000000, 0x00000000}}},
  916. {{{0x163784b5, 0x2a7d4fd5, 0x1f5a1a18, 0xe89cba68,
  917. 0xc233b435, 0xa20456c0, 0x6397ae08, 0x7b76d157},
  918. {0xb68f8337, 0x079302c1, 0x99e4326a, 0xc14686de,
  919. 0x866e7108, 0x685e797e, 0x3a4b03e5, 0x9aab4042}},
  920. {{0x2cd4fe4d, 0xb4660e9a, 0xf99f415d, 0x627f9703,
  921. 0x902301e4, 0xcf3c4224, 0xaca9779d, 0x917a2609},
  922. {0x9da1e8ac, 0xadb15382, 0x6d31577a, 0xcfd95901,
  923. 0xf4fdf69b, 0x8ebf8ef3, 0xc15f4a65, 0x0d6458ec}},
  924. {{0x00000000, 0x00000000, 0x00000000, 0x00000000,
  925. 0x00000000, 0x00000000, 0x00000000, 0x00000000},
  926. {0x00000000, 0x00000000, 0x00000000, 0x00000000,
  927. 0x00000000, 0x00000000, 0x00000000, 0x00000000}}}};
  928. const Fq12Elem expected = {
  929. {{{0x9f8d4cd8, 0x00fcb121, 0xb1383622, 0xff83d7d7, 0xa4b229fb, 0xcece9321,
  930. 0x81ef1f73, 0x05137d4e},
  931. {0x9f6177a7, 0x050a266e, 0x73bb8d3b, 0xc99e1d33, 0x678d1f52, 0xc63568f1,
  932. 0x1920273f, 0x11a25307}},
  933. {{0xcf70c64d, 0x99892381, 0xf6f6a6de, 0xfec24fa5, 0x8d18873e, 0x4f621aad,
  934. 0x7d3599d0, 0x128407fe},
  935. {0x33e6c086, 0xa85bf06c, 0x2edfd568, 0xc2426dbe, 0xdbbd397c, 0x2b6e80b2,
  936. 0x63dd5f45, 0x98bc904e}},
  937. {{0xb56c9e77, 0x84063128, 0x830da180, 0xa3d9be01, 0x7ec1cfe7, 0x817c7cc1,
  938. 0x409da3aa, 0xb05dcc43},
  939. {0x356380bf, 0x72eb335a, 0xb6f2b26c, 0x080613dc, 0x67720d78, 0x488a988f,
  940. 0xee0e1bff, 0x0758479e}}},
  941. {{{0xa640a57d, 0xc171805c, 0xd1c81064, 0xef2644a8, 0xe28b6e89, 0xd031ff2f,
  942. 0xf734a21b, 0x0d8e465e},
  943. {0x609de07b, 0x1d248226, 0x19fed7c8, 0x2b378e3d, 0xd55d1461, 0x719d0037,
  944. 0x6fe515b8, 0x34f03c08}},
  945. {{0xdcdcb9d0, 0x814badfe, 0x01405a2a, 0x2e1a5295, 0x3d08cb46, 0xd0dc0d2b,
  946. 0x4ca64738, 0x2b2e5180},
  947. {0x503385b0, 0x030d5f71, 0xd24ad48c, 0x4f246e0b, 0x9e904a36, 0x302748d6,
  948. 0x1c034d23, 0xf6aa74f6}},
  949. {{0x05fc0305, 0xfb7ba8fd, 0x4a8425a1, 0xd69ff60a, 0x356d1941, 0x4559a790,
  950. 0xcf1088e9, 0x63784e99},
  951. {0xa8a6d207, 0x6e6ed383, 0xf8a9804e, 0x0be13d11, 0xcef9010b, 0x90c8c91a,
  952. 0x0b1302ef, 0xe2ce5b67}}}};
  953. Fq12Elem res;
  954. Fq12MulSpecial(&res, &left, &right);
  955. EXPECT_EQ(expected, res);
  956. }
  957. ////////////////////////////////////////////////////////////////////////
  958. // Fq12Cp
  959. TEST(TinyFq12Test, Fq12CpWorks) {
  960. Fq12Elem a = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c, 0xafa65357,
  961. 0x4780716c, 0xffd94b0f, 0x5e643124},
  962. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0, 0x34dd5651,
  963. 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  964. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889, 0x5d391be8,
  965. 0x88aa7982, 0xafae53e0, 0xecd73957},
  966. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7, 0x5000252c,
  967. 0x1837550e, 0x1f45a674, 0x93d557cd}},
  968. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7, 0x6e58060a,
  969. 0x38ee9923, 0xa18c3407, 0x582edecf},
  970. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60, 0x26ec9f79,
  971. 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  972. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603, 0x62a80f0a,
  973. 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  974. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd, 0x6e80b955,
  975. 0x2f93adc4, 0x92734322, 0x3d539b24}},
  976. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399, 0xa8cc1ef5,
  977. 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  978. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612, 0xabb68325,
  979. 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  980. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48, 0x8626fe26,
  981. 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  982. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e, 0xb6db8586,
  983. 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  984. Fq12Elem result = {0};
  985. Fq12Cp(&result, &a);
  986. EXPECT_EQ(a, result);
  987. }
  988. ////////////////////////////////////////////////////////////////////////
  989. // Fq12Clear
  990. TEST(TinyFq12Test, Fq12ClearWorks) {
  991. Fq12Elem zero = {0};
  992. Fq12Elem a = {{{{0x22cfd6a2, 0x23e82f1e, 0xd50e1450, 0xe853e88c, 0xafa65357,
  993. 0x4780716c, 0xffd94b0f, 0x5e643124},
  994. {0x4d23497f, 0x189daf4d, 0x0ac5c478, 0x3583e2b0, 0x34dd5651,
  995. 0x1bb8f3e0, 0x1e1f4181, 0x8aa45bf5}},
  996. {{0xaf9cf50f, 0xdfb22086, 0x170f8bcb, 0x75bbd889, 0x5d391be8,
  997. 0x88aa7982, 0xafae53e0, 0xecd73957},
  998. {0x2e2e734a, 0xf6e7e2b7, 0x90b6df9f, 0x2eef83b7, 0x5000252c,
  999. 0x1837550e, 0x1f45a674, 0x93d557cd}},
  1000. {{0xcb5e99ef, 0x42374c61, 0x323344a2, 0x6aa052c7, 0x6e58060a,
  1001. 0x38ee9923, 0xa18c3407, 0x582edecf},
  1002. {0x873d4160, 0xb0e68183, 0x6cade2bc, 0x77ba8f60, 0x26ec9f79,
  1003. 0xc8b2c612, 0x79e80d5f, 0x180fdb61}}},
  1004. {{{0x51a7809d, 0xf8eca154, 0x3c6e23f3, 0xad809603, 0x62a80f0a,
  1005. 0x41a7438e, 0x633b97dc, 0x2bff7dc0},
  1006. {0xb097729b, 0xe9ec6749, 0x125f70be, 0xa9a546bd, 0x6e80b955,
  1007. 0x2f93adc4, 0x92734322, 0x3d539b24}},
  1008. {{0xd1719fbe, 0x651cbd10, 0x8a4524f4, 0x25a76399, 0xa8cc1ef5,
  1009. 0x09d65b42, 0xdfb7b8ab, 0x58e4393c},
  1010. {0x93e7c6a6, 0x553e24e7, 0x3dcd9201, 0xd6894612, 0xabb68325,
  1011. 0xf1039ad5, 0xbdef6e94, 0xe3b7cc9e}},
  1012. {{0xb28f5a78, 0x890b3670, 0x23c0c6e0, 0xeb127c48, 0x8626fe26,
  1013. 0x48fe77de, 0xbc8309f8, 0x67a2fd2b},
  1014. {0xf5175d3c, 0x27c16a53, 0x93a131c4, 0x10d8cb8e, 0xb6db8586,
  1015. 0x153b2bba, 0xc4d17107, 0xbe451bde}}}};
  1016. Fq12Clear(&a);
  1017. EXPECT_EQ(zero, a);
  1018. }
  1019. } // namespace