@@ -2449,38 +2449,116 @@ def case17_fail_msm_G2():
2449
2449
"Name" : "bls_g2msm_empty_input"
2450
2450
},
2451
2451
{
2452
- "Input" : int_to_hex (int (G2 [0 ].coeffs [0 ]), 63 ) + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (
2453
- int (2 ), 32 ) + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (int (2 ), 32 ),
2452
+ "Input" : ""
2453
+ # G2 point (short x coordinate)
2454
+ + int_to_hex (int (G2 [0 ].coeffs [0 ]), 63 )
2455
+ + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 )
2456
+ + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 )
2457
+ + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 )
2458
+ # scalar
2459
+ + int_to_hex (int (2 ), 32 )
2460
+ # P2 point
2461
+ + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 )
2462
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2463
+ + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 )
2464
+ + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 )
2465
+ # scalar
2466
+ + int_to_hex (int (2 ), 32 ),
2454
2467
"ExpectedError" : "invalid input length" ,
2455
2468
"Name" : "bls_g2msm_short_input"
2456
2469
},
2457
2470
{
2458
- "Input" : int_to_hex (int (G2 [0 ].coeffs [0 ]), 65 ) + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (
2459
- int (2 ), 32 ) + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (int (2 ), 32 ),
2471
+ "Input" : ""
2472
+ # G2 point (long x coordinate)
2473
+ + int_to_hex (int (G2 [0 ].coeffs [0 ]), 65 )
2474
+ + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 )
2475
+ + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 )
2476
+ + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 )
2477
+ # scalar
2478
+ + int_to_hex (int (2 ), 32 )
2479
+ # P2 point
2480
+ + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 )
2481
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2482
+ + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 )
2483
+ + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 )
2484
+ # scalar
2485
+ + int_to_hex (int (2 ), 32 ),
2460
2486
"ExpectedError" : "invalid input length" ,
2461
2487
"Name" : "bls_g2msm_long_input"
2462
2488
},
2463
2489
{
2464
- "Input" : "10" + int_to_hex (int (G2 [0 ].coeffs [0 ]), 63 ) + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (
2465
- int (2 ), 32 ) + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (int (2 ), 32 ),
2490
+ # G2 point (wrong element top bytes)
2491
+ "Input" : "10"
2492
+ + int_to_hex (int (G2 [0 ].coeffs [0 ]), 63 )
2493
+ + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 )
2494
+ + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 )
2495
+ + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 )
2496
+ # scalar
2497
+ + int_to_hex (int (2 ), 32 )
2498
+ # P2 point
2499
+ + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 )
2500
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2501
+ + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 )
2502
+ + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 )
2503
+ # scalar
2504
+ + int_to_hex (int (2 ), 32 ),
2466
2505
"ExpectedError" : "invalid field element top bytes" ,
2467
2506
"Name" : "bls_g2msm_violate_top_bytes"
2468
2507
},
2469
2508
{
2470
- "Input" : int_to_hex (int (G2 [0 ].coeffs [0 ]) + q , 64 ) + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (
2471
- int (2 ), 32 ) + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (int (2 ), 32 ),
2509
+ "Input" : ""
2510
+ # G2 point (wrong encoding)
2511
+ + int_to_hex (int (G2 [0 ].coeffs [0 ]) + q , 64 )
2512
+ + int_to_hex (int (G2 [0 ].coeffs [1 ]), 64 )
2513
+ + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 )
2514
+ + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 )
2515
+ # scalar
2516
+ + int_to_hex (int (2 ), 32 )
2517
+ # P2 point
2518
+ + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 )
2519
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2520
+ + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 )
2521
+ + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 )
2522
+ # scalar
2523
+ + int_to_hex (int (2 ), 32 ),
2472
2524
"ExpectedError" : "invalid fp.Element encoding" ,
2473
2525
"Name" : "bls_g2msm_invalid_field_element"
2474
2526
},
2475
2527
{
2476
- "Input" : int_to_hex (int (G2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (
2477
- int (2 ), 32 ) + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (int (2 ), 32 ),
2528
+ "Input" : ""
2529
+ # G2 point (not on curve)
2530
+ + int_to_hex (int (G2 [0 ].coeffs [0 ]), 64 )
2531
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2532
+ + int_to_hex (int (G2 [1 ].coeffs [0 ]), 64 )
2533
+ + int_to_hex (int (G2 [1 ].coeffs [1 ]), 64 )
2534
+ # scalar
2535
+ + int_to_hex (int (2 ), 32 )
2536
+ # P2 point
2537
+ + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 )
2538
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2539
+ + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 )
2540
+ + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 )
2541
+ # scalar
2542
+ + int_to_hex (int (2 ), 32 ),
2478
2543
"ExpectedError" : "invalid point: not on curve" ,
2479
2544
"Name" : "bls_g2msm_point_not_on_curve"
2480
2545
},
2481
2546
{
2482
- "Input" : int_to_hex (int (G2_wrong_order [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2_wrong_order [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (G2_wrong_order [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (G2_wrong_order [1 ].coeffs [1 ]), 64 ) + int_to_hex (
2483
- int (2 ), 32 ) + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 ) + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 ) + int_to_hex (int (2 ), 32 ),
2547
+ "Input" : ""
2548
+ # G2 point (not in the correct subgroup)
2549
+ + int_to_hex (int (G2_wrong_order [0 ].coeffs [0 ]), 64 )
2550
+ + int_to_hex (int (G2_wrong_order [0 ].coeffs [1 ]), 64 )
2551
+ + int_to_hex (int (G2_wrong_order [1 ].coeffs [0 ]), 64 )
2552
+ + int_to_hex (int (G2_wrong_order [1 ].coeffs [1 ]), 64 )
2553
+ # scalar
2554
+ + int_to_hex (int (2 ), 32 )
2555
+ # P2 point
2556
+ + int_to_hex (int (P2 [0 ].coeffs [0 ]), 64 )
2557
+ + int_to_hex (int (P2 [0 ].coeffs [1 ]), 64 )
2558
+ + int_to_hex (int (P2 [1 ].coeffs [0 ]), 64 )
2559
+ + int_to_hex (int (P2 [1 ].coeffs [1 ]), 64 )
2560
+ # scalar
2561
+ + int_to_hex (int (2 ), 32 ),
2484
2562
"ExpectedError" : "g2 point is not in the correct subgroup" ,
2485
2563
"Name" : "bls_pairing_g2_not_in_correct_subgroup"
2486
2564
}
0 commit comments