summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regress/lib/libcrypto/ec/ec_point_conversion.c363
1 files changed, 362 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/ec/ec_point_conversion.c b/src/regress/lib/libcrypto/ec/ec_point_conversion.c
index 97ba70034d..9e58018009 100644
--- a/src/regress/lib/libcrypto/ec/ec_point_conversion.c
+++ b/src/regress/lib/libcrypto/ec/ec_point_conversion.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_point_conversion.c,v 1.1 2021/04/21 20:15:08 tb Exp $ */ 1/* $OpenBSD: ec_point_conversion.c,v 1.2 2021/05/03 14:46:18 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
@@ -235,6 +235,366 @@ test_random_points(void)
235 return failed; 235 return failed;
236} 236}
237 237
238static const struct point_conversion {
239 const char *description;
240 int nid;
241 uint8_t octets[256];
242 uint8_t octets_len;
243 int valid;
244} point_conversions[] = {
245 {
246 .description = "point at infinity on sect571k1",
247 .nid = NID_sect571k1,
248 .octets = { 0x00 },
249 .octets_len = 1,
250 .valid = 1,
251 },
252 {
253 .description = "point at infinity on sect571k1 (flipped y_bit)",
254 .nid = NID_sect571k1,
255 .octets = { 0x01 },
256 .octets_len = 1,
257 .valid = 0,
258 },
259 {
260 .description = "zero x compressed point on sect571k1",
261 .nid = NID_sect571k1,
262 .octets = {
263 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272 0x00,
273 },
274 .octets_len = 73,
275 .valid = 1,
276 },
277 {
278 .description =
279 "zero x compressed point on sect571k1 (flipped y_bit)",
280 .nid = NID_sect571k1,
281 .octets = {
282 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291 0x00,
292 },
293 .octets_len = 73,
294 .valid = 0,
295 },
296 {
297 .description = "generic compressed point on sect571k1",
298 .nid = NID_sect571k1,
299 .octets = {
300 0x02, 0x00, 0x5e, 0x33, 0x9f, 0xd6, 0xf1, 0xae,
301 0x10, 0xbd, 0x48, 0xcf, 0xf1, 0x0d, 0x8e, 0x0e,
302 0xd7, 0x83, 0xce, 0xf0, 0x3d, 0x14, 0x06, 0x41,
303 0x29, 0x7d, 0x7e, 0xa3, 0x01, 0xf4, 0x9b, 0xa2,
304 0x8c, 0xa6, 0xab, 0x24, 0xa0, 0x9e, 0xfd, 0xc4,
305 0x2d, 0xc2, 0x95, 0xb4, 0xf9, 0xd4, 0xf4, 0x97,
306 0x53, 0x5d, 0xe9, 0xe3, 0x47, 0xc3, 0xa8, 0x6b,
307 0xbb, 0x27, 0x74, 0x6b, 0xfb, 0x26, 0xca, 0x96,
308 0x76, 0x5b, 0x36, 0xe8, 0x87, 0xb5, 0xc5, 0x6a,
309 0xc5,
310 },
311 .octets_len = 73,
312 .valid = 1,
313 },
314 {
315 .description =
316 "generic compressed point on sect571k1 (flipped y_bit)",
317 .nid = NID_sect571k1,
318 .octets = {
319 0x03, 0x00, 0x5e, 0x33, 0x9f, 0xd6, 0xf1, 0xae,
320 0x10, 0xbd, 0x48, 0xcf, 0xf1, 0x0d, 0x8e, 0x0e,
321 0xd7, 0x83, 0xce, 0xf0, 0x3d, 0x14, 0x06, 0x41,
322 0x29, 0x7d, 0x7e, 0xa3, 0x01, 0xf4, 0x9b, 0xa2,
323 0x8c, 0xa6, 0xab, 0x24, 0xa0, 0x9e, 0xfd, 0xc4,
324 0x2d, 0xc2, 0x95, 0xb4, 0xf9, 0xd4, 0xf4, 0x97,
325 0x53, 0x5d, 0xe9, 0xe3, 0x47, 0xc3, 0xa8, 0x6b,
326 0xbb, 0x27, 0x74, 0x6b, 0xfb, 0x26, 0xca, 0x96,
327 0x76, 0x5b, 0x36, 0xe8, 0x87, 0xb5, 0xc5, 0x6a,
328 0xc5,
329 },
330 .octets_len = 73,
331 .valid = 1,
332 },
333 {
334 .description = "zero x uncompressed point on sect571k1",
335 .nid = NID_sect571k1,
336 .octets = {
337 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355 0x01,
356 },
357 .octets_len = 145,
358 .valid = 1,
359 },
360 {
361 .description = "zero x uncompressed point on sect571k1",
362 .nid = NID_sect571k1,
363 .octets = {
364 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382 0x01,
383 },
384 .octets_len = 145,
385 .valid = 0,
386 },
387 {
388 .description = "generic uncompressed point on sect571k1",
389 .nid = NID_sect571k1,
390 .octets = {
391 0x04, 0x02, 0x2d, 0xf4, 0x72, 0x38, 0xc2, 0xbe,
392 0x0d, 0xa4, 0xf1, 0xfc, 0xe8, 0x78, 0xe6, 0xad,
393 0x5c, 0xaa, 0xd9, 0x7f, 0x7c, 0xa9, 0x4c, 0xe4,
394 0xd2, 0xae, 0xba, 0xaa, 0x8c, 0x9d, 0x4c, 0xac,
395 0x85, 0x00, 0xe1, 0xfa, 0x33, 0x73, 0x51, 0x52,
396 0x5a, 0x4e, 0x75, 0x67, 0x1d, 0x0a, 0x2a, 0xd2,
397 0x38, 0xb2, 0x9b, 0xe8, 0xec, 0xbe, 0x07, 0x8b,
398 0xc0, 0x95, 0x77, 0xe9, 0x55, 0x0c, 0x6c, 0x0e,
399 0x02, 0x3b, 0x34, 0xe2, 0xa8, 0x29, 0xd2, 0x97,
400 0xd9, 0x05, 0xa2, 0x6f, 0xa8, 0x6f, 0x1c, 0x3a,
401 0xf6, 0x12, 0x42, 0x1a, 0x26, 0x6e, 0x87, 0xf3,
402 0x19, 0x04, 0x20, 0xa5, 0x29, 0x78, 0xee, 0xcf,
403 0x91, 0x06, 0xd2, 0x5a, 0x62, 0x2a, 0x7f, 0x1d,
404 0xa0, 0x7b, 0xb4, 0x31, 0x9c, 0xd2, 0x14, 0x60,
405 0xf5, 0x9b, 0xea, 0x4a, 0x41, 0xad, 0x47, 0x72,
406 0xf9, 0x01, 0xed, 0x7f, 0x5a, 0x27, 0x64, 0xa2,
407 0x53, 0x4e, 0x18, 0x51, 0x33, 0xa8, 0x1e, 0x3a,
408 0xc2, 0xe7, 0x2c, 0xe3, 0x63, 0x6d, 0x06, 0x29,
409 0x28,
410 },
411 .octets_len = 145,
412 .valid = 1,
413 },
414 {
415 .description =
416 "generic uncompressed point on sect571k1 (flipped y_bit)",
417 .nid = NID_sect571k1,
418 .octets = {
419 0x05, 0x02, 0x2d, 0xf4, 0x72, 0x38, 0xc2, 0xbe,
420 0x0d, 0xa4, 0xf1, 0xfc, 0xe8, 0x78, 0xe6, 0xad,
421 0x5c, 0xaa, 0xd9, 0x7f, 0x7c, 0xa9, 0x4c, 0xe4,
422 0xd2, 0xae, 0xba, 0xaa, 0x8c, 0x9d, 0x4c, 0xac,
423 0x85, 0x00, 0xe1, 0xfa, 0x33, 0x73, 0x51, 0x52,
424 0x5a, 0x4e, 0x75, 0x67, 0x1d, 0x0a, 0x2a, 0xd2,
425 0x38, 0xb2, 0x9b, 0xe8, 0xec, 0xbe, 0x07, 0x8b,
426 0xc0, 0x95, 0x77, 0xe9, 0x55, 0x0c, 0x6c, 0x0e,
427 0x02, 0x3b, 0x34, 0xe2, 0xa8, 0x29, 0xd2, 0x97,
428 0xd9, 0x05, 0xa2, 0x6f, 0xa8, 0x6f, 0x1c, 0x3a,
429 0xf6, 0x12, 0x42, 0x1a, 0x26, 0x6e, 0x87, 0xf3,
430 0x19, 0x04, 0x20, 0xa5, 0x29, 0x78, 0xee, 0xcf,
431 0x91, 0x06, 0xd2, 0x5a, 0x62, 0x2a, 0x7f, 0x1d,
432 0xa0, 0x7b, 0xb4, 0x31, 0x9c, 0xd2, 0x14, 0x60,
433 0xf5, 0x9b, 0xea, 0x4a, 0x41, 0xad, 0x47, 0x72,
434 0xf9, 0x01, 0xed, 0x7f, 0x5a, 0x27, 0x64, 0xa2,
435 0x53, 0x4e, 0x18, 0x51, 0x33, 0xa8, 0x1e, 0x3a,
436 0xc2, 0xe7, 0x2c, 0xe3, 0x63, 0x6d, 0x06, 0x29,
437 0x28,
438 },
439 .octets_len = 145,
440 .valid = 0,
441 },
442 {
443 .description = "zero x hybrid point on sect571k1",
444 .nid = NID_sect571k1,
445 .octets = {
446 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
464 0x01,
465 },
466 .octets_len = 145,
467 .valid = 1,
468 },
469 {
470 .description =
471 "zero x hybrid point on sect571k1 (flipped y_bit)",
472 .nid = NID_sect571k1,
473 .octets = {
474 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
483 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
486 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
489 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
491 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
492 0x01,
493 },
494 .octets_len = 145,
495 .valid = 0,
496 },
497 {
498 .description = "generic hybrid point on sect571k1",
499 .nid = NID_sect571k1,
500 .octets = {
501 0x07, 0x02, 0x2d, 0xf4, 0x72, 0x38, 0xc2, 0xbe,
502 0x0d, 0xa4, 0xf1, 0xfc, 0xe8, 0x78, 0xe6, 0xad,
503 0x5c, 0xaa, 0xd9, 0x7f, 0x7c, 0xa9, 0x4c, 0xe4,
504 0xd2, 0xae, 0xba, 0xaa, 0x8c, 0x9d, 0x4c, 0xac,
505 0x85, 0x00, 0xe1, 0xfa, 0x33, 0x73, 0x51, 0x52,
506 0x5a, 0x4e, 0x75, 0x67, 0x1d, 0x0a, 0x2a, 0xd2,
507 0x38, 0xb2, 0x9b, 0xe8, 0xec, 0xbe, 0x07, 0x8b,
508 0xc0, 0x95, 0x77, 0xe9, 0x55, 0x0c, 0x6c, 0x0e,
509 0x02, 0x3b, 0x34, 0xe2, 0xa8, 0x29, 0xd2, 0x97,
510 0xd9, 0x05, 0xa2, 0x6f, 0xa8, 0x6f, 0x1c, 0x3a,
511 0xf6, 0x12, 0x42, 0x1a, 0x26, 0x6e, 0x87, 0xf3,
512 0x19, 0x04, 0x20, 0xa5, 0x29, 0x78, 0xee, 0xcf,
513 0x91, 0x06, 0xd2, 0x5a, 0x62, 0x2a, 0x7f, 0x1d,
514 0xa0, 0x7b, 0xb4, 0x31, 0x9c, 0xd2, 0x14, 0x60,
515 0xf5, 0x9b, 0xea, 0x4a, 0x41, 0xad, 0x47, 0x72,
516 0xf9, 0x01, 0xed, 0x7f, 0x5a, 0x27, 0x64, 0xa2,
517 0x53, 0x4e, 0x18, 0x51, 0x33, 0xa8, 0x1e, 0x3a,
518 0xc2, 0xe7, 0x2c, 0xe3, 0x63, 0x6d, 0x06, 0x29,
519 0x28,
520 },
521 .octets_len = 145,
522 .valid = 1,
523 },
524 {
525 .description =
526 "generic hybrid point on sect571k1 (flipped y_bit)",
527 .nid = NID_sect571k1,
528 .octets = {
529 0x06, 0x02, 0x2d, 0xf4, 0x72, 0x38, 0xc2, 0xbe,
530 0x0d, 0xa4, 0xf1, 0xfc, 0xe8, 0x78, 0xe6, 0xad,
531 0x5c, 0xaa, 0xd9, 0x7f, 0x7c, 0xa9, 0x4c, 0xe4,
532 0xd2, 0xae, 0xba, 0xaa, 0x8c, 0x9d, 0x4c, 0xac,
533 0x85, 0x00, 0xe1, 0xfa, 0x33, 0x73, 0x51, 0x52,
534 0x5a, 0x4e, 0x75, 0x67, 0x1d, 0x0a, 0x2a, 0xd2,
535 0x38, 0xb2, 0x9b, 0xe8, 0xec, 0xbe, 0x07, 0x8b,
536 0xc0, 0x95, 0x77, 0xe9, 0x55, 0x0c, 0x6c, 0x0e,
537 0x02, 0x3b, 0x34, 0xe2, 0xa8, 0x29, 0xd2, 0x97,
538 0xd9, 0x05, 0xa2, 0x6f, 0xa8, 0x6f, 0x1c, 0x3a,
539 0xf6, 0x12, 0x42, 0x1a, 0x26, 0x6e, 0x87, 0xf3,
540 0x19, 0x04, 0x20, 0xa5, 0x29, 0x78, 0xee, 0xcf,
541 0x91, 0x06, 0xd2, 0x5a, 0x62, 0x2a, 0x7f, 0x1d,
542 0xa0, 0x7b, 0xb4, 0x31, 0x9c, 0xd2, 0x14, 0x60,
543 0xf5, 0x9b, 0xea, 0x4a, 0x41, 0xad, 0x47, 0x72,
544 0xf9, 0x01, 0xed, 0x7f, 0x5a, 0x27, 0x64, 0xa2,
545 0x53, 0x4e, 0x18, 0x51, 0x33, 0xa8, 0x1e, 0x3a,
546 0xc2, 0xe7, 0x2c, 0xe3, 0x63, 0x6d, 0x06, 0x29,
547 0x28,
548 },
549 .octets_len = 145,
550 .valid = 0,
551 },
552};
553
554static const size_t N_POINT_CONVERSIONS =
555 sizeof(point_conversions) / sizeof(point_conversions[0]);
556
557static int
558point_conversion_form_y_bit(const struct point_conversion *test)
559{
560 EC_GROUP *group = NULL;
561 EC_POINT *point = NULL;
562 int ret;
563 int failed = 0;
564
565 if ((group = EC_GROUP_new_by_curve_name(test->nid)) == NULL)
566 errx(1, "group");
567 if ((point = EC_POINT_new(group)) == NULL)
568 errx(1, "point");
569
570 ret = EC_POINT_oct2point(group, point, test->octets, test->octets_len,
571 NULL);
572 if (ret != test->valid) {
573 fprintf(stderr, "%s want %d got %d\n", test->description,
574 test->valid, ret);
575 failed |= 1;
576 }
577
578 EC_GROUP_free(group);
579 EC_POINT_free(point);
580
581 return failed;
582}
583
584static int
585test_point_conversions(void)
586{
587 size_t i;
588 int failed = 0;
589
590 for (i = 0; i < N_POINT_CONVERSIONS; i++)
591 failed |= point_conversion_form_y_bit(&point_conversions[i]);
592
593 fprintf(stderr, "%s: %s\n", __func__, failed ? "FAILED" : "SUCCESS");
594
595 return failed;
596}
597
238int 598int
239main(int argc, char **argv) 599main(int argc, char **argv)
240{ 600{
@@ -242,6 +602,7 @@ main(int argc, char **argv)
242 602
243 failed |= test_random_points(); 603 failed |= test_random_points();
244 failed |= hybrid_corner_case(); 604 failed |= hybrid_corner_case();
605 failed |= test_point_conversions();
245 606
246 fprintf(stderr, "%s\n", failed ? "FAILED" : "SUCCESS"); 607 fprintf(stderr, "%s\n", failed ? "FAILED" : "SUCCESS");
247 608