2121
2222typedef struct {
2323 secp256k1_scalar scalar [2 ];
24- secp256k1_fe fe [2 ];
24+ secp256k1_fe fe [4 ];
2525 secp256k1_ge ge [2 ];
2626 secp256k1_gej gej [2 ];
2727 unsigned char data [64 ];
@@ -31,29 +31,51 @@ typedef struct {
3131void bench_setup (void * arg ) {
3232 bench_inv * data = (bench_inv * )arg ;
3333
34- static const unsigned char init [2 ][32 ] = {
34+ static const unsigned char init [4 ][32 ] = {
35+ /* Initializer for scalar[0], fe[0], first half of data, the X coordinate of ge[0],
36+ and the (implied affine) X coordinate of gej[0]. */
3537 {
3638 0x02 , 0x03 , 0x05 , 0x07 , 0x0b , 0x0d , 0x11 , 0x13 ,
3739 0x17 , 0x1d , 0x1f , 0x25 , 0x29 , 0x2b , 0x2f , 0x35 ,
3840 0x3b , 0x3d , 0x43 , 0x47 , 0x49 , 0x4f , 0x53 , 0x59 ,
3941 0x61 , 0x65 , 0x67 , 0x6b , 0x6d , 0x71 , 0x7f , 0x83
4042 },
43+ /* Initializer for scalar[1], fe[1], first half of data, the X coordinate of ge[1],
44+ and the (implied affine) X coordinate of gej[1]. */
4145 {
4246 0x82 , 0x83 , 0x85 , 0x87 , 0x8b , 0x8d , 0x81 , 0x83 ,
4347 0x97 , 0xad , 0xaf , 0xb5 , 0xb9 , 0xbb , 0xbf , 0xc5 ,
4448 0xdb , 0xdd , 0xe3 , 0xe7 , 0xe9 , 0xef , 0xf3 , 0xf9 ,
4549 0x11 , 0x15 , 0x17 , 0x1b , 0x1d , 0xb1 , 0xbf , 0xd3
50+ },
51+ /* Initializer for fe[2] and the Z coordinate of gej[0]. */
52+ {
53+ 0x3d , 0x2d , 0xef , 0xf4 , 0x25 , 0x98 , 0x4f , 0x5d ,
54+ 0xe2 , 0xca , 0x5f , 0x41 , 0x3f , 0x3f , 0xce , 0x44 ,
55+ 0xaa , 0x2c , 0x53 , 0x8a , 0xc6 , 0x59 , 0x1f , 0x38 ,
56+ 0x38 , 0x23 , 0xe4 , 0x11 , 0x27 , 0xc6 , 0xa0 , 0xe7
57+ },
58+ /* Initializer for fe[3] and the Z coordinate of gej[1]. */
59+ {
60+ 0xbd , 0x21 , 0xa5 , 0xe1 , 0x13 , 0x50 , 0x73 , 0x2e ,
61+ 0x52 , 0x98 , 0xc8 , 0x9e , 0xab , 0x00 , 0xa2 , 0x68 ,
62+ 0x43 , 0xf5 , 0xd7 , 0x49 , 0x80 , 0x72 , 0xa7 , 0xf3 ,
63+ 0xd7 , 0x60 , 0xe6 , 0xab , 0x90 , 0x92 , 0xdf , 0xc5
4664 }
4765 };
4866
4967 secp256k1_scalar_set_b32 (& data -> scalar [0 ], init [0 ], NULL );
5068 secp256k1_scalar_set_b32 (& data -> scalar [1 ], init [1 ], NULL );
5169 secp256k1_fe_set_b32 (& data -> fe [0 ], init [0 ]);
5270 secp256k1_fe_set_b32 (& data -> fe [1 ], init [1 ]);
71+ secp256k1_fe_set_b32 (& data -> fe [2 ], init [2 ]);
72+ secp256k1_fe_set_b32 (& data -> fe [3 ], init [3 ]);
5373 CHECK (secp256k1_ge_set_xo_var (& data -> ge [0 ], & data -> fe [0 ], 0 ));
5474 CHECK (secp256k1_ge_set_xo_var (& data -> ge [1 ], & data -> fe [1 ], 1 ));
5575 secp256k1_gej_set_ge (& data -> gej [0 ], & data -> ge [0 ]);
76+ secp256k1_gej_rescale (& data -> gej [0 ], & data -> fe [2 ]);
5677 secp256k1_gej_set_ge (& data -> gej [1 ], & data -> ge [1 ]);
78+ secp256k1_gej_rescale (& data -> gej [1 ], & data -> fe [3 ]);
5779 memcpy (data -> data , init [0 ], 32 );
5880 memcpy (data -> data + 32 , init [1 ], 32 );
5981}
0 commit comments