]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(macro GET): Check sign of parsed
authorNiels Möller <nisse@lysator.liu.se>
Fri, 15 Nov 2002 23:24:41 +0000 (00:24 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Fri, 15 Nov 2002 23:24:41 +0000 (00:24 +0100)
numbers.

Rev: src/nettle/sexp2dsa.c:1.2
Rev: src/nettle/sexp2rsa.c:1.9

sexp2dsa.c
sexp2rsa.c

index e7731cc6e3c44a4fd2461b3039b0b5b816853e71..357b3cf85401d05560c7ba0dceb1c3013f559df6 100644 (file)
 
 #include <string.h>
 
-#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.
  *
index 8511140849bdaadb1b8f6d34944f520d1fd17264..c5795db3d1f71bc4bee0f6738662a9dfe9c28c94 100644 (file)
 
 #include <string.h>
 
-#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.
  *