mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 06:48:05 +01:00
Use memset_s or explicit_bzero when available.
This commit is contained in:
parent
8d6aafbb4a
commit
3783046f3b
3 changed files with 17 additions and 0 deletions
7
changes/7419
Normal file
7
changes/7419
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
o Minor enhancement (security):
|
||||||
|
- Use explicit_bzero when present
|
||||||
|
from <logan@hackers.mu>.
|
||||||
|
- Use memset_s when present
|
||||||
|
from <selven@hackers.mu>
|
||||||
|
|
||||||
|
625538405474972d627b26d7a250ea36 (:
|
|
@ -381,6 +381,7 @@ AC_CHECK_FUNCS(
|
||||||
backtrace_symbols_fd \
|
backtrace_symbols_fd \
|
||||||
clock_gettime \
|
clock_gettime \
|
||||||
eventfd \
|
eventfd \
|
||||||
|
explicit_bzero \
|
||||||
timingsafe_memcmp \
|
timingsafe_memcmp \
|
||||||
flock \
|
flock \
|
||||||
ftime \
|
ftime \
|
||||||
|
@ -399,6 +400,7 @@ AC_CHECK_FUNCS(
|
||||||
localtime_r \
|
localtime_r \
|
||||||
lround \
|
lround \
|
||||||
memmem \
|
memmem \
|
||||||
|
memset_s \
|
||||||
pipe \
|
pipe \
|
||||||
pipe2 \
|
pipe2 \
|
||||||
prctl \
|
prctl \
|
||||||
|
|
|
@ -2970,7 +2970,15 @@ memwipe(void *mem, uint8_t byte, size_t sz)
|
||||||
* ...or maybe not. In practice, there are pure-asm implementations of
|
* ...or maybe not. In practice, there are pure-asm implementations of
|
||||||
* OPENSSL_cleanse() on most platforms, which ought to do the job.
|
* OPENSSL_cleanse() on most platforms, which ought to do the job.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#ifdef HAVE_EXPLICIT_BZERO
|
||||||
|
explicit_bzero(mem, sz);
|
||||||
|
#elif HAVE_MEMSET_S
|
||||||
|
memset_s( mem, sz, 0, sz );
|
||||||
|
#else
|
||||||
OPENSSL_cleanse(mem, sz);
|
OPENSSL_cleanse(mem, sz);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Just in case some caller of memwipe() is relying on getting a buffer
|
/* Just in case some caller of memwipe() is relying on getting a buffer
|
||||||
* filled with a particular value, fill the buffer.
|
* filled with a particular value, fill the buffer.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue