summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sexp2dsa.c8
-rw-r--r--sexp2rsa.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/sexp2dsa.c b/sexp2dsa.c
index e7731cc6..357b3cf8 100644
--- a/sexp2dsa.c
+++ b/sexp2dsa.c
@@ -35,8 +35,12 @@
#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.
*
diff --git a/sexp2rsa.c b/sexp2rsa.c
index 85111408..c5795db3 100644
--- a/sexp2rsa.c
+++ b/sexp2rsa.c
@@ -35,8 +35,12 @@
#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.
*