]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Adopt mp_bitcnt_t type.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 28 Apr 2025 18:23:52 +0000 (20:23 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 28 Apr 2025 18:23:52 +0000 (20:23 +0200)
ChangeLog
bignum-random-prime.c
ecc-mod-inv.c
ecc-mul-a-eh.c
ecc-mul-a.c
ecc-mul-g-eh.c
ecc-mul-g.c
eccdata.c

index a2d1bce40fb1e0536719dea6025603a51c5783b2..fcfd57cae5c67c0b9edb9cdaaec81d315aa1a7af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2025-04-28  Niels Möller  <nisse@lysator.liu.se>
 
+       * bignum-random-prime.c (miller_rabin_pocklington): Adopt
+       mp_bitcnt_t type.
+       * ecc-mod-inv.c (ecc_mod_inv): Likewise.
+       * ecc-mul-a-eh.c (ecc_mul_a_eh): Likewise.
+       * ecc-mul-a.c (ecc_mul_a): Likewise.
+       * ecc-mul-g-eh.c (ecc_mul_g_eh): Likewise.
+       * ecc-mul-g.c (ecc_mul_g): Likewise.
+       * eccdata.c (ecc_mul_binary): Likewise.
+
        * sha.h: Deleted file.
        * nettle.texinfo: Delete all mention of sha.h.
        * Makefile.in (HEADERS): Delete sha.h.
index 48d9c0acbabf3644175cbb16cceca550ce593f51..aa41ac2170d565da31da5d7ac6658e093165c849 100644 (file)
@@ -184,10 +184,7 @@ miller_rabin_pocklington(mpz_t n, mpz_t nm1, mpz_t nm1dq, mpz_t a)
   mpz_t y;
   int is_prime = 0;
 
-  /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-     versions. */
-  unsigned k;
-  unsigned j;
+  mp_bitcnt_t k, j;
 
   VERBOSE(".");
 
index 5d1f84759ad2c533bfef53cb1adf3adc423babfc..8da08c09799d41b31279b08085b7cabf8e9e7507 100644 (file)
@@ -73,9 +73,7 @@ ecc_mod_inv (const struct ecc_modulo *m,
 #define up (scratch + 2*n)
 
   mp_size_t n = m->size;
-  /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-     versions. */  
-  unsigned i;
+  mp_bitcnt_t i;
 
   /* Maintain
 
index 30130aeab5a15338c4a0b0af97020d580f60ad68..bdccb0d8cd5ee4a2e68616f1c8ee89eaf73c3e25 100644 (file)
@@ -119,10 +119,8 @@ ecc_mul_a_eh (const struct ecc_curve *ecc,
 #define table (scratch + 3*ecc->p.size)
   mp_limb_t *scratch_out = table + (3*ecc->p.size << ECC_MUL_A_EH_WBITS);
 
-  /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-     versions. */
-  unsigned blocks = (ecc->p.bit_size + ECC_MUL_A_EH_WBITS - 1) / ECC_MUL_A_EH_WBITS;
-  unsigned bit_index = (blocks-1) * ECC_MUL_A_EH_WBITS;
+  mp_bitcnt_t blocks = (ecc->p.bit_size + ECC_MUL_A_EH_WBITS - 1) / ECC_MUL_A_EH_WBITS;
+  mp_bitcnt_t bit_index = (blocks-1) * ECC_MUL_A_EH_WBITS;
 
   mp_size_t limb_index = bit_index / GMP_NUMB_BITS;
   unsigned shift = bit_index % GMP_NUMB_BITS;
index cc2a7960a1395abd8919d04717999efffb3d9af4..08f5fbd1a0b82a47d6b64bb56b2964e15fcab29d 100644 (file)
@@ -125,10 +125,8 @@ ecc_mul_a (const struct ecc_curve *ecc,
   mp_limb_t *scratch_out = table + (3*ecc->p.size << ECC_MUL_A_WBITS);
   int is_zero = 0;
 
-  /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-     versions. */
-  unsigned blocks = (ecc->p.bit_size + ECC_MUL_A_WBITS - 1) / ECC_MUL_A_WBITS;
-  unsigned bit_index = (blocks-1) * ECC_MUL_A_WBITS;
+  mp_bitcnt_t blocks = (ecc->p.bit_size + ECC_MUL_A_WBITS - 1) / ECC_MUL_A_WBITS;
+  mp_bitcnt_t bit_index = (blocks-1) * ECC_MUL_A_WBITS;
 
   mp_size_t limb_index = bit_index / GMP_NUMB_BITS;
   unsigned shift = bit_index % GMP_NUMB_BITS;
index 57df1c6d08e4bcd913f92de2513ddc21a415ac97..a4ddf1f94a231e5b9c34fcdaa937b83b19ccde86 100644 (file)
@@ -68,9 +68,7 @@ ecc_mul_g_eh (const struct ecc_curve *ecc, mp_limb_t *r,
       for (j = 0; j * c < bit_rows; j++)
        {
          unsigned bits;
-         /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-            versions. */
-         unsigned bit_index;
+         mp_bitcnt_t bit_index;
          
          /* Extract c bits from n, stride k, starting at i + kcj,
             ending at i + k (cj + c - 1)*/
index 97bbabad6dd0a4393312d7d671ee108032337a14..4cc89ba4cb947ef31543f21bb0073740efc9458e 100644 (file)
@@ -69,9 +69,7 @@ ecc_mul_g (const struct ecc_curve *ecc, mp_limb_t *r,
       for (j = 0; j * c < bit_rows; j++)
        {
          unsigned bits;
-         /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-            versions. */
-         unsigned bit_index;
+         mp_bitcnt_t bit_index;
          int bits_is_zero;
 
          /* Extract c bits from n, stride k, starting at i + kcj,
index 3f8e3f13d6530eaf1552bdcd24a321cd870ce4a3..ae982ee2ca100e5259809d3136e81d452b349d00 100644 (file)
--- a/eccdata.c
+++ b/eccdata.c
@@ -368,9 +368,7 @@ static void
 ecc_mul_binary (const struct ecc_curve *ecc,
                struct ecc_point *r, const mpz_t n, const struct ecc_point *p)
 {
-  /* Avoid the mp_bitcnt_t type for compatibility with older GMP
-     versions. */
-  unsigned k;
+  mp_bitcnt_t k;
 
   assert (r != p);
   assert (mpz_sgn (n) > 0);