@@ -35,9 +35,9 @@ void test_xonly_pubkey(void) {
35
35
secp256k1_context * sign = api_test_context (SECP256K1_CONTEXT_SIGN , & ecount );
36
36
secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
37
37
38
- secp256k1_rand256 (sk );
38
+ secp256k1_testrand256 (sk );
39
39
memset (ones32 , 0xFF , 32 );
40
- secp256k1_rand256 (xy_sk );
40
+ secp256k1_testrand256 (xy_sk );
41
41
CHECK (secp256k1_ec_pubkey_create (sign , & pk , sk ) == 1 );
42
42
CHECK (secp256k1_xonly_pubkey_from_pubkey (none , & xonly_pk , & pk_parity , & pk ) == 1 );
43
43
@@ -120,7 +120,7 @@ void test_xonly_pubkey(void) {
120
120
* the curve) then xonly_pubkey_parse should fail as well. */
121
121
for (i = 0 ; i < count ; i ++ ) {
122
122
unsigned char rand33 [33 ];
123
- secp256k1_rand256 (& rand33 [1 ]);
123
+ secp256k1_testrand256 (& rand33 [1 ]);
124
124
rand33 [0 ] = SECP256K1_TAG_PUBKEY_EVEN ;
125
125
if (!secp256k1_ec_pubkey_parse (ctx , & pk , rand33 , 33 )) {
126
126
memset (& xonly_pk , 1 , sizeof (xonly_pk ));
@@ -154,8 +154,8 @@ void test_xonly_pubkey_tweak(void) {
154
154
secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
155
155
156
156
memset (overflows , 0xff , sizeof (overflows ));
157
- secp256k1_rand256 (tweak );
158
- secp256k1_rand256 (sk );
157
+ secp256k1_testrand256 (tweak );
158
+ secp256k1_testrand256 (sk );
159
159
CHECK (secp256k1_ec_pubkey_create (ctx , & internal_pk , sk ) == 1 );
160
160
CHECK (secp256k1_xonly_pubkey_from_pubkey (none , & internal_xonly_pk , & pk_parity , & internal_pk ) == 1 );
161
161
@@ -198,7 +198,7 @@ void test_xonly_pubkey_tweak(void) {
198
198
199
199
/* Invalid pk with a valid tweak */
200
200
memset (& internal_xonly_pk , 0 , sizeof (internal_xonly_pk ));
201
- secp256k1_rand256 (tweak );
201
+ secp256k1_testrand256 (tweak );
202
202
ecount = 0 ;
203
203
CHECK (secp256k1_xonly_pubkey_tweak_add (verify , & output_pk , & internal_xonly_pk , tweak ) == 0 );
204
204
CHECK (ecount == 1 );
@@ -228,8 +228,8 @@ void test_xonly_pubkey_tweak_check(void) {
228
228
secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
229
229
230
230
memset (overflows , 0xff , sizeof (overflows ));
231
- secp256k1_rand256 (tweak );
232
- secp256k1_rand256 (sk );
231
+ secp256k1_testrand256 (tweak );
232
+ secp256k1_testrand256 (sk );
233
233
CHECK (secp256k1_ec_pubkey_create (ctx , & internal_pk , sk ) == 1 );
234
234
CHECK (secp256k1_xonly_pubkey_from_pubkey (none , & internal_xonly_pk , & pk_parity , & internal_pk ) == 1 );
235
235
@@ -287,7 +287,7 @@ void test_xonly_pubkey_tweak_recursive(void) {
287
287
unsigned char tweak [N_PUBKEYS - 1 ][32 ];
288
288
int i ;
289
289
290
- secp256k1_rand256 (sk );
290
+ secp256k1_testrand256 (sk );
291
291
CHECK (secp256k1_ec_pubkey_create (ctx , & pk [0 ], sk ) == 1 );
292
292
/* Add tweaks */
293
293
for (i = 0 ; i < N_PUBKEYS - 1 ; i ++ ) {
@@ -327,7 +327,7 @@ void test_keypair(void) {
327
327
328
328
/* Test keypair_create */
329
329
ecount = 0 ;
330
- secp256k1_rand256 (sk );
330
+ secp256k1_testrand256 (sk );
331
331
CHECK (secp256k1_keypair_create (none , & keypair , sk ) == 0 );
332
332
CHECK (memcmp (zeros96 , & keypair , sizeof (keypair )) == 0 );
333
333
CHECK (ecount == 1 );
@@ -349,7 +349,7 @@ void test_keypair(void) {
349
349
350
350
/* Test keypair_pub */
351
351
ecount = 0 ;
352
- secp256k1_rand256 (sk );
352
+ secp256k1_testrand256 (sk );
353
353
CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
354
354
CHECK (secp256k1_keypair_pub (none , & pk , & keypair ) == 1 );
355
355
CHECK (secp256k1_keypair_pub (none , NULL , & keypair ) == 0 );
@@ -371,7 +371,7 @@ void test_keypair(void) {
371
371
372
372
/** Test keypair_xonly_pub **/
373
373
ecount = 0 ;
374
- secp256k1_rand256 (sk );
374
+ secp256k1_testrand256 (sk );
375
375
CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
376
376
CHECK (secp256k1_keypair_xonly_pub (none , & xonly_pk , & pk_parity , & keypair ) == 1 );
377
377
CHECK (secp256k1_keypair_xonly_pub (none , NULL , & pk_parity , & keypair ) == 0 );
@@ -414,8 +414,8 @@ void test_keypair_add(void) {
414
414
secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
415
415
416
416
CHECK (sizeof (zeros96 ) == sizeof (keypair ));
417
- secp256k1_rand256 (sk );
418
- secp256k1_rand256 (tweak );
417
+ secp256k1_testrand256 (sk );
418
+ secp256k1_testrand256 (tweak );
419
419
memset (overflows , 0xFF , 32 );
420
420
CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
421
421
@@ -444,7 +444,7 @@ void test_keypair_add(void) {
444
444
for (i = 0 ; i < count ; i ++ ) {
445
445
secp256k1_scalar scalar_tweak ;
446
446
secp256k1_keypair keypair_tmp ;
447
- secp256k1_rand256 (sk );
447
+ secp256k1_testrand256 (sk );
448
448
CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
449
449
memcpy (& keypair_tmp , & keypair , sizeof (keypair ));
450
450
/* Because sk may be negated before adding, we need to try with tweak =
@@ -460,7 +460,7 @@ void test_keypair_add(void) {
460
460
461
461
/* Invalid keypair with a valid tweak */
462
462
memset (& keypair , 0 , sizeof (keypair ));
463
- secp256k1_rand256 (tweak );
463
+ secp256k1_testrand256 (tweak );
464
464
ecount = 0 ;
465
465
CHECK (secp256k1_keypair_xonly_tweak_add (verify , & keypair , tweak ) == 0 );
466
466
CHECK (ecount == 1 );
@@ -486,7 +486,7 @@ void test_keypair_add(void) {
486
486
unsigned char pk32 [32 ];
487
487
int pk_parity ;
488
488
489
- secp256k1_rand256 (tweak );
489
+ secp256k1_testrand256 (tweak );
490
490
CHECK (secp256k1_keypair_xonly_pub (ctx , & internal_pk , NULL , & keypair ) == 1 );
491
491
CHECK (secp256k1_keypair_xonly_tweak_add (ctx , & keypair , tweak ) == 1 );
492
492
CHECK (secp256k1_keypair_xonly_pub (ctx , & output_pk , & pk_parity , & keypair ) == 1 );
0 commit comments