Line data Source code
1 : #include "../fd_f25519.h" 2 : 3 : /* fd_f25519_rng generates a random fd_f25519_t element. 4 : Note: insecure, for tests only. */ 5 : fd_f25519_t * 6 : fd_f25519_rng_unsafe( fd_f25519_t * r, 7 62 : fd_rng_t * rng ) { 8 : #if USE_FIAT_32 9 : r->el[0] = fd_rng_uint( rng ); 10 : r->el[1] = fd_rng_uint( rng ); 11 : r->el[2] = fd_rng_uint( rng ); 12 : r->el[3] = fd_rng_uint( rng ); 13 : r->el[4] = fd_rng_uint( rng ); 14 : r->el[5] = fd_rng_uint( rng ); 15 : r->el[6] = fd_rng_uint( rng ); 16 : r->el[7] = fd_rng_uint( rng ); 17 : r->el[8] = fd_rng_uint( rng ); 18 : r->el[9] = fd_rng_uint( rng ); 19 : #else 20 62 : r->el[0] = fd_rng_ulong( rng ); 21 62 : r->el[1] = fd_rng_ulong( rng ); 22 62 : r->el[2] = fd_rng_ulong( rng ); 23 62 : r->el[3] = fd_rng_ulong( rng ); 24 62 : r->el[4] = fd_rng_ulong( rng ); 25 62 : #endif 26 62 : fiat_25519_carry( r->el, r->el ); 27 62 : return r; 28 62 : }