Commit 2a0021a447abef9b970e903e22d136b856900dce

Daniel Mendler 2019-05-08T14:57:04

mp_rand: remove superflous mp_clamp

diff --git a/bn_mp_rand.c b/bn_mp_rand.c
index 9e85895..bdcc0cf 100644
--- a/bn_mp_rand.c
+++ b/bn_mp_rand.c
@@ -206,7 +206,6 @@ int mp_rand(mp_int *a, int digits)
       a->dp[i] &= MP_MASK;
    }
 
-   mp_clamp(a);
    return MP_OKAY;
 }
 #endif
diff --git a/callgraph.txt b/callgraph.txt
index 47e77db..000409a 100644
--- a/callgraph.txt
+++ b/callgraph.txt
@@ -7378,7 +7378,6 @@ BN_MP_PRIME_IS_PRIME_C
 +--->BN_MP_RAND_C
 |   +--->BN_MP_ZERO_C
 |   +--->BN_MP_GROW_C
-|   +--->BN_MP_CLAMP_C
 +--->BN_MP_DIV_2D_C
 |   +--->BN_MP_COPY_C
 |   |   +--->BN_MP_GROW_C
@@ -9967,7 +9966,6 @@ BN_MP_PRIME_NEXT_PRIME_C
 |   +--->BN_MP_RAND_C
 |   |   +--->BN_MP_ZERO_C
 |   |   +--->BN_MP_GROW_C
-|   |   +--->BN_MP_CLAMP_C
 |   +--->BN_MP_DIV_2D_C
 |   |   +--->BN_MP_COPY_C
 |   |   |   +--->BN_MP_GROW_C
@@ -11764,7 +11762,6 @@ BN_MP_PRIME_RANDOM_EX_C
 |   +--->BN_MP_RAND_C
 |   |   +--->BN_MP_ZERO_C
 |   |   +--->BN_MP_GROW_C
-|   |   +--->BN_MP_CLAMP_C
 |   +--->BN_MP_DIV_2D_C
 |   |   +--->BN_MP_COPY_C
 |   |   |   +--->BN_MP_GROW_C
@@ -12160,7 +12157,6 @@ BN_MP_RADIX_SMAP_C
 BN_MP_RAND_C
 +--->BN_MP_ZERO_C
 +--->BN_MP_GROW_C
-+--->BN_MP_CLAMP_C
 
 
 BN_MP_READ_RADIX_C
diff --git a/tommath_class.h b/tommath_class.h
index 85cb105..e96ff6f 100644
--- a/tommath_class.h
+++ b/tommath_class.h
@@ -764,7 +764,6 @@
 #   define BN_MP_RAND_DIGIT_C
 #   define BN_MP_ZERO_C
 #   define BN_MP_GROW_C
-#   define BN_MP_CLAMP_C
 #endif
 
 #if defined(BN_MP_READ_RADIX_C)