]> git.xonotic.org Git - xonotic/d0_blind_id.git/commitdiff
add a check debugger
authorRudolf Polzer <divverent@xonotic.org>
Fri, 29 Apr 2011 11:59:17 +0000 (13:59 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 29 Apr 2011 11:59:17 +0000 (13:59 +0200)
d0_bignum-tommath.c
d0_blind_id.c

index 71954a28fe387b7faba429227dc6e05dbd367a58..966bd057ecb61bda12e5542b7f0c6dc3dfd34527 100644 (file)
@@ -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;
 }
index ceda636b05c62821e8f347fa411c6047d4612f36..bc610296bd7e5be8eec9e02f6dc197724a2c9d19 100644 (file)
@@ -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)