2026-06-19 03:57:13 +00:00
|
|
|
/* memset_explicit shim for Windows MinGW
|
|
|
|
|
*
|
|
|
|
|
* libsodium-sys-stable expects memset_explicit which isn't available
|
|
|
|
|
* in the MinGW runtime. This provides a compatible implementation.
|
|
|
|
|
*/
|
2026-06-14 04:36:54 +00:00
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2026-06-19 04:32:09 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
#define EXPORT __declspec(dllexport)
|
|
|
|
|
#else
|
|
|
|
|
#define EXPORT
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
EXPORT void memset_explicit(void *dest, int val, size_t n) {
|
2026-06-19 03:57:13 +00:00
|
|
|
volatile unsigned char *p = (volatile unsigned char *)dest;
|
2026-06-14 04:36:54 +00:00
|
|
|
while (n--) {
|
2026-06-19 03:57:13 +00:00
|
|
|
*p++ = (unsigned char)val;
|
2026-06-14 04:36:54 +00:00
|
|
|
}
|
|
|
|
|
}
|