]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Replace an ad-hoc buffer-clearing loop with smemclr.
authorSimon Tatham <anakin@pobox.com>
Mon, 25 Jan 2016 19:24:41 +0000 (19:24 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 25 Jan 2016 19:24:41 +0000 (19:24 +0000)
Thanks to @ch3root on Twitter for spotting it, and thanks to Chris
Emerson for bothering to let me know. I must have missed this when I
code-reviewed the ECC contribution.

sshecc.c

index 3912c5f1bd3e82ee58a032e13ead034124a1af66..d62c9b96ef6dd42ed460a56a9aac27a1d0ce1b17 100644 (file)
--- a/sshecc.c
+++ b/sshecc.c
@@ -2761,10 +2761,7 @@ void *ssh_ecdhkex_newkey(const struct ssh_kex *kex)
         bytes[31] &= 127;
         bytes[31] |= 64;
         key->privateKey = bignum_from_bytes(bytes, sizeof(bytes));
-        for (i = 0; i < sizeof(bytes); ++i)
-        {
-            ((volatile char*)bytes)[i] = 0;
-        }
+        smemclr(bytes, sizeof(bytes));
         if (!key->privateKey) {
             sfree(key);
             return NULL;