@@ -35,9 +35,9 @@ void test_xonly_pubkey(void) {
3535 secp256k1_context * sign = api_test_context (SECP256K1_CONTEXT_SIGN , & ecount );
3636 secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
3737
38- secp256k1_rand256 (sk );
38+ secp256k1_testrand256 (sk );
3939 memset (ones32 , 0xFF , 32 );
40- secp256k1_rand256 (xy_sk );
40+ secp256k1_testrand256 (xy_sk );
4141 CHECK (secp256k1_ec_pubkey_create (sign , & pk , sk ) == 1 );
4242 CHECK (secp256k1_xonly_pubkey_from_pubkey (none , & xonly_pk , & pk_parity , & pk ) == 1 );
4343
@@ -120,7 +120,7 @@ void test_xonly_pubkey(void) {
120120 * the curve) then xonly_pubkey_parse should fail as well. */
121121 for (i = 0 ; i < count ; i ++ ) {
122122 unsigned char rand33 [33 ];
123- secp256k1_rand256 (& rand33 [1 ]);
123+ secp256k1_testrand256 (& rand33 [1 ]);
124124 rand33 [0 ] = SECP256K1_TAG_PUBKEY_EVEN ;
125125 if (!secp256k1_ec_pubkey_parse (ctx , & pk , rand33 , 33 )) {
126126 memset (& xonly_pk , 1 , sizeof (xonly_pk ));
@@ -154,8 +154,8 @@ void test_xonly_pubkey_tweak(void) {
154154 secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
155155
156156 memset (overflows , 0xff , sizeof (overflows ));
157- secp256k1_rand256 (tweak );
158- secp256k1_rand256 (sk );
157+ secp256k1_testrand256 (tweak );
158+ secp256k1_testrand256 (sk );
159159 CHECK (secp256k1_ec_pubkey_create (ctx , & internal_pk , sk ) == 1 );
160160 CHECK (secp256k1_xonly_pubkey_from_pubkey (none , & internal_xonly_pk , & pk_parity , & internal_pk ) == 1 );
161161
@@ -198,7 +198,7 @@ void test_xonly_pubkey_tweak(void) {
198198
199199 /* Invalid pk with a valid tweak */
200200 memset (& internal_xonly_pk , 0 , sizeof (internal_xonly_pk ));
201- secp256k1_rand256 (tweak );
201+ secp256k1_testrand256 (tweak );
202202 ecount = 0 ;
203203 CHECK (secp256k1_xonly_pubkey_tweak_add (verify , & output_pk , & internal_xonly_pk , tweak ) == 0 );
204204 CHECK (ecount == 1 );
@@ -228,8 +228,8 @@ void test_xonly_pubkey_tweak_check(void) {
228228 secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
229229
230230 memset (overflows , 0xff , sizeof (overflows ));
231- secp256k1_rand256 (tweak );
232- secp256k1_rand256 (sk );
231+ secp256k1_testrand256 (tweak );
232+ secp256k1_testrand256 (sk );
233233 CHECK (secp256k1_ec_pubkey_create (ctx , & internal_pk , sk ) == 1 );
234234 CHECK (secp256k1_xonly_pubkey_from_pubkey (none , & internal_xonly_pk , & pk_parity , & internal_pk ) == 1 );
235235
@@ -287,7 +287,7 @@ void test_xonly_pubkey_tweak_recursive(void) {
287287 unsigned char tweak [N_PUBKEYS - 1 ][32 ];
288288 int i ;
289289
290- secp256k1_rand256 (sk );
290+ secp256k1_testrand256 (sk );
291291 CHECK (secp256k1_ec_pubkey_create (ctx , & pk [0 ], sk ) == 1 );
292292 /* Add tweaks */
293293 for (i = 0 ; i < N_PUBKEYS - 1 ; i ++ ) {
@@ -327,7 +327,7 @@ void test_keypair(void) {
327327
328328 /* Test keypair_create */
329329 ecount = 0 ;
330- secp256k1_rand256 (sk );
330+ secp256k1_testrand256 (sk );
331331 CHECK (secp256k1_keypair_create (none , & keypair , sk ) == 0 );
332332 CHECK (memcmp (zeros96 , & keypair , sizeof (keypair )) == 0 );
333333 CHECK (ecount == 1 );
@@ -349,7 +349,7 @@ void test_keypair(void) {
349349
350350 /* Test keypair_pub */
351351 ecount = 0 ;
352- secp256k1_rand256 (sk );
352+ secp256k1_testrand256 (sk );
353353 CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
354354 CHECK (secp256k1_keypair_pub (none , & pk , & keypair ) == 1 );
355355 CHECK (secp256k1_keypair_pub (none , NULL , & keypair ) == 0 );
@@ -371,7 +371,7 @@ void test_keypair(void) {
371371
372372 /** Test keypair_xonly_pub **/
373373 ecount = 0 ;
374- secp256k1_rand256 (sk );
374+ secp256k1_testrand256 (sk );
375375 CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
376376 CHECK (secp256k1_keypair_xonly_pub (none , & xonly_pk , & pk_parity , & keypair ) == 1 );
377377 CHECK (secp256k1_keypair_xonly_pub (none , NULL , & pk_parity , & keypair ) == 0 );
@@ -414,8 +414,8 @@ void test_keypair_add(void) {
414414 secp256k1_context * verify = api_test_context (SECP256K1_CONTEXT_VERIFY , & ecount );
415415
416416 CHECK (sizeof (zeros96 ) == sizeof (keypair ));
417- secp256k1_rand256 (sk );
418- secp256k1_rand256 (tweak );
417+ secp256k1_testrand256 (sk );
418+ secp256k1_testrand256 (tweak );
419419 memset (overflows , 0xFF , 32 );
420420 CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
421421
@@ -444,7 +444,7 @@ void test_keypair_add(void) {
444444 for (i = 0 ; i < count ; i ++ ) {
445445 secp256k1_scalar scalar_tweak ;
446446 secp256k1_keypair keypair_tmp ;
447- secp256k1_rand256 (sk );
447+ secp256k1_testrand256 (sk );
448448 CHECK (secp256k1_keypair_create (ctx , & keypair , sk ) == 1 );
449449 memcpy (& keypair_tmp , & keypair , sizeof (keypair ));
450450 /* Because sk may be negated before adding, we need to try with tweak =
@@ -460,7 +460,7 @@ void test_keypair_add(void) {
460460
461461 /* Invalid keypair with a valid tweak */
462462 memset (& keypair , 0 , sizeof (keypair ));
463- secp256k1_rand256 (tweak );
463+ secp256k1_testrand256 (tweak );
464464 ecount = 0 ;
465465 CHECK (secp256k1_keypair_xonly_tweak_add (verify , & keypair , tweak ) == 0 );
466466 CHECK (ecount == 1 );
@@ -486,7 +486,7 @@ void test_keypair_add(void) {
486486 unsigned char pk32 [32 ];
487487 int pk_parity ;
488488
489- secp256k1_rand256 (tweak );
489+ secp256k1_testrand256 (tweak );
490490 CHECK (secp256k1_keypair_xonly_pub (ctx , & internal_pk , NULL , & keypair ) == 1 );
491491 CHECK (secp256k1_keypair_xonly_tweak_add (ctx , & keypair , tweak ) == 1 );
492492 CHECK (secp256k1_keypair_xonly_pub (ctx , & output_pk , & pk_parity , & keypair ) == 1 );
0 commit comments