]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Do an smemclr(bytes) in bignum_random_in_range.
authorSimon Tatham <anakin@pobox.com>
Sat, 20 Dec 2014 18:44:36 +0000 (18:44 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 20 Dec 2014 18:51:42 +0000 (18:51 +0000)
It's used for sensitive data, so we shouldn't leave it lying around
after free.

sshbn.c

diff --git a/sshbn.c b/sshbn.c
index 42923ac071055167d721b6c183ea2823ed5a30ea..8da7d8a00e46c7d3ad6ffc72cdbcc5e3df887eab 100644 (file)
--- a/sshbn.c
+++ b/sshbn.c
@@ -1260,6 +1260,7 @@ Bignum bignum_random_in_range(const Bignum lower, const Bignum upper)
 
         ret = bignum_from_bytes(bytes, upper_bytes);
     } while (bignum_cmp(ret, lower) < 0 || bignum_cmp(ret, upper) > 0);
+    smemclr(bytes, upper_bytes);
     sfree(bytes);
 
     return ret;