csecp256k1

Haskell FFI bindings to bitcoin-core/secp256k1 (docs.ppad.tech/csecp256k1).
git clone git://git.ppad.tech/csecp256k1.git
Log | Files | Refs | README | LICENSE

testutil.h (855B)


      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(haskellsecp256k1_v0_1_0_fe *x) {
     14     unsigned char bin[32];
     15     do {
     16         haskellsecp256k1_v0_1_0_testrand256(bin);
     17         if (haskellsecp256k1_v0_1_0_fe_set_b32_limit(x, bin)) {
     18             return;
     19         }
     20     } while(1);
     21 }
     22 
     23 static void random_fe_non_zero(haskellsecp256k1_v0_1_0_fe *nz) {
     24     do {
     25         random_fe(nz);
     26     } while (haskellsecp256k1_v0_1_0_fe_is_zero(nz));
     27 }
     28 
     29 #endif /* SECP256K1_TESTUTIL_H */