• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stddef.h>
6 #include <stdint.h>
7 #include <stdio.h>
8 #include <string.h>
9 
10 #include "crypto/p224.h"
11 
12 #include "base/macros.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 
15 namespace crypto {
16 
17 using p224::Point;
18 
19 // kBasePointExternal is the P224 base point in external representation.
20 static const uint8_t kBasePointExternal[56] = {
21     0xb7, 0x0e, 0x0c, 0xbd, 0x6b, 0xb4, 0xbf, 0x7f, 0x32, 0x13, 0x90, 0xb9,
22     0x4a, 0x03, 0xc1, 0xd3, 0x56, 0xc2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xd6,
23     0x11, 0x5c, 0x1d, 0x21, 0xbd, 0x37, 0x63, 0x88, 0xb5, 0xf7, 0x23, 0xfb,
24     0x4c, 0x22, 0xdf, 0xe6, 0xcd, 0x43, 0x75, 0xa0, 0x5a, 0x07, 0x47, 0x64,
25     0x44, 0xd5, 0x81, 0x99, 0x85, 0x00, 0x7e, 0x34,
26 };
27 
28 // TestVector represents a test of scalar multiplication of the base point.
29 // |scalar| is a big-endian scalar and |affine| is the external representation
30 // of g*scalar.
31 struct TestVector {
32   uint8_t scalar[28];
33   uint8_t affine[28 * 2];
34 };
35 
36 static const int kNumNISTTestVectors = 52;
37 
38 // kNISTTestVectors are the NIST test vectors for P224.
39 static const TestVector kNISTTestVectors[kNumNISTTestVectors] = {
40   {
41     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44      0x00, 0x00, 0x00, 0x01},
45     {0xb7, 0x0e, 0x0c, 0xbd, 0x6b, 0xb4, 0xbf, 0x7f,
46      0x32, 0x13, 0x90, 0xb9, 0x4a, 0x03, 0xc1, 0xd3,
47      0x56, 0xc2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xd6,
48      0x11, 0x5c, 0x1d, 0x21, 0xbd, 0x37, 0x63, 0x88,
49      0xb5, 0xf7, 0x23, 0xfb, 0x4c, 0x22, 0xdf, 0xe6,
50      0xcd, 0x43, 0x75, 0xa0, 0x5a, 0x07, 0x47, 0x64,
51      0x44, 0xd5, 0x81, 0x99, 0x85, 0x00, 0x7e, 0x34
52     },
53   },
54   {
55     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58      0x00, 0x00, 0x00, 0x02, },
59 
60     {0x70, 0x6a, 0x46, 0xdc, 0x76, 0xdc, 0xb7, 0x67,
61      0x98, 0xe6, 0x0e, 0x6d, 0x89, 0x47, 0x47, 0x88,
62      0xd1, 0x6d, 0xc1, 0x80, 0x32, 0xd2, 0x68, 0xfd,
63      0x1a, 0x70, 0x4f, 0xa6, 0x1c, 0x2b, 0x76, 0xa7,
64      0xbc, 0x25, 0xe7, 0x70, 0x2a, 0x70, 0x4f, 0xa9,
65      0x86, 0x89, 0x28, 0x49, 0xfc, 0xa6, 0x29, 0x48,
66      0x7a, 0xcf, 0x37, 0x09, 0xd2, 0xe4, 0xe8, 0xbb,
67     },
68   },
69   {
70     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73      0x00, 0x00, 0x00, 0x03, },
74     {0xdf, 0x1b, 0x1d, 0x66, 0xa5, 0x51, 0xd0, 0xd3,
75      0x1e, 0xff, 0x82, 0x25, 0x58, 0xb9, 0xd2, 0xcc,
76      0x75, 0xc2, 0x18, 0x02, 0x79, 0xfe, 0x0d, 0x08,
77      0xfd, 0x89, 0x6d, 0x04, 0xa3, 0xf7, 0xf0, 0x3c,
78      0xad, 0xd0, 0xbe, 0x44, 0x4c, 0x0a, 0xa5, 0x68,
79      0x30, 0x13, 0x0d, 0xdf, 0x77, 0xd3, 0x17, 0x34,
80      0x4e, 0x1a, 0xf3, 0x59, 0x19, 0x81, 0xa9, 0x25,
81     },
82   },
83   {
84     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87      0x00, 0x00, 0x00, 0x04, },
88     {0xae, 0x99, 0xfe, 0xeb, 0xb5, 0xd2, 0x69, 0x45,
89      0xb5, 0x48, 0x92, 0x09, 0x2a, 0x8a, 0xee, 0x02,
90      0x91, 0x29, 0x30, 0xfa, 0x41, 0xcd, 0x11, 0x4e,
91      0x40, 0x44, 0x73, 0x01, 0x04, 0x82, 0x58, 0x0a,
92      0x0e, 0xc5, 0xbc, 0x47, 0xe8, 0x8b, 0xc8, 0xc3,
93      0x78, 0x63, 0x2c, 0xd1, 0x96, 0xcb, 0x3f, 0xa0,
94      0x58, 0xa7, 0x11, 0x4e, 0xb0, 0x30, 0x54, 0xc9,
95     },
96   },
97   {
98     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
100      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
101      0x00, 0x00, 0x00, 0x05, },
102     {0x31, 0xc4, 0x9a, 0xe7, 0x5b, 0xce, 0x78, 0x07,
103      0xcd, 0xff, 0x22, 0x05, 0x5d, 0x94, 0xee, 0x90,
104      0x21, 0xfe, 0xdb, 0xb5, 0xab, 0x51, 0xc5, 0x75,
105      0x26, 0xf0, 0x11, 0xaa, 0x27, 0xe8, 0xbf, 0xf1,
106      0x74, 0x56, 0x35, 0xec, 0x5b, 0xa0, 0xc9, 0xf1,
107      0xc2, 0xed, 0xe1, 0x54, 0x14, 0xc6, 0x50, 0x7d,
108      0x29, 0xff, 0xe3, 0x7e, 0x79, 0x0a, 0x07, 0x9b,
109     },
110   },
111   {
112     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
113      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115      0x00, 0x00, 0x00, 0x06, },
116     {0x1f, 0x24, 0x83, 0xf8, 0x25, 0x72, 0x25, 0x1f,
117      0xca, 0x97, 0x5f, 0xea, 0x40, 0xdb, 0x82, 0x1d,
118      0xf8, 0xad, 0x82, 0xa3, 0xc0, 0x02, 0xee, 0x6c,
119      0x57, 0x11, 0x24, 0x08, 0x89, 0xfa, 0xf0, 0xcc,
120      0xb7, 0x50, 0xd9, 0x9b, 0x55, 0x3c, 0x57, 0x4f,
121      0xad, 0x7e, 0xcf, 0xb0, 0x43, 0x85, 0x86, 0xeb,
122      0x39, 0x52, 0xaf, 0x5b, 0x4b, 0x15, 0x3c, 0x7e,
123     },
124   },
125   {
126     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129      0x00, 0x00, 0x00, 0x07, },
130     {0xdb, 0x2f, 0x6b, 0xe6, 0x30, 0xe2, 0x46, 0xa5,
131      0xcf, 0x7d, 0x99, 0xb8, 0x51, 0x94, 0xb1, 0x23,
132      0xd4, 0x87, 0xe2, 0xd4, 0x66, 0xb9, 0x4b, 0x24,
133      0xa0, 0x3c, 0x3e, 0x28, 0x0f, 0x3a, 0x30, 0x08,
134      0x54, 0x97, 0xf2, 0xf6, 0x11, 0xee, 0x25, 0x17,
135      0xb1, 0x63, 0xef, 0x8c, 0x53, 0xb7, 0x15, 0xd1,
136      0x8b, 0xb4, 0xe4, 0x80, 0x8d, 0x02, 0xb9, 0x63,
137     },
138   },
139   {
140     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143      0x00, 0x00, 0x00, 0x08, },
144     {0x85, 0x8e, 0x6f, 0x9c, 0xc6, 0xc1, 0x2c, 0x31,
145      0xf5, 0xdf, 0x12, 0x4a, 0xa7, 0x77, 0x67, 0xb0,
146      0x5c, 0x8b, 0xc0, 0x21, 0xbd, 0x68, 0x3d, 0x2b,
147      0x55, 0x57, 0x15, 0x50, 0x04, 0x6d, 0xcd, 0x3e,
148      0xa5, 0xc4, 0x38, 0x98, 0xc5, 0xc5, 0xfc, 0x4f,
149      0xda, 0xc7, 0xdb, 0x39, 0xc2, 0xf0, 0x2e, 0xbe,
150      0xe4, 0xe3, 0x54, 0x1d, 0x1e, 0x78, 0x04, 0x7a,
151     },
152   },
153   {
154     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
155      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157      0x00, 0x00, 0x00, 0x09, },
158     {0x2f, 0xdc, 0xcc, 0xfe, 0xe7, 0x20, 0xa7, 0x7e,
159      0xf6, 0xcb, 0x3b, 0xfb, 0xb4, 0x47, 0xf9, 0x38,
160      0x31, 0x17, 0xe3, 0xda, 0xa4, 0xa0, 0x7e, 0x36,
161      0xed, 0x15, 0xf7, 0x8d, 0x37, 0x17, 0x32, 0xe4,
162      0xf4, 0x1b, 0xf4, 0xf7, 0x88, 0x30, 0x35, 0xe6,
163      0xa7, 0x9f, 0xce, 0xdc, 0x0e, 0x19, 0x6e, 0xb0,
164      0x7b, 0x48, 0x17, 0x16, 0x97, 0x51, 0x74, 0x63,
165     },
166   },
167   {
168     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171      0x00, 0x00, 0x00, 0x0a, },
172     {0xae, 0xa9, 0xe1, 0x7a, 0x30, 0x65, 0x17, 0xeb,
173      0x89, 0x15, 0x2a, 0xa7, 0x09, 0x6d, 0x2c, 0x38,
174      0x1e, 0xc8, 0x13, 0xc5, 0x1a, 0xa8, 0x80, 0xe7,
175      0xbe, 0xe2, 0xc0, 0xfd, 0x39, 0xbb, 0x30, 0xea,
176      0xb3, 0x37, 0xe0, 0xa5, 0x21, 0xb6, 0xcb, 0xa1,
177      0xab, 0xe4, 0xb2, 0xb3, 0xa3, 0xe5, 0x24, 0xc1,
178      0x4a, 0x3f, 0xe3, 0xeb, 0x11, 0x6b, 0x65, 0x5f,
179     },
180   },
181   {
182     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
183      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185      0x00, 0x00, 0x00, 0x0b, },
186     {0xef, 0x53, 0xb6, 0x29, 0x4a, 0xca, 0x43, 0x1f,
187      0x0f, 0x3c, 0x22, 0xdc, 0x82, 0xeb, 0x90, 0x50,
188      0x32, 0x4f, 0x1d, 0x88, 0xd3, 0x77, 0xe7, 0x16,
189      0x44, 0x8e, 0x50, 0x7c, 0x20, 0xb5, 0x10, 0x00,
190      0x40, 0x92, 0xe9, 0x66, 0x36, 0xcf, 0xb7, 0xe3,
191      0x2e, 0xfd, 0xed, 0x82, 0x65, 0xc2, 0x66, 0xdf,
192      0xb7, 0x54, 0xfa, 0x6d, 0x64, 0x91, 0xa6, 0xda,
193     },
194   },
195   {
196     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
197      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
198      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
199      0x00, 0x00, 0x00, 0x0c, },
200     {0x6e, 0x31, 0xee, 0x1d, 0xc1, 0x37, 0xf8, 0x1b,
201      0x05, 0x67, 0x52, 0xe4, 0xde, 0xab, 0x14, 0x43,
202      0xa4, 0x81, 0x03, 0x3e, 0x9b, 0x4c, 0x93, 0xa3,
203      0x04, 0x4f, 0x4f, 0x7a, 0x20, 0x7d, 0xdd, 0xf0,
204      0x38, 0x5b, 0xfd, 0xea, 0xb6, 0xe9, 0xac, 0xda,
205      0x8d, 0xa0, 0x6b, 0x3b, 0xbe, 0xf2, 0x24, 0xa9,
206      0x3a, 0xb1, 0xe9, 0xe0, 0x36, 0x10, 0x9d, 0x13,
207     },
208   },
209   {
210     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213      0x00, 0x00, 0x00, 0x0d, },
214     {0x34, 0xe8, 0xe1, 0x7a, 0x43, 0x0e, 0x43, 0x28,
215      0x97, 0x93, 0xc3, 0x83, 0xfa, 0xc9, 0x77, 0x42,
216      0x47, 0xb4, 0x0e, 0x9e, 0xbd, 0x33, 0x66, 0x98,
217      0x1f, 0xcf, 0xae, 0xca, 0x25, 0x28, 0x19, 0xf7,
218      0x1c, 0x7f, 0xb7, 0xfb, 0xcb, 0x15, 0x9b, 0xe3,
219      0x37, 0xd3, 0x7d, 0x33, 0x36, 0xd7, 0xfe, 0xb9,
220      0x63, 0x72, 0x4f, 0xdf, 0xb0, 0xec, 0xb7, 0x67,
221     },
222   },
223   {
224     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227      0x00, 0x00, 0x00, 0x0e, },
228     {0xa5, 0x36, 0x40, 0xc8, 0x3d, 0xc2, 0x08, 0x60,
229      0x3d, 0xed, 0x83, 0xe4, 0xec, 0xf7, 0x58, 0xf2,
230      0x4c, 0x35, 0x7d, 0x7c, 0xf4, 0x80, 0x88, 0xb2,
231      0xce, 0x01, 0xe9, 0xfa, 0xd5, 0x81, 0x4c, 0xd7,
232      0x24, 0x19, 0x9c, 0x4a, 0x5b, 0x97, 0x4a, 0x43,
233      0x68, 0x5f, 0xbf, 0x5b, 0x8b, 0xac, 0x69, 0x45,
234      0x9c, 0x94, 0x69, 0xbc, 0x8f, 0x23, 0xcc, 0xaf,
235     },
236   },
237   {
238     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
239      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
240      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
241      0x00, 0x00, 0x00, 0x0f, },
242     {0xba, 0xa4, 0xd8, 0x63, 0x55, 0x11, 0xa7, 0xd2,
243      0x88, 0xae, 0xbe, 0xed, 0xd1, 0x2c, 0xe5, 0x29,
244      0xff, 0x10, 0x2c, 0x91, 0xf9, 0x7f, 0x86, 0x7e,
245      0x21, 0x91, 0x6b, 0xf9, 0x97, 0x9a, 0x5f, 0x47,
246      0x59, 0xf8, 0x0f, 0x4f, 0xb4, 0xec, 0x2e, 0x34,
247      0xf5, 0x56, 0x6d, 0x59, 0x56, 0x80, 0xa1, 0x17,
248      0x35, 0xe7, 0xb6, 0x10, 0x46, 0x12, 0x79, 0x89,
249     },
250   },
251   {
252     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
253      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
254      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255      0x00, 0x00, 0x00, 0x10, },
256     {0x0b, 0x6e, 0xc4, 0xfe, 0x17, 0x77, 0x38, 0x24,
257      0x04, 0xef, 0x67, 0x99, 0x97, 0xba, 0x8d, 0x1c,
258      0xc5, 0xcd, 0x8e, 0x85, 0x34, 0x92, 0x59, 0xf5,
259      0x90, 0xc4, 0xc6, 0x6d, 0x33, 0x99, 0xd4, 0x64,
260      0x34, 0x59, 0x06, 0xb1, 0x1b, 0x00, 0xe3, 0x63,
261      0xef, 0x42, 0x92, 0x21, 0xf2, 0xec, 0x72, 0x0d,
262      0x2f, 0x66, 0x5d, 0x7d, 0xea, 0xd5, 0xb4, 0x82,
263     },
264   },
265   {
266     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269      0x00, 0x00, 0x00, 0x11, },
270     {0xb8, 0x35, 0x7c, 0x3a, 0x6c, 0xee, 0xf2, 0x88,
271      0x31, 0x0e, 0x17, 0xb8, 0xbf, 0xef, 0xf9, 0x20,
272      0x08, 0x46, 0xca, 0x8c, 0x19, 0x42, 0x49, 0x7c,
273      0x48, 0x44, 0x03, 0xbc, 0xff, 0x14, 0x9e, 0xfa,
274      0x66, 0x06, 0xa6, 0xbd, 0x20, 0xef, 0x7d, 0x1b,
275      0x06, 0xbd, 0x92, 0xf6, 0x90, 0x46, 0x39, 0xdc,
276      0xe5, 0x17, 0x4d, 0xb6, 0xcc, 0x55, 0x4a, 0x26,
277     },
278   },
279   {
280     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
281      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283      0x00, 0x00, 0x00, 0x12, },
284     {0xc9, 0xff, 0x61, 0xb0, 0x40, 0x87, 0x4c, 0x05,
285      0x68, 0x47, 0x92, 0x16, 0x82, 0x4a, 0x15, 0xea,
286      0xb1, 0xa8, 0x38, 0xa7, 0x97, 0xd1, 0x89, 0x74,
287      0x62, 0x26, 0xe4, 0xcc, 0xea, 0x98, 0xd6, 0x0e,
288      0x5f, 0xfc, 0x9b, 0x8f, 0xcf, 0x99, 0x9f, 0xab,
289      0x1d, 0xf7, 0xe7, 0xef, 0x70, 0x84, 0xf2, 0x0d,
290      0xdb, 0x61, 0xbb, 0x04, 0x5a, 0x6c, 0xe0, 0x02,
291     },
292   },
293   {
294     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
295      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
296      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
297      0x00, 0x00, 0x00, 0x13, },
298     {0xa1, 0xe8, 0x1c, 0x04, 0xf3, 0x0c, 0xe2, 0x01,
299      0xc7, 0xc9, 0xac, 0xe7, 0x85, 0xed, 0x44, 0xcc,
300      0x33, 0xb4, 0x55, 0xa0, 0x22, 0xf2, 0xac, 0xdb,
301      0xc6, 0xca, 0xe8, 0x3c, 0xdc, 0xf1, 0xf6, 0xc3,
302      0xdb, 0x09, 0xc7, 0x0a, 0xcc, 0x25, 0x39, 0x1d,
303      0x49, 0x2f, 0xe2, 0x5b, 0x4a, 0x18, 0x0b, 0xab,
304      0xd6, 0xce, 0xa3, 0x56, 0xc0, 0x47, 0x19, 0xcd,
305     },
306   },
307   {
308     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
309      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
310      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311      0x00, 0x00, 0x00, 0x14, },
312     {0xfc, 0xc7, 0xf2, 0xb4, 0x5d, 0xf1, 0xcd, 0x5a,
313      0x3c, 0x0c, 0x07, 0x31, 0xca, 0x47, 0xa8, 0xaf,
314      0x75, 0xcf, 0xb0, 0x34, 0x7e, 0x83, 0x54, 0xee,
315      0xfe, 0x78, 0x24, 0x55, 0x0d, 0x5d, 0x71, 0x10,
316      0x27, 0x4c, 0xba, 0x7c, 0xde, 0xe9, 0x0e, 0x1a,
317      0x8b, 0x0d, 0x39, 0x4c, 0x37, 0x6a, 0x55, 0x73,
318      0xdb, 0x6b, 0xe0, 0xbf, 0x27, 0x47, 0xf5, 0x30,
319     },
320   },
321   {
322     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324      0x00, 0x00, 0x00, 0x00, 0x01, 0x8e, 0xbb, 0xb9,
325      0x5e, 0xed, 0x0e, 0x13, },
326     {0x61, 0xf0, 0x77, 0xc6, 0xf6, 0x2e, 0xd8, 0x02,
327      0xda, 0xd7, 0xc2, 0xf3, 0x8f, 0x5c, 0x67, 0xf2,
328      0xcc, 0x45, 0x36, 0x01, 0xe6, 0x1b, 0xd0, 0x76,
329      0xbb, 0x46, 0x17, 0x9e, 0x22, 0x72, 0xf9, 0xe9,
330      0xf5, 0x93, 0x3e, 0x70, 0x38, 0x8e, 0xe6, 0x52,
331      0x51, 0x34, 0x43, 0xb5, 0xe2, 0x89, 0xdd, 0x13,
332      0x5d, 0xcc, 0x0d, 0x02, 0x99, 0xb2, 0x25, 0xe4,
333     },
334   },
335   {
336     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337      0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x9d, 0x89,
338      0x3d, 0x4c, 0xdd, 0x74, 0x72, 0x46, 0xcd, 0xca,
339      0x43, 0x59, 0x0e, 0x13, },
340     {0x02, 0x98, 0x95, 0xf0, 0xaf, 0x49, 0x6b, 0xfc,
341      0x62, 0xb6, 0xef, 0x8d, 0x8a, 0x65, 0xc8, 0x8c,
342      0x61, 0x39, 0x49, 0xb0, 0x36, 0x68, 0xaa, 0xb4,
343      0xf0, 0x42, 0x9e, 0x35, 0x3e, 0xa6, 0xe5, 0x3f,
344      0x9a, 0x84, 0x1f, 0x20, 0x19, 0xec, 0x24, 0xbd,
345      0xe1, 0xa7, 0x56, 0x77, 0xaa, 0x9b, 0x59, 0x02,
346      0xe6, 0x10, 0x81, 0xc0, 0x10, 0x64, 0xde, 0x93,
347     },
348   },
349   {
350     {0x41, 0xff, 0xc1, 0xff, 0xff, 0xfe, 0x01, 0xff,
351      0xfc, 0x00, 0x03, 0xff, 0xfe, 0x00, 0x07, 0xc0,
352      0x01, 0xff, 0xf0, 0x00, 0x03, 0xff, 0xf0, 0x7f,
353      0xfe, 0x00, 0x07, 0xc0, },
354     {0xab, 0x68, 0x99, 0x30, 0xbc, 0xae, 0x4a, 0x4a,
355      0xa5, 0xf5, 0xcb, 0x08, 0x5e, 0x82, 0x3e, 0x8a,
356      0xe3, 0x0f, 0xd3, 0x65, 0xeb, 0x1d, 0xa4, 0xab,
357      0xa9, 0xcf, 0x03, 0x79, 0x33, 0x45, 0xa1, 0x21,
358      0xbb, 0xd2, 0x33, 0x54, 0x8a, 0xf0, 0xd2, 0x10,
359      0x65, 0x4e, 0xb4, 0x0b, 0xab, 0x78, 0x8a, 0x03,
360      0x66, 0x64, 0x19, 0xbe, 0x6f, 0xbd, 0x34, 0xe7,
361     },
362   },
363   {
364     {0x7f, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xc0, 0x03,
365      0xff, 0xff, 0xfc, 0x00, 0x7f, 0xff, 0x00, 0x00,
366      0x00, 0x00, 0x07, 0x00, 0x00, 0x10, 0x00, 0x00,
367      0x00, 0x0e, 0x00, 0xff, },
368     {0xbd, 0xb6, 0xa8, 0x81, 0x7c, 0x1f, 0x89, 0xda,
369      0x1c, 0x2f, 0x3d, 0xd8, 0xe9, 0x7f, 0xeb, 0x44,
370      0x94, 0xf2, 0xed, 0x30, 0x2a, 0x4c, 0xe2, 0xbc,
371      0x7f, 0x5f, 0x40, 0x25, 0x4c, 0x70, 0x20, 0xd5,
372      0x7c, 0x00, 0x41, 0x18, 0x89, 0x46, 0x2d, 0x77,
373      0xa5, 0x43, 0x8b, 0xb4, 0xe9, 0x7d, 0x17, 0x77,
374      0x00, 0xbf, 0x72, 0x43, 0xa0, 0x7f, 0x16, 0x80,
375     },
376   },
377   {
378     {0x7f, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x00,
379      0xff, 0xff, 0xf0, 0x1f, 0xff, 0xf8, 0xff, 0xff,
380      0xc0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00,
381      0x00, 0x0f, 0xff, 0xff, },
382     {0xd5, 0x8b, 0x61, 0xaa, 0x41, 0xc3, 0x2d, 0xd5,
383      0xeb, 0xa4, 0x62, 0x64, 0x7d, 0xba, 0x75, 0xc5,
384      0xd6, 0x7c, 0x83, 0x60, 0x6c, 0x0a, 0xf2, 0xbd,
385      0x92, 0x84, 0x46, 0xa9, 0xd2, 0x4b, 0xa6, 0xa8,
386      0x37, 0xbe, 0x04, 0x60, 0xdd, 0x10, 0x7a, 0xe7,
387      0x77, 0x25, 0x69, 0x6d, 0x21, 0x14, 0x46, 0xc5,
388      0x60, 0x9b, 0x45, 0x95, 0x97, 0x6b, 0x16, 0xbd,
389     },
390   },
391   {
392     {0x7f, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xfe, 0x3f,
393      0xff, 0xfc, 0x10, 0x00, 0x00, 0x20, 0x00, 0x3f,
394      0xff, 0xff, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00,
395      0x3f, 0xff, 0xff, 0xff, },
396     {0xdc, 0x9f, 0xa7, 0x79, 0x78, 0xa0, 0x05, 0x51,
397      0x09, 0x80, 0xe9, 0x29, 0xa1, 0x48, 0x5f, 0x63,
398      0x71, 0x6d, 0xf6, 0x95, 0xd7, 0xa0, 0xc1, 0x8b,
399      0xb5, 0x18, 0xdf, 0x03, 0xed, 0xe2, 0xb0, 0x16,
400      0xf2, 0xdd, 0xff, 0xc2, 0xa8, 0xc0, 0x15, 0xb1,
401      0x34, 0x92, 0x82, 0x75, 0xce, 0x09, 0xe5, 0x66,
402      0x1b, 0x7a, 0xb1, 0x4c, 0xe0, 0xd1, 0xd4, 0x03,
403     },
404   },
405   {
406     {0x70, 0x01, 0xf0, 0x00, 0x1c, 0x00, 0x01, 0xc0,
407      0x00, 0x00, 0x1f, 0xff, 0xff, 0xfc, 0x00, 0x00,
408      0x1f, 0xff, 0xff, 0xf8, 0x00, 0x0f, 0xc0, 0x00,
409      0x00, 0x01, 0xfc, 0x00, },
410     {0x49, 0x9d, 0x8b, 0x28, 0x29, 0xcf, 0xb8, 0x79,
411      0xc9, 0x01, 0xf7, 0xd8, 0x5d, 0x35, 0x70, 0x45,
412      0xed, 0xab, 0x55, 0x02, 0x88, 0x24, 0xd0, 0xf0,
413      0x5b, 0xa2, 0x79, 0xba, 0xbf, 0x92, 0x95, 0x37,
414      0xb0, 0x6e, 0x40, 0x15, 0x91, 0x96, 0x39, 0xd9,
415      0x4f, 0x57, 0x83, 0x8f, 0xa3, 0x3f, 0xc3, 0xd9,
416      0x52, 0x59, 0x8d, 0xcd, 0xbb, 0x44, 0xd6, 0x38,
417     },
418   },
419   {
420     {0x00, 0x00, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00,
421      0x00, 0xff, 0xf0, 0x30, 0x00, 0x1f, 0x00, 0x00,
422      0xff, 0xff, 0xf0, 0x00, 0x00, 0x38, 0x00, 0x00,
423      0x00, 0x00, 0x00, 0x02, },
424     {0x82, 0x46, 0xc9, 0x99, 0x13, 0x71, 0x86, 0x63,
425      0x2c, 0x5f, 0x9e, 0xdd, 0xf3, 0xb1, 0xb0, 0xe1,
426      0x76, 0x4c, 0x5e, 0x8b, 0xd0, 0xe0, 0xd8, 0xa5,
427      0x54, 0xb9, 0xcb, 0x77, 0xe8, 0x0e, 0xd8, 0x66,
428      0x0b, 0xc1, 0xcb, 0x17, 0xac, 0x7d, 0x84, 0x5b,
429      0xe4, 0x0a, 0x7a, 0x02, 0x2d, 0x33, 0x06, 0xf1,
430      0x16, 0xae, 0x9f, 0x81, 0xfe, 0xa6, 0x59, 0x47,
431     },
432   },
433   {
434     {0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
435      0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
436      0x00, 0x00, 0xff, 0xfe, 0x08, 0x00, 0x00, 0x1f,
437      0xf0, 0x00, 0x1f, 0xff, },
438     {0x66, 0x70, 0xc2, 0x0a, 0xfc, 0xce, 0xae, 0xa6,
439      0x72, 0xc9, 0x7f, 0x75, 0xe2, 0xe9, 0xdd, 0x5c,
440      0x84, 0x60, 0xe5, 0x4b, 0xb3, 0x85, 0x38, 0xeb,
441      0xb4, 0xbd, 0x30, 0xeb, 0xf2, 0x80, 0xd8, 0x00,
442      0x8d, 0x07, 0xa4, 0xca, 0xf5, 0x42, 0x71, 0xf9,
443      0x93, 0x52, 0x7d, 0x46, 0xff, 0x3f, 0xf4, 0x6f,
444      0xd1, 0x19, 0x0a, 0x3f, 0x1f, 0xaa, 0x4f, 0x74,
445     },
446   },
447   {
448     {0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff,
449      0xff, 0xc0, 0x00, 0x07, 0xff, 0xff, 0xe0, 0xff,
450      0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0xff,
451      0xff, 0xff, 0xff, 0xff, },
452     {0x00, 0x0e, 0xca, 0x93, 0x42, 0x47, 0x42, 0x5c,
453      0xfd, 0x94, 0x9b, 0x79, 0x5c, 0xb5, 0xce, 0x1e,
454      0xff, 0x40, 0x15, 0x50, 0x38, 0x6e, 0x28, 0xd1,
455      0xa4, 0xc5, 0xa8, 0xeb, 0xd4, 0xc0, 0x10, 0x40,
456      0xdb, 0xa1, 0x96, 0x28, 0x93, 0x1b, 0xc8, 0x85,
457      0x53, 0x70, 0x31, 0x7c, 0x72, 0x2c, 0xbd, 0x9c,
458      0xa6, 0x15, 0x69, 0x85, 0xf1, 0xc2, 0xe9, 0xce,
459     },
460   },
461   {
462     {0x7f, 0xff, 0xfc, 0x03, 0xff, 0x80, 0x7f, 0xff,
463      0xe0, 0x00, 0x1f, 0xff, 0xff, 0x80, 0x0f, 0xff,
464      0x80, 0x00, 0x01, 0xff, 0xff, 0x00, 0x01, 0xff,
465      0xff, 0xfe, 0x00, 0x1f, },
466     {0xef, 0x35, 0x3b, 0xf5, 0xc7, 0x3c, 0xd5, 0x51,
467      0xb9, 0x6d, 0x59, 0x6f, 0xbc, 0x9a, 0x67, 0xf1,
468      0x6d, 0x61, 0xdd, 0x9f, 0xe5, 0x6a, 0xf1, 0x9d,
469      0xe1, 0xfb, 0xa9, 0xcd, 0x21, 0x77, 0x1b, 0x9c,
470      0xdc, 0xe3, 0xe8, 0x43, 0x0c, 0x09, 0xb3, 0x83,
471      0x8b, 0xe7, 0x0b, 0x48, 0xc2, 0x1e, 0x15, 0xbc,
472      0x09, 0xee, 0x1f, 0x2d, 0x79, 0x45, 0xb9, 0x1f,
473     },
474   },
475   {
476     {0x00, 0x00, 0x00, 0x07, 0xff, 0xc0, 0x7f, 0xff,
477      0xff, 0xff, 0x01, 0xff, 0xfe, 0x03, 0xff, 0xfe,
478      0x40, 0x00, 0x38, 0x00, 0x07, 0xe0, 0x00, 0x3f,
479      0xfe, 0x00, 0x00, 0x00, },
480     {0x40, 0x36, 0x05, 0x2a, 0x30, 0x91, 0xeb, 0x48,
481      0x10, 0x46, 0xad, 0x32, 0x89, 0xc9, 0x5d, 0x3a,
482      0xc9, 0x05, 0xca, 0x00, 0x23, 0xde, 0x2c, 0x03,
483      0xec, 0xd4, 0x51, 0xcf, 0xd7, 0x68, 0x16, 0x5a,
484      0x38, 0xa2, 0xb9, 0x6f, 0x81, 0x25, 0x86, 0xa9,
485      0xd5, 0x9d, 0x41, 0x36, 0x03, 0x5d, 0x9c, 0x85,
486      0x3a, 0x5b, 0xf2, 0xe1, 0xc8, 0x6a, 0x49, 0x93,
487     },
488   },
489   {
490     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
491      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
492      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
493      0x5c, 0x5c, 0x2a, 0x29, },
494     {0xfc, 0xc7, 0xf2, 0xb4, 0x5d, 0xf1, 0xcd, 0x5a,
495      0x3c, 0x0c, 0x07, 0x31, 0xca, 0x47, 0xa8, 0xaf,
496      0x75, 0xcf, 0xb0, 0x34, 0x7e, 0x83, 0x54, 0xee,
497      0xfe, 0x78, 0x24, 0x55, 0xf2, 0xa2, 0x8e, 0xef,
498      0xd8, 0xb3, 0x45, 0x83, 0x21, 0x16, 0xf1, 0xe5,
499      0x74, 0xf2, 0xc6, 0xb2, 0xc8, 0x95, 0xaa, 0x8c,
500      0x24, 0x94, 0x1f, 0x40, 0xd8, 0xb8, 0x0a, 0xd1,
501     },
502   },
503   {
504     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
505      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
506      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
507      0x5c, 0x5c, 0x2a, 0x2a, },
508     {0xa1, 0xe8, 0x1c, 0x04, 0xf3, 0x0c, 0xe2, 0x01,
509      0xc7, 0xc9, 0xac, 0xe7, 0x85, 0xed, 0x44, 0xcc,
510      0x33, 0xb4, 0x55, 0xa0, 0x22, 0xf2, 0xac, 0xdb,
511      0xc6, 0xca, 0xe8, 0x3c, 0x23, 0x0e, 0x09, 0x3c,
512      0x24, 0xf6, 0x38, 0xf5, 0x33, 0xda, 0xc6, 0xe2,
513      0xb6, 0xd0, 0x1d, 0xa3, 0xb5, 0xe7, 0xf4, 0x54,
514      0x29, 0x31, 0x5c, 0xa9, 0x3f, 0xb8, 0xe6, 0x34,
515     },
516   },
517   {
518     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
519      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
520      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
521      0x5c, 0x5c, 0x2a, 0x2b, },
522     {0xc9, 0xff, 0x61, 0xb0, 0x40, 0x87, 0x4c, 0x05,
523      0x68, 0x47, 0x92, 0x16, 0x82, 0x4a, 0x15, 0xea,
524      0xb1, 0xa8, 0x38, 0xa7, 0x97, 0xd1, 0x89, 0x74,
525      0x62, 0x26, 0xe4, 0xcc, 0x15, 0x67, 0x29, 0xf1,
526      0xa0, 0x03, 0x64, 0x70, 0x30, 0x66, 0x60, 0x54,
527      0xe2, 0x08, 0x18, 0x0f, 0x8f, 0x7b, 0x0d, 0xf2,
528      0x24, 0x9e, 0x44, 0xfb, 0xa5, 0x93, 0x1f, 0xff,
529     },
530   },
531   {
532     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
533      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
534      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
535      0x5c, 0x5c, 0x2a, 0x2c, },
536     {0xb8, 0x35, 0x7c, 0x3a, 0x6c, 0xee, 0xf2, 0x88,
537      0x31, 0x0e, 0x17, 0xb8, 0xbf, 0xef, 0xf9, 0x20,
538      0x08, 0x46, 0xca, 0x8c, 0x19, 0x42, 0x49, 0x7c,
539      0x48, 0x44, 0x03, 0xbc, 0x00, 0xeb, 0x61, 0x05,
540      0x99, 0xf9, 0x59, 0x42, 0xdf, 0x10, 0x82, 0xe4,
541      0xf9, 0x42, 0x6d, 0x08, 0x6f, 0xb9, 0xc6, 0x23,
542      0x1a, 0xe8, 0xb2, 0x49, 0x33, 0xaa, 0xb5, 0xdb,
543     },
544   },
545   {
546     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
547      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
548      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
549      0x5c, 0x5c, 0x2a, 0x2d, },
550     {0x0b, 0x6e, 0xc4, 0xfe, 0x17, 0x77, 0x38, 0x24,
551      0x04, 0xef, 0x67, 0x99, 0x97, 0xba, 0x8d, 0x1c,
552      0xc5, 0xcd, 0x8e, 0x85, 0x34, 0x92, 0x59, 0xf5,
553      0x90, 0xc4, 0xc6, 0x6d, 0xcc, 0x66, 0x2b, 0x9b,
554      0xcb, 0xa6, 0xf9, 0x4e, 0xe4, 0xff, 0x1c, 0x9c,
555      0x10, 0xbd, 0x6d, 0xdd, 0x0d, 0x13, 0x8d, 0xf2,
556      0xd0, 0x99, 0xa2, 0x82, 0x15, 0x2a, 0x4b, 0x7f,
557     },
558   },
559   {
560     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
561      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
562      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
563      0x5c, 0x5c, 0x2a, 0x2e, },
564     {0xba, 0xa4, 0xd8, 0x63, 0x55, 0x11, 0xa7, 0xd2,
565      0x88, 0xae, 0xbe, 0xed, 0xd1, 0x2c, 0xe5, 0x29,
566      0xff, 0x10, 0x2c, 0x91, 0xf9, 0x7f, 0x86, 0x7e,
567      0x21, 0x91, 0x6b, 0xf9, 0x68, 0x65, 0xa0, 0xb8,
568      0xa6, 0x07, 0xf0, 0xb0, 0x4b, 0x13, 0xd1, 0xcb,
569      0x0a, 0xa9, 0x92, 0xa5, 0xa9, 0x7f, 0x5e, 0xe8,
570      0xca, 0x18, 0x49, 0xef, 0xb9, 0xed, 0x86, 0x78,
571     },
572   },
573   {
574     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
575      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
576      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
577      0x5c, 0x5c, 0x2a, 0x2f, },
578     {0xa5, 0x36, 0x40, 0xc8, 0x3d, 0xc2, 0x08, 0x60,
579      0x3d, 0xed, 0x83, 0xe4, 0xec, 0xf7, 0x58, 0xf2,
580      0x4c, 0x35, 0x7d, 0x7c, 0xf4, 0x80, 0x88, 0xb2,
581      0xce, 0x01, 0xe9, 0xfa, 0x2a, 0x7e, 0xb3, 0x28,
582      0xdb, 0xe6, 0x63, 0xb5, 0xa4, 0x68, 0xb5, 0xbc,
583      0x97, 0xa0, 0x40, 0xa3, 0x74, 0x53, 0x96, 0xba,
584      0x63, 0x6b, 0x96, 0x43, 0x70, 0xdc, 0x33, 0x52,
585     },
586   },
587   {
588     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
589      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
590      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
591      0x5c, 0x5c, 0x2a, 0x30, },
592     {0x34, 0xe8, 0xe1, 0x7a, 0x43, 0x0e, 0x43, 0x28,
593      0x97, 0x93, 0xc3, 0x83, 0xfa, 0xc9, 0x77, 0x42,
594      0x47, 0xb4, 0x0e, 0x9e, 0xbd, 0x33, 0x66, 0x98,
595      0x1f, 0xcf, 0xae, 0xca, 0xda, 0xd7, 0xe6, 0x08,
596      0xe3, 0x80, 0x48, 0x04, 0x34, 0xea, 0x64, 0x1c,
597      0xc8, 0x2c, 0x82, 0xcb, 0xc9, 0x28, 0x01, 0x46,
598      0x9c, 0x8d, 0xb0, 0x20, 0x4f, 0x13, 0x48, 0x9a,
599     },
600   },
601   {
602     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
603      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
604      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
605      0x5c, 0x5c, 0x2a, 0x31, },
606     {0x6e, 0x31, 0xee, 0x1d, 0xc1, 0x37, 0xf8, 0x1b,
607      0x05, 0x67, 0x52, 0xe4, 0xde, 0xab, 0x14, 0x43,
608      0xa4, 0x81, 0x03, 0x3e, 0x9b, 0x4c, 0x93, 0xa3,
609      0x04, 0x4f, 0x4f, 0x7a, 0xdf, 0x82, 0x22, 0x0f,
610      0xc7, 0xa4, 0x02, 0x15, 0x49, 0x16, 0x53, 0x25,
611      0x72, 0x5f, 0x94, 0xc3, 0x41, 0x0d, 0xdb, 0x56,
612      0xc5, 0x4e, 0x16, 0x1f, 0xc9, 0xef, 0x62, 0xee,
613     },
614   },
615   {
616     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
617      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
618      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
619      0x5c, 0x5c, 0x2a, 0x32, },
620     {0xef, 0x53, 0xb6, 0x29, 0x4a, 0xca, 0x43, 0x1f,
621      0x0f, 0x3c, 0x22, 0xdc, 0x82, 0xeb, 0x90, 0x50,
622      0x32, 0x4f, 0x1d, 0x88, 0xd3, 0x77, 0xe7, 0x16,
623      0x44, 0x8e, 0x50, 0x7c, 0xdf, 0x4a, 0xef, 0xff,
624      0xbf, 0x6d, 0x16, 0x99, 0xc9, 0x30, 0x48, 0x1c,
625      0xd1, 0x02, 0x12, 0x7c, 0x9a, 0x3d, 0x99, 0x20,
626      0x48, 0xab, 0x05, 0x92, 0x9b, 0x6e, 0x59, 0x27,
627     },
628   },
629   {
630     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
631      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
632      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
633      0x5c, 0x5c, 0x2a, 0x33, },
634     {0xae, 0xa9, 0xe1, 0x7a, 0x30, 0x65, 0x17, 0xeb,
635      0x89, 0x15, 0x2a, 0xa7, 0x09, 0x6d, 0x2c, 0x38,
636      0x1e, 0xc8, 0x13, 0xc5, 0x1a, 0xa8, 0x80, 0xe7,
637      0xbe, 0xe2, 0xc0, 0xfd, 0xc6, 0x44, 0xcf, 0x15,
638      0x4c, 0xc8, 0x1f, 0x5a, 0xde, 0x49, 0x34, 0x5e,
639      0x54, 0x1b, 0x4d, 0x4b, 0x5c, 0x1a, 0xdb, 0x3e,
640      0xb5, 0xc0, 0x1c, 0x14, 0xee, 0x94, 0x9a, 0xa2,
641     },
642   },
643   {
644     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
645      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
646      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
647      0x5c, 0x5c, 0x2a, 0x34, },
648     {0x2f, 0xdc, 0xcc, 0xfe, 0xe7, 0x20, 0xa7, 0x7e,
649      0xf6, 0xcb, 0x3b, 0xfb, 0xb4, 0x47, 0xf9, 0x38,
650      0x31, 0x17, 0xe3, 0xda, 0xa4, 0xa0, 0x7e, 0x36,
651      0xed, 0x15, 0xf7, 0x8d, 0xc8, 0xe8, 0xcd, 0x1b,
652      0x0b, 0xe4, 0x0b, 0x08, 0x77, 0xcf, 0xca, 0x19,
653      0x58, 0x60, 0x31, 0x22, 0xf1, 0xe6, 0x91, 0x4f,
654      0x84, 0xb7, 0xe8, 0xe9, 0x68, 0xae, 0x8b, 0x9e,
655     },
656   },
657   {
658     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
659      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
660      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
661      0x5c, 0x5c, 0x2a, 0x35, },
662     {0x85, 0x8e, 0x6f, 0x9c, 0xc6, 0xc1, 0x2c, 0x31,
663      0xf5, 0xdf, 0x12, 0x4a, 0xa7, 0x77, 0x67, 0xb0,
664      0x5c, 0x8b, 0xc0, 0x21, 0xbd, 0x68, 0x3d, 0x2b,
665      0x55, 0x57, 0x15, 0x50, 0xfb, 0x92, 0x32, 0xc1,
666      0x5a, 0x3b, 0xc7, 0x67, 0x3a, 0x3a, 0x03, 0xb0,
667      0x25, 0x38, 0x24, 0xc5, 0x3d, 0x0f, 0xd1, 0x41,
668      0x1b, 0x1c, 0xab, 0xe2, 0xe1, 0x87, 0xfb, 0x87,
669     },
670   },
671   {
672     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
673      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
674      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
675      0x5c, 0x5c, 0x2a, 0x36, },
676     {0xdb, 0x2f, 0x6b, 0xe6, 0x30, 0xe2, 0x46, 0xa5,
677      0xcf, 0x7d, 0x99, 0xb8, 0x51, 0x94, 0xb1, 0x23,
678      0xd4, 0x87, 0xe2, 0xd4, 0x66, 0xb9, 0x4b, 0x24,
679      0xa0, 0x3c, 0x3e, 0x28, 0xf0, 0xc5, 0xcf, 0xf7,
680      0xab, 0x68, 0x0d, 0x09, 0xee, 0x11, 0xda, 0xe8,
681      0x4e, 0x9c, 0x10, 0x72, 0xac, 0x48, 0xea, 0x2e,
682      0x74, 0x4b, 0x1b, 0x7f, 0x72, 0xfd, 0x46, 0x9e,
683     },
684   },
685   {
686     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
687      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
688      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
689      0x5c, 0x5c, 0x2a, 0x37, },
690     {0x1f, 0x24, 0x83, 0xf8, 0x25, 0x72, 0x25, 0x1f,
691      0xca, 0x97, 0x5f, 0xea, 0x40, 0xdb, 0x82, 0x1d,
692      0xf8, 0xad, 0x82, 0xa3, 0xc0, 0x02, 0xee, 0x6c,
693      0x57, 0x11, 0x24, 0x08, 0x76, 0x05, 0x0f, 0x33,
694      0x48, 0xaf, 0x26, 0x64, 0xaa, 0xc3, 0xa8, 0xb0,
695      0x52, 0x81, 0x30, 0x4e, 0xbc, 0x7a, 0x79, 0x14,
696      0xc6, 0xad, 0x50, 0xa4, 0xb4, 0xea, 0xc3, 0x83,
697     },
698   },
699   {
700     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
701      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
702      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
703      0x5c, 0x5c, 0x2a, 0x38, },
704     {0x31, 0xc4, 0x9a, 0xe7, 0x5b, 0xce, 0x78, 0x07,
705      0xcd, 0xff, 0x22, 0x05, 0x5d, 0x94, 0xee, 0x90,
706      0x21, 0xfe, 0xdb, 0xb5, 0xab, 0x51, 0xc5, 0x75,
707      0x26, 0xf0, 0x11, 0xaa, 0xd8, 0x17, 0x40, 0x0e,
708      0x8b, 0xa9, 0xca, 0x13, 0xa4, 0x5f, 0x36, 0x0e,
709      0x3d, 0x12, 0x1e, 0xaa, 0xeb, 0x39, 0xaf, 0x82,
710      0xd6, 0x00, 0x1c, 0x81, 0x86, 0xf5, 0xf8, 0x66,
711     },
712   },
713   {
714     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
715      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
716      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
717      0x5c, 0x5c, 0x2a, 0x39, },
718     {0xae, 0x99, 0xfe, 0xeb, 0xb5, 0xd2, 0x69, 0x45,
719      0xb5, 0x48, 0x92, 0x09, 0x2a, 0x8a, 0xee, 0x02,
720      0x91, 0x29, 0x30, 0xfa, 0x41, 0xcd, 0x11, 0x4e,
721      0x40, 0x44, 0x73, 0x01, 0xfb, 0x7d, 0xa7, 0xf5,
722      0xf1, 0x3a, 0x43, 0xb8, 0x17, 0x74, 0x37, 0x3c,
723      0x87, 0x9c, 0xd3, 0x2d, 0x69, 0x34, 0xc0, 0x5f,
724      0xa7, 0x58, 0xee, 0xb1, 0x4f, 0xcf, 0xab, 0x38,
725     },
726   },
727   {
728     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
729      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
730      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
731      0x5c, 0x5c, 0x2a, 0x3a, },
732     {0xdf, 0x1b, 0x1d, 0x66, 0xa5, 0x51, 0xd0, 0xd3,
733      0x1e, 0xff, 0x82, 0x25, 0x58, 0xb9, 0xd2, 0xcc,
734      0x75, 0xc2, 0x18, 0x02, 0x79, 0xfe, 0x0d, 0x08,
735      0xfd, 0x89, 0x6d, 0x04, 0x5c, 0x08, 0x0f, 0xc3,
736      0x52, 0x2f, 0x41, 0xbb, 0xb3, 0xf5, 0x5a, 0x97,
737      0xcf, 0xec, 0xf2, 0x1f, 0x88, 0x2c, 0xe8, 0xcb,
738      0xb1, 0xe5, 0x0c, 0xa6, 0xe6, 0x7e, 0x56, 0xdc,
739     },
740   },
741   {
742     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
743      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
744      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
745      0x5c, 0x5c, 0x2a, 0x3b, },
746     {0x70, 0x6a, 0x46, 0xdc, 0x76, 0xdc, 0xb7, 0x67,
747      0x98, 0xe6, 0x0e, 0x6d, 0x89, 0x47, 0x47, 0x88,
748      0xd1, 0x6d, 0xc1, 0x80, 0x32, 0xd2, 0x68, 0xfd,
749      0x1a, 0x70, 0x4f, 0xa6, 0xe3, 0xd4, 0x89, 0x58,
750      0x43, 0xda, 0x18, 0x8f, 0xd5, 0x8f, 0xb0, 0x56,
751      0x79, 0x76, 0xd7, 0xb5, 0x03, 0x59, 0xd6, 0xb7,
752      0x85, 0x30, 0xc8, 0xf6, 0x2d, 0x1b, 0x17, 0x46,
753     },
754   },
755   {
756     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
757      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0xa2,
758      0xe0, 0xb8, 0xf0, 0x3e, 0x13, 0xdd, 0x29, 0x45,
759      0x5c, 0x5c, 0x2a, 0x3c, },
760     {0xb7, 0x0e, 0x0c, 0xbd, 0x6b, 0xb4, 0xbf, 0x7f,
761      0x32, 0x13, 0x90, 0xb9, 0x4a, 0x03, 0xc1, 0xd3,
762      0x56, 0xc2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xd6,
763      0x11, 0x5c, 0x1d, 0x21, 0x42, 0xc8, 0x9c, 0x77,
764      0x4a, 0x08, 0xdc, 0x04, 0xb3, 0xdd, 0x20, 0x19,
765      0x32, 0xbc, 0x8a, 0x5e, 0xa5, 0xf8, 0xb8, 0x9b,
766      0xbb, 0x2a, 0x7e, 0x66, 0x7a, 0xff, 0x81, 0xcd,
767     },
768   },
769 };
770 
TEST(P224,ExternalToInternalAndBack)771 TEST(P224, ExternalToInternalAndBack) {
772   Point point;
773 
774   EXPECT_TRUE(point.SetFromString(base::StringPiece(
775       reinterpret_cast<const char *>(kBasePointExternal),
776       sizeof(kBasePointExternal))));
777 
778   const std::string external = point.ToString();
779 
780   ASSERT_EQ(external.size(), 56u);
781   EXPECT_EQ(0, memcmp(external.data(), kBasePointExternal,
782                       sizeof(kBasePointExternal)));
783 }
784 
TEST(P224,ScalarBaseMult)785 TEST(P224, ScalarBaseMult) {
786   Point point;
787 
788   for (size_t i = 0; i < arraysize(kNISTTestVectors); i++) {
789     p224::ScalarBaseMult(kNISTTestVectors[i].scalar, &point);
790     const std::string external = point.ToString();
791     ASSERT_EQ(external.size(), 56u);
792     EXPECT_EQ(0, memcmp(external.data(), kNISTTestVectors[i].affine,
793                         external.size()));
794   }
795 }
796 
TEST(P224,Addition)797 TEST(P224, Addition) {
798   Point a, b, minus_b, sum, a_again;
799 
800   ASSERT_TRUE(a.SetFromString(base::StringPiece(
801       reinterpret_cast<const char *>(kNISTTestVectors[10].affine), 56)));
802   ASSERT_TRUE(b.SetFromString(base::StringPiece(
803       reinterpret_cast<const char *>(kNISTTestVectors[11].affine), 56)));
804 
805   p224::Negate(b, &minus_b);
806   p224::Add(a, b, &sum);
807   EXPECT_NE(0, memcmp(&sum, &a, sizeof(sum)));
808   p224::Add(minus_b, sum, &a_again);
809   EXPECT_EQ(a_again.ToString(), a.ToString());
810 }
811 
TEST(P224,Infinity)812 TEST(P224, Infinity) {
813   char zeros[56];
814   memset(zeros, 0, sizeof(zeros));
815 
816   // Test that x^0 = ∞.
817   Point a;
818   p224::ScalarBaseMult(reinterpret_cast<const uint8_t*>(zeros), &a);
819   EXPECT_EQ(0, memcmp(zeros, a.ToString().data(), sizeof(zeros)));
820 
821   // We shouldn't allow ∞ to be imported.
822   EXPECT_FALSE(a.SetFromString(std::string(zeros, sizeof(zeros))));
823 }
824 
825 }  // namespace crypto
826