24 if ((a != NULL) && (b != NULL) && (len > 0U)) {
26 for (
size_t i = 0U; i < len; i++) {
38 if ((buf != NULL) && (len > 0U)) {
39 volatile uint8_t* p = buf;
40 for (
size_t i = 0U; i < len; i++) {
51 const uint8_t* src,
size_t count) {
53 if ((dst != NULL) && (src != NULL) && (count > 0U) && (count <= dstSize)) {
54 bool overlap = (dst < (src + count)) && (src < (dst + dstSize));
56 memcpy(dst, src, count);
Platform-independent security and memory utilities.
static bool safe_memcpy(uint8_t *dst, size_t dstSize, const uint8_t *src, size_t count)
Safe memcpy — validates pointers, sizes, and checks for overlap.
static bool secure_compare(const uint8_t *a, const uint8_t *b, size_t len)
Constant-time buffer comparison, resistant to timing side-channel attacks.
static void secure_wipe(uint8_t *buf, size_t len)
Securely zero a buffer, guaranteed not to be optimised away.