diff --git a/hw/application_fpga/fw/tk1/lib.c b/hw/application_fpga/fw/tk1/lib.c index cfe5a2f..f15d36a 100644 --- a/hw/application_fpga/fw/tk1/lib.c +++ b/hw/application_fpga/fw/tk1/lib.c @@ -5,8 +5,10 @@ #include "lib.h" #include "assert.h" + #include #include +#include void *memset(void *dest, int c, unsigned n) { @@ -52,15 +54,15 @@ void wordcpy_s(void *dest, size_t destsize, const void *src, size_t n) } } -int memeq(void *dest, const void *src, size_t n) +bool memeq(void *dest, const void *src, size_t n) { uint8_t *src_byte = (uint8_t *)src; uint8_t *dest_byte = (uint8_t *)dest; - int res = -1; + bool res = true; for (size_t i = 0; i < n; i++) { if (dest_byte[i] != src_byte[i]) { - res = 0; + res = false; } } diff --git a/hw/application_fpga/fw/tk1/lib.h b/hw/application_fpga/fw/tk1/lib.h index 2a1a608..dc7e7ff 100644 --- a/hw/application_fpga/fw/tk1/lib.h +++ b/hw/application_fpga/fw/tk1/lib.h @@ -8,11 +8,12 @@ #include #include +#include void *memset(void *dest, int c, unsigned n); void memcpy_s(void *dest, size_t destsize, const void *src, size_t n); void wordcpy_s(void *dest, size_t destsize, const void *src, size_t n); -int memeq(void *dest, const void *src, size_t n); +bool memeq(void *dest, const void *src, size_t n); void secure_wipe(void *v, size_t n); #endif