From: Rudolf Polzer Date: Fri, 29 Apr 2011 11:59:17 +0000 (+0200) Subject: add a check debugger X-Git-Tag: xonotic-v0.5.0~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=43039e6c0e00db3ce3e2c11da5e1616aeecdc049;p=xonotic%2Fd0_blind_id.git add a check debugger --- diff --git a/d0_bignum-tommath.c b/d0_bignum-tommath.c index 71954a2..966bd05 100644 --- a/d0_bignum-tommath.c +++ b/d0_bignum-tommath.c @@ -404,6 +404,8 @@ D0_BOOL d0_bignum_mod_inv(d0_bignum_t *r, const d0_bignum_t *a, const d0_bignum_ int d0_bignum_isprime(d0_bignum_t *r, int param) { int ret = 0; + if(param < 1) + param = 1; mp_prime_is_prime(&r->z, param, &ret); return ret; } diff --git a/d0_blind_id.c b/d0_blind_id.c index ceda636..bc61029 100644 --- a/d0_blind_id.c +++ b/d0_blind_id.c @@ -97,10 +97,15 @@ struct d0_blind_id_s size_t msglen; // message length }; +#define CHECKDEBUG + +#ifdef CHECKDEBUG +#define CHECK(x) do { if(!(x)) { fprintf(stderr, "CHECK FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); goto fail; } } while(0) +#define CHECK_ASSIGN(var, value) do { d0_bignum_t *val; val = value; if(!val) { fprintf(stderr, "CHECK FAILED (%s:%d): %s\n", __FILE__, __LINE__, #value); goto fail; } var = val; } while(0) +#else #define CHECK(x) do { if(!(x)) goto fail; } while(0) #define CHECK_ASSIGN(var, value) do { d0_bignum_t *val; val = value; if(!val) goto fail; var = val; } while(0) -#define MPCHECK(x) do { if(!failed) if(!(x)) failed = 1; } while(0) -#define MPCHECK_ASSIGN(var, value) do { if(!failed) { d0_bignum_t *val; val = value; if(val) var = val; else failed = 1; } } while(0) +#endif #define USING(x) if(!(ctx->x)) return 0 #define REPLACING(x)