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;
}
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)