opnsense-src/lib/libcrypt
Robert Clausecker 1af027e583 lib/libcrypt: use explicit_bzero() to clear sensitive buffers
Prevent a potentially sufficiently smart compiler from optimising
away our attempts to clear sensitive buffers.

A related change was discussed and rejected in D16059, but I don't
believe the reasoning there applies: the code clearly documents its
intent that the `memset` calls clear sensitive buffers so they don't
hang around.  `explicit_bzero` is the appropriate function for this
purpose.  A potential performance disadvantage seems less important:
the functions in crypt are specifically designed to be slow, so a
few extra calls to guarantee that sensitive buffers are cleared does
not significantly affect runtime.

See also:	D16059
Reviewed by:	delphij, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47037

(cherry picked from commit a2c0d2026fb422ade2171da4bc6d5d2773b268a6)
2024-10-29 16:45:31 +01:00
..
tests Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
crypt-md5.c lib/libcrypt: use explicit_bzero() to clear sensitive buffers 2024-10-29 16:45:31 +01:00
crypt-nthash.c lib/libcrypt: another trivial style change 2024-09-27 20:58:19 -07:00
crypt-sha256.c lib/libcrypt: use explicit_bzero() to clear sensitive buffers 2024-10-29 16:45:31 +01:00
crypt-sha512.c lib/libcrypt: use explicit_bzero() to clear sensitive buffers 2024-10-29 16:45:31 +01:00
crypt.3 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
crypt.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
crypt.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
misc.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00