@@ -3987,23 +3987,24 @@ void run_ecdsa_sign_verify(void) {
3987
3987
}
3988
3988
3989
3989
/** Dummy nonce generation function that just uses a precomputed nonce, and fails if it is not accepted. Use only for testing. */
3990
- static int precomputed_nonce_function (unsigned char * nonce32 , const unsigned char * msg32 , const unsigned char * key32 , const unsigned char * algo16 , void * data , unsigned int counter ) {
3990
+ static int precomputed_nonce_function (const secp256k1_context * context , unsigned char * nonce32 , const unsigned char * msg32 , const unsigned char * key32 , const unsigned char * algo16 , void * data , unsigned int counter ) {
3991
+ (void )context ;
3991
3992
(void )msg32 ;
3992
3993
(void )key32 ;
3993
3994
(void )algo16 ;
3994
3995
memcpy (nonce32 , data , 32 );
3995
3996
return (counter == 0 );
3996
3997
}
3997
3998
3998
- static int nonce_function_test_fail (unsigned char * nonce32 , const unsigned char * msg32 , const unsigned char * key32 , const unsigned char * algo16 , void * data , unsigned int counter ) {
3999
+ static int nonce_function_test_fail (const secp256k1_context * context , unsigned char * nonce32 , const unsigned char * msg32 , const unsigned char * key32 , const unsigned char * algo16 , void * data , unsigned int counter ) {
3999
4000
/* Dummy nonce generator that has a fatal error on the first counter value. */
4000
4001
if (counter == 0 ) {
4001
4002
return 0 ;
4002
4003
}
4003
- return nonce_function_rfc6979 (nonce32 , msg32 , key32 , algo16 , data , counter - 1 );
4004
+ return nonce_function_rfc6979 (context , nonce32 , msg32 , key32 , algo16 , data , counter - 1 );
4004
4005
}
4005
4006
4006
- static int nonce_function_test_retry (unsigned char * nonce32 , const unsigned char * msg32 , const unsigned char * key32 , const unsigned char * algo16 , void * data , unsigned int counter ) {
4007
+ static int nonce_function_test_retry (const secp256k1_context * context , unsigned char * nonce32 , const unsigned char * msg32 , const unsigned char * key32 , const unsigned char * algo16 , void * data , unsigned int counter ) {
4007
4008
/* Dummy nonce generator that produces unacceptable nonces for the first several counter values. */
4008
4009
if (counter < 3 ) {
4009
4010
memset (nonce32 , counter == 0 ? 0 : 255 , 32 );
@@ -4030,7 +4031,7 @@ static int nonce_function_test_retry(unsigned char *nonce32, const unsigned char
4030
4031
if (counter > 5 ) {
4031
4032
return 0 ;
4032
4033
}
4033
- return nonce_function_rfc6979 (nonce32 , msg32 , key32 , algo16 , data , counter - 5 );
4034
+ return nonce_function_rfc6979 (context , nonce32 , msg32 , key32 , algo16 , data , counter - 5 );
4034
4035
}
4035
4036
4036
4037
int is_empty_signature (const secp256k1_ecdsa_signature * sig ) {
@@ -4910,13 +4911,13 @@ void test_ecdsa_edge_cases(void) {
4910
4911
VG_UNDEF (nonce2 ,32 );
4911
4912
VG_UNDEF (nonce3 ,32 );
4912
4913
VG_UNDEF (nonce4 ,32 );
4913
- CHECK (nonce_function_rfc6979 (nonce , zeros , zeros , NULL , NULL , 0 ) == 1 );
4914
+ CHECK (nonce_function_rfc6979 (ctx , nonce , zeros , zeros , NULL , NULL , 0 ) == 1 );
4914
4915
VG_CHECK (nonce ,32 );
4915
- CHECK (nonce_function_rfc6979 (nonce2 , zeros , zeros , zeros , NULL , 0 ) == 1 );
4916
+ CHECK (nonce_function_rfc6979 (ctx , nonce2 , zeros , zeros , zeros , NULL , 0 ) == 1 );
4916
4917
VG_CHECK (nonce2 ,32 );
4917
- CHECK (nonce_function_rfc6979 (nonce3 , zeros , zeros , NULL , (void * )zeros , 0 ) == 1 );
4918
+ CHECK (nonce_function_rfc6979 (ctx , nonce3 , zeros , zeros , NULL , (void * )zeros , 0 ) == 1 );
4918
4919
VG_CHECK (nonce3 ,32 );
4919
- CHECK (nonce_function_rfc6979 (nonce4 , zeros , zeros , zeros , (void * )zeros , 0 ) == 1 );
4920
+ CHECK (nonce_function_rfc6979 (ctx , nonce4 , zeros , zeros , zeros , (void * )zeros , 0 ) == 1 );
4920
4921
VG_CHECK (nonce4 ,32 );
4921
4922
CHECK (memcmp (nonce , nonce2 , 32 ) != 0 );
4922
4923
CHECK (memcmp (nonce , nonce3 , 32 ) != 0 );
0 commit comments