mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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
This commit is contained in:
16
lib/string.c
16
lib/string.c
@@ -598,6 +598,22 @@ void *memset(void *s, int c, size_t count)
|
||||
EXPORT_SYMBOL(memset);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* memzero_explicit - Fill a region of memory (e.g. sensitive
|
||||
* keying data) with 0s.
|
||||
* @s: Pointer to the start of the area.
|
||||
* @count: The size of the area.
|
||||
*
|
||||
* memzero_explicit() doesn't need an arch-specific version as
|
||||
* it just invokes the one of memset() implicitly.
|
||||
*/
|
||||
void memzero_explicit(void *s, size_t count)
|
||||
{
|
||||
memset(s, 0, count);
|
||||
OPTIMIZER_HIDE_VAR(s);
|
||||
}
|
||||
EXPORT_SYMBOL(memzero_explicit);
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMCPY
|
||||
/**
|
||||
* memcpy - Copy one area of memory to another
|
||||
|
Reference in New Issue
Block a user