mpz_t z;
};
-static gmp_randstate_t RANDSTATE;
-static d0_bignum_t temp;
+static gmp_randstate_t RANDSTATE; // FIXME make threadsafe
+static d0_bignum_t temp; // FIXME make threadsafe
#include <time.h>
#include <stdio.h>
D0_BOOL d0_iobuf_write_bignum(d0_iobuf_t *buf, const d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536];
+ static unsigned char numbuf[65536]; // FIXME make threadsafe
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];
+ static unsigned char numbuf[65536]; // FIXME make threadsafe
size_t count = sizeof(numbuf);
if(!d0_iobuf_read_packet(buf, numbuf, &count))
return NULL;
BIGNUM z;
};
-static d0_bignum_t temp;
-static BN_CTX *ctx;
+static d0_bignum_t temp; // FIXME make threadsafe
+static BN_CTX *ctx; // FIXME make threadsafe
#include <time.h>
#include <stdio.h>
D0_BOOL d0_iobuf_write_bignum(d0_iobuf_t *buf, const d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536];
+ static unsigned char numbuf[65536]; // FIXME make threadsafe
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];
+ static unsigned char numbuf[65536]; // FIXME make threadsafe
size_t count = sizeof(numbuf);
if(!d0_iobuf_read_packet(buf, numbuf, &count))
return NULL;
mp_int z;
};
-static d0_bignum_t temp;
+static d0_bignum_t temp; // FIXME make threadsafe
#include <stdio.h>
D0_BOOL d0_iobuf_write_bignum(d0_iobuf_t *buf, const d0_bignum_t *bignum)
{
- static unsigned char numbuf[65536];
+ static unsigned char numbuf[65536]; // FIXME make threadsafe
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];
+ static unsigned char numbuf[65536]; // FIXME make threadsafe
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];
+ static char str[65536]; // FIXME make threadsafe
mp_toradix_n((mp_int *) &x->z, str, base, sizeof(str));
return str;
}
#define SHA_DIGESTSIZE 32
const char *sha(const unsigned char *in, size_t len)
{
- static char h[32];
+ char h[32];
d0_blind_id_util_sha256(h, (const char *) in, len);
return h;
}
#define USING(x) if(!(ctx->x)) return 0
#define REPLACING(x)
-static d0_bignum_t *zero, *one, *four, *temp0, *temp1, *temp2, *temp3, *temp4;
+static d0_bignum_t *zero, *one, *four;
+static d0_bignum_t *temp0, *temp1, *temp2, *temp3, *temp4; // FIXME make these thread safe by putting them in some per-thread object
D0_WARN_UNUSED_RESULT D0_BOOL d0_blind_id_INITIALIZE(void)
{
D0_WARN_UNUSED_RESULT D0_BOOL d0_longhash_bignum(const d0_bignum_t *in, unsigned char *outbuf, size_t outbuflen)
{
- static unsigned char convbuf[1024];
+ 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;
- static unsigned char convbuf[2048];
+ 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;
- static unsigned char shabuf[2048];
+ 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;
- static unsigned char convbuf[1024];
+ 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;
- static unsigned char shabuf[2048];
+ 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;
- static unsigned char convbuf[1024];
+ 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;
- static unsigned char shabuf[2048];
+ 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;
- static unsigned char shabuf[2048];
+ 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;
- static unsigned char shabuf[2048];
+ 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;
- static unsigned char convbuf[1024];
+ unsigned char convbuf[1024];
d0_iobuf_t *conv = NULL;
size_t sz, n;