From e2bbf175a2184bd76f6c54ccf8456babeb1a46fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 9 Apr 2024 15:16:35 +0200 Subject: Adding upstream version 9.1. Signed-off-by: Daniel Baumann --- lib/explicit_bzero.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/explicit_bzero.c (limited to 'lib/explicit_bzero.c') diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c new file mode 100644 index 0000000..fa64ed8 --- /dev/null +++ b/lib/explicit_bzero.c @@ -0,0 +1,39 @@ +/* + * Public domain. + * Written by Matthew Dempsky. + * Adapted for frr. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#ifndef HAVE_EXPLICIT_BZERO +#undef explicit_bzero + + +void explicit_bzero(void *buf, size_t len); +__attribute__((__weak__)) void +__explicit_bzero_hook(void *buf, size_t len); + +__attribute__((__weak__)) void +__explicit_bzero_hook(void *buf, size_t len) +{ +} + +#if defined(__clang__) +#pragma clang optimize off +#else +#pragma GCC optimize("00") +#endif + +void +explicit_bzero(void *buf, size_t len) +{ + memset(buf, 0, len); + __explicit_bzero_hook(buf, len); +} + +#endif -- cgit v1.2.3