aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-24 15:33:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-24 15:33:32 -0400
commit14d4cc08832efb724e58944ba2ac22e2ca3143dc (patch)
treefebca1365a5306d5a44b2481ec41f13f4c2defc2 /drivers
parent1c45d9a920e6ef4fce38921e4fc776c2abca3197 (diff)
parent7185ad2672a7d50bc384de0e38d90b75d99f3d82 (diff)
Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Pull /dev/random updates from Ted Ts'o: "This adds a memzero_explicit() call which is guaranteed not to be optimized away by GCC. This is important when we are wiping cryptographically sensitive material" * tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random: crypto: memzero_explicit - make sure to clear out sensitive data random: add and use memzero_explicit() for clearing data
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/random.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 82759cef9043..04645c09fe5e 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1106,7 +1106,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
1106 __mix_pool_bytes(r, hash.w, sizeof(hash.w)); 1106 __mix_pool_bytes(r, hash.w, sizeof(hash.w));
1107 spin_unlock_irqrestore(&r->lock, flags); 1107 spin_unlock_irqrestore(&r->lock, flags);
1108 1108
1109 memset(workspace, 0, sizeof(workspace)); 1109 memzero_explicit(workspace, sizeof(workspace));
1110 1110
1111 /* 1111 /*
1112 * In case the hash function has some recognizable output 1112 * In case the hash function has some recognizable output
@@ -1118,7 +1118,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
1118 hash.w[2] ^= rol32(hash.w[2], 16); 1118 hash.w[2] ^= rol32(hash.w[2], 16);
1119 1119
1120 memcpy(out, &hash, EXTRACT_SIZE); 1120 memcpy(out, &hash, EXTRACT_SIZE);
1121 memset(&hash, 0, sizeof(hash)); 1121 memzero_explicit(&hash, sizeof(hash));
1122} 1122}
1123 1123
1124/* 1124/*
@@ -1175,7 +1175,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
1175 } 1175 }
1176 1176
1177 /* Wipe data just returned from memory */ 1177 /* Wipe data just returned from memory */
1178 memset(tmp, 0, sizeof(tmp)); 1178 memzero_explicit(tmp, sizeof(tmp));
1179 1179
1180 return ret; 1180 return ret;
1181} 1181}
@@ -1218,7 +1218,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
1218 } 1218 }
1219 1219
1220 /* Wipe data just returned from memory */ 1220 /* Wipe data just returned from memory */
1221 memset(tmp, 0, sizeof(tmp)); 1221 memzero_explicit(tmp, sizeof(tmp));
1222 1222
1223 return ret; 1223 return ret;
1224} 1224}