]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(nettle_mpz_set_sexp): Use
authorNiels Möller <nisse@lysator.liu.se>
Fri, 15 Nov 2002 08:03:26 +0000 (09:03 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Fri, 15 Nov 2002 08:03:26 +0000 (09:03 +0100)
nettle_mpz_set_str_256_s, to handle negative numbers correctly.

Rev: src/nettle/sexp2bignum.c:1.2

sexp2bignum.c

index e3c8d7643ea8959e2bd956b31eb499ee1de2c378..69757cee98ffa7b09e377368f6b1faabcb55c1e1 100644 (file)
@@ -35,12 +35,13 @@ int
 nettle_mpz_set_sexp(mpz_t x, unsigned limit, const struct sexp_iterator *i)
 {
   if (i->type == SEXP_ATOM
+      && i->atom_length
       && !i->display)
     {
       if (limit && (8 * i->atom_length > limit))
        return 0;
       
-      nettle_mpz_set_str_256(x, i->atom_length, i->atom);
+      nettle_mpz_set_str_256_s(x, i->atom_length, i->atom);
       return !limit || mpz_sizeinbase(x, 2) <= limit;
     }
   else