aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/random.c')
-rw-r--r--cipher/random.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/cipher/random.c b/cipher/random.c
index b63416134..7549517b3 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -284,6 +284,18 @@ randomize_buffer( byte *buffer, size_t length, int level )
}
+/* Randomize the MPI by setting it to NBITS of random of quality LEVEL. */
+void
+randomize_mpi (MPI mpi, size_t nbits, int level)
+{
+ unsigned char *buffer;
+
+ buffer = get_random_bits (nbits, level, mpi_is_secure (mpi));
+ mpi_set_buffer (mpi, buffer, (nbits+7)/8, 0);
+ xfree (buffer);
+}
+
+
int
random_is_faked()
{