Bitcoin Core  26.99.0
P2P Digital Currency
testutil.h
Go to the documentation of this file.
1 /***********************************************************************
2  * Distributed under the MIT software license, see the accompanying *
3  * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
4  ***********************************************************************/
5 
6 #ifndef SECP256K1_TESTUTIL_H
7 #define SECP256K1_TESTUTIL_H
8 
9 #include "field.h"
10 #include "testrand.h"
11 #include "util.h"
12 
13 static void random_fe(secp256k1_fe *x) {
14  unsigned char bin[32];
15  do {
17  if (secp256k1_fe_set_b32_limit(x, bin)) {
18  return;
19  }
20  } while(1);
21 }
22 
23 static void random_fe_non_zero(secp256k1_fe *nz) {
24  do {
25  random_fe(nz);
26  } while (secp256k1_fe_is_zero(nz));
27 }
28 
29 #endif /* SECP256K1_TESTUTIL_H */
#define secp256k1_fe_is_zero
Definition: field.h:85
#define secp256k1_fe_set_b32_limit
Definition: field.h:89
This field implementation represents the value as 10 uint32_t limbs in base 2^26.
Definition: field_10x26.h:14
static void secp256k1_testrand256(unsigned char *b32)
Generate a pseudorandom 32-byte array.
static void random_fe(secp256k1_fe *x)
Definition: testutil.h:13
static void random_fe_non_zero(secp256k1_fe *nz)
Definition: testutil.h:23