@@ -21,11 +21,12 @@ static void nonce_function_bip340_bitflip(unsigned char **args, size_t n_flip, s
21
21
}
22
22
23
23
static void run_nonce_function_bip340_tests (void ) {
24
- unsigned char tag [] = {'B' , 'I' , 'P' , '0' , '3' , '4' , '0' , '/' , 'n' , 'o' , 'n' , 'c' , 'e' };
25
- unsigned char aux_tag [] = {'B' , 'I' , 'P' , '0' , '3' , '4' , '0' , '/' , 'a' , 'u' , 'x' };
24
+ /* "BIP0340/nonce" */
25
+ static const unsigned char tag [] = {'B' , 'I' , 'P' , '0' , '3' , '4' , '0' , '/' , 'n' , 'o' , 'n' , 'c' , 'e' };
26
+ /* "BIP0340/aux" */
27
+ static const unsigned char aux_tag [] = {'B' , 'I' , 'P' , '0' , '3' , '4' , '0' , '/' , 'a' , 'u' , 'x' };
26
28
unsigned char algo [] = {'B' , 'I' , 'P' , '0' , '3' , '4' , '0' , '/' , 'n' , 'o' , 'n' , 'c' , 'e' };
27
29
size_t algolen = sizeof (algo );
28
- secp256k1_sha256 sha ;
29
30
secp256k1_sha256 sha_optimized ;
30
31
unsigned char nonce [32 ], nonce_z [32 ];
31
32
unsigned char msg [32 ];
@@ -39,16 +40,15 @@ static void run_nonce_function_bip340_tests(void) {
39
40
/* Check that hash initialized by
40
41
* secp256k1_nonce_function_bip340_sha256_tagged has the expected
41
42
* state. */
42
- secp256k1_sha256_initialize_tagged (& sha , tag , sizeof (tag ));
43
43
secp256k1_nonce_function_bip340_sha256_tagged (& sha_optimized );
44
- test_sha256_eq (& sha , & sha_optimized );
44
+ sha256_tag_test_internal (& sha_optimized , tag , sizeof (tag ));
45
+
45
46
46
47
/* Check that hash initialized by
47
48
* secp256k1_nonce_function_bip340_sha256_tagged_aux has the expected
48
49
* state. */
49
- secp256k1_sha256_initialize_tagged (& sha , aux_tag , sizeof (aux_tag ));
50
50
secp256k1_nonce_function_bip340_sha256_tagged_aux (& sha_optimized );
51
- test_sha256_eq ( & sha , & sha_optimized );
51
+ sha256_tag_test_internal ( & sha_optimized , aux_tag , sizeof ( aux_tag ) );
52
52
53
53
testrand256 (msg );
54
54
testrand256 (key );
0 commit comments