MCPcopy Create free account
hub / github.com/F-Stack/f-stack / secure_zero_memory

Function secure_zero_memory

freebsd/contrib/libb2/blake2-impl.h:132–149  ·  view source on GitHub ↗

prevents compiler optimizing out memset() */

Source from the content-addressed store, hash-verified

130
131/* prevents compiler optimizing out memset() */
132static inline void secure_zero_memory(void *v, size_t n)
133{
134#if defined(_WIN32) || defined(WIN32)
135 SecureZeroMemory(v, n);
136#else
137// prioritize first the general C11 call
138#if defined(HAVE_MEMSET_S)
139 memset_s(v, n, 0, n);
140#elif defined(HAVE_EXPLICIT_BZERO)
141 explicit_bzero(v, n);
142#elif defined(HAVE_EXPLICIT_MEMSET)
143 explicit_memset(v, 0, n);
144#else
145 memset(v, 0, n);
146 __asm__ __volatile__("" :: "r"(v) : "memory");
147#endif
148#endif
149}
150
151#endif
152

Callers 8

blake2sp_init_keyFunction · 0.85
blake2spFunction · 0.85
blake2b_init_keyFunction · 0.85
blake2s_init_keyFunction · 0.85
blake2s_init_keyFunction · 0.85
blake2bp_init_keyFunction · 0.85
blake2bpFunction · 0.85
blake2b_init_keyFunction · 0.85

Calls 2

explicit_bzeroFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected