]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
updated the prototype of _gnutls_mpi_div
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 26 Jan 2014 09:42:42 +0000 (10:42 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 26 Jan 2014 09:42:42 +0000 (10:42 +0100)
lib/auth/srp.c
lib/crypto-backend.h
lib/nettle/mpi.c

index dcbb7edd7f2c72754e0fcefeb497118a4e51d36e..418469dd73aa419f981177320328907f5fcb81e9 100644 (file)
@@ -753,7 +753,11 @@ group_check_g_n(gnutls_session_t session, bigint_t g, bigint_t n)
                goto error;
        }
 
-       _gnutls_mpi_div(q, q, two);
+       ret = _gnutls_mpi_div(q, q, two);
+       if (ret < 0) {
+               gnutls_assert();
+               goto error;
+       }
 
        if (_gnutls_prime_check(q) != 0) {
                /* N was not on the form N=2q+1, where q = prime
index 6627a9f68a61071f468437cbb83dff8484a1bcd9..42f83635e13e4ad2a4ea0a27ce7748ab656604fa 100644 (file)
@@ -152,7 +152,7 @@ typedef struct gnutls_crypto_bigint {
        int (*bigint_mul_ui) (bigint_t w, const bigint_t a,
                                   unsigned long b);
        /* q = a / b */
-        bigint_t(*bigint_div) (bigint_t q, const bigint_t a,
+       int (*bigint_div) (bigint_t q, const bigint_t a,
                                const bigint_t b);
        /* 0 if prime */
        int (*bigint_prime_check) (const bigint_t pp);
index d0a9221a665eee42d729b8a47741cf1dd2d2ac88..f8bb6dc135bade97824391cd4416f49a5a62f553 100644 (file)
@@ -354,20 +354,12 @@ int ret;
 }
 
 /* q = a / b */
-static bigint_t
+static int
 wrap_nettle_mpi_div(bigint_t q, const bigint_t a, const bigint_t b)
 {
-int ret;
-
-       if (q == NULL) {
-               ret = wrap_nettle_mpi_init(&q);
-               if (ret < 0)
-                       return NULL;
-       }
-
        mpz_cdiv_q(TOMPZ(q), TOMPZ(a), TOMPZ(b));
 
-       return q;
+       return 0;
 }
 
 static int