#pragma once #include #include namespace fetchml::common { // Secure memory comparison - constant time regardless of input // Returns 0 if equal, non-zero if not equal // Timing does not depend on content of data int secure_memcmp(const void* a, const void* b, size_t len); // Secure memory clear - prevents compiler from optimizing away // Use this for clearing sensitive data like keys, passwords, etc. void secure_memzero(void* ptr, size_t len); // Safe strncpy - always null terminates, returns -1 on truncation // dst_size must include space for null terminator // Returns: 0 on success, -1 if truncation occurred int safe_strncpy(char* dst, const char* src, size_t dst_size); } // namespace fetchml::common