From: Niels Möller Date: Fri, 15 Nov 2002 23:24:41 +0000 (+0100) Subject: (macro GET): Check sign of parsed X-Git-Tag: nettle_1.7_release_20030311~122 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8aeecc155d3aef5dae8762ace236dd6365fb636d;p=thirdparty%2Fnettle.git (macro GET): Check sign of parsed numbers. Rev: src/nettle/sexp2dsa.c:1.2 Rev: src/nettle/sexp2rsa.c:1.9 --- diff --git a/sexp2dsa.c b/sexp2dsa.c index e7731cc6..357b3cf8 100644 --- a/sexp2dsa.c +++ b/sexp2dsa.c @@ -35,8 +35,12 @@ #include -#define GET(x, l, v) \ -do { if (!nettle_mpz_set_sexp((x), (l), (v))) return 0; } while(0) +#define GET(x, l, v) \ +do { \ + if (!nettle_mpz_set_sexp((x), (l), (v)) \ + || mpz_sgn(x) <= 0) \ + return 0; \ +} while(0) /* Iterator should point past the algorithm tag, e.g. * diff --git a/sexp2rsa.c b/sexp2rsa.c index 85111408..c5795db3 100644 --- a/sexp2rsa.c +++ b/sexp2rsa.c @@ -35,8 +35,12 @@ #include -#define GET(x, l, v) \ -do { if (!nettle_mpz_set_sexp((x), (l), (v))) return 0; } while(0) +#define GET(x, l, v) \ +do { \ + if (!nettle_mpz_set_sexp((x), (l), (v)) \ + || mpz_sgn(x) <= 0) \ + return 0; \ +} while(0) /* Iterator should point past the algorithm tag, e.g. *