D0_BOOL d0_iobuf_write_bignum(d0_iobuf_t *buf, const d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536]; // FIXME make threadsafe
+ static __thread unsigned char numbuf[65536];
size_t count = 0;
numbuf[0] = mpz_sgn(bignum->z) & 3;
if((numbuf[0] & 3) != 0) // nonzero
d0_bignum_t *d0_iobuf_read_bignum(d0_iobuf_t *buf, d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536]; // FIXME make threadsafe
+ static __thread unsigned char numbuf[65536];
size_t count = sizeof(numbuf);
if(!d0_iobuf_read_packet(buf, numbuf, &count))
return NULL;
D0_BOOL d0_iobuf_write_bignum(d0_iobuf_t *buf, const d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536]; // FIXME make threadsafe
+ static __thread unsigned char numbuf[65536];
size_t count = 0;
numbuf[0] = BN_is_zero(&bignum->z) ? 0 : BN_is_negative(&bignum->z) ? 3 : 1;
if((numbuf[0] & 3) != 0) // nonzero
d0_bignum_t *d0_iobuf_read_bignum(d0_iobuf_t *buf, d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536]; // FIXME make threadsafe
+ static __thread unsigned char numbuf[65536];
size_t count = sizeof(numbuf);
if(!d0_iobuf_read_packet(buf, numbuf, &count))
return NULL;
D0_BOOL d0_iobuf_write_bignum(d0_iobuf_t *buf, const d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536]; // FIXME make threadsafe
+ static __thread unsigned char numbuf[65536];
size_t count = 0;
numbuf[0] = (mp_iszero(&bignum->z) ? 0 : (bignum->z.sign == MP_ZPOS) ? 1 : 3);
if((numbuf[0] & 3) != 0) // nonzero
d0_bignum_t *d0_iobuf_read_bignum(d0_iobuf_t *buf, d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536]; // FIXME make threadsafe
+ static __thread unsigned char numbuf[65536];
size_t count = sizeof(numbuf);
if(!d0_iobuf_read_packet(buf, numbuf, &count))
return NULL;
char *d0_bignum_tostring(const d0_bignum_t *x, unsigned int base)
{
- static char str[65536]; // FIXME make threadsafe
+ static __thread char str[65536];
mp_toradix_n((mp_int *) &x->z, str, base, sizeof(str));
return str;
}
D0_WARN_UNUSED_RESULT D0_BOOL d0_longhash_bignum(const d0_bignum_t *in, unsigned char *outbuf, size_t outbuflen)
{
- unsigned char convbuf[1024];
+ static __thread unsigned char convbuf[1024];
size_t sz;
CHECK(d0_bignum_export_unsigned(in, convbuf, sizeof(convbuf)) >= 0);
D0_WARN_UNUSED_RESULT D0_BOOL d0_blind_id_fingerprint64_public_key(const d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen)
{
d0_iobuf_t *out = NULL;
- unsigned char convbuf[2048];
+ static __thread unsigned char convbuf[2048];
d0_iobuf_t *conv = NULL;
size_t sz, n;
D0_WARN_UNUSED_RESULT D0_BOOL d0_blind_id_generate_private_id_request(d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen)
{
d0_iobuf_t *out = NULL;
- unsigned char shabuf[2048];
+ static __thread unsigned char shabuf[2048];
size_t sz;
// temps: temp0 rsa_blind_signature_camouflage^challenge, temp1 (4^s)*rsa_blind_signature_camouflage^challenge
// 1. get random r, send HASH(4^r)
{
d0_iobuf_t *out = NULL;
- unsigned char convbuf[1024];
+ static __thread unsigned char convbuf[1024];
d0_iobuf_t *conv = NULL;
size_t sz = 0;
D0_BOOL failed = 0;
{
d0_iobuf_t *in = NULL;
d0_iobuf_t *out = NULL;
- unsigned char shabuf[2048];
+ static __thread unsigned char shabuf[2048];
size_t sz;
// temps: temp0 order, temp0 signature check
// (check using H(g^r) which we know)
{
d0_iobuf_t *in = NULL;
- unsigned char convbuf[1024];
+ static __thread unsigned char convbuf[1024];
d0_iobuf_t *conv = NULL;
size_t sz;
D0_WARN_UNUSED_RESULT D0_BOOL d0_blind_id_authenticate_with_private_id_generate_missing_signature(d0_blind_id_t *ctx)
{
size_t sz;
- unsigned char shabuf[2048];
+ static __thread unsigned char shabuf[2048];
REPLACING(schnorr_H_g_to_s_signature);
USING(schnorr_g_to_s); USING(rsa_d); USING(rsa_n);
{
d0_iobuf_t *out = NULL;
unsigned char *convbuf = NULL;
- unsigned char shabuf[2048];
+ static __thread unsigned char shabuf[2048];
d0_iobuf_t *conv = NULL;
size_t sz = 0;
d0_iobuf_t *in = NULL;
d0_iobuf_t *conv = NULL;
unsigned char *convbuf = NULL;
- unsigned char shabuf[2048];
+ static __thread unsigned char shabuf[2048];
size_t sz;
if(is_first)
D0_WARN_UNUSED_RESULT D0_BOOL d0_blind_id_fingerprint64_public_id(const d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen)
{
d0_iobuf_t *out = NULL;
- unsigned char convbuf[1024];
+ static __thread unsigned char convbuf[1024];
d0_iobuf_t *conv = NULL;
size_t sz, n;