From e6d8db0f41ebed6a3fbb29faca8b42156161f3ad Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Sun, 9 Aug 2020 23:41:40 -0400 Subject: [PATCH] Change the tinycrypt return values to be below 256 Thanks to this change the produced ASM does not need an additional instruction to place the constant value in a register, but can compare it directly. Signed-off-by: Andrzej Kurek --- include/tinycrypt/ecc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tinycrypt/ecc.h b/include/tinycrypt/ecc.h index 4c20729ac..f2a5ad67d 100644 --- a/include/tinycrypt/ecc.h +++ b/include/tinycrypt/ecc.h @@ -85,9 +85,9 @@ extern "C" { /* Return values for functions, chosen with large Hamming distances between * them (especially to SUCESS) to mitigate the impact of fault injection * attacks flipping a low number of bits. */ -#define UECC_SUCCESS 0x00FFAAAA -#define UECC_FAILURE 0x75555555 -#define UECC_FAULT_DETECTED 0x7aaaaaaa +#define UECC_SUCCESS 0xCD +#define UECC_FAILURE 0x52 +#define UECC_FAULT_DETECTED 0x3B /* Word size (4 bytes considering 32-bits architectures) */ #define uECC_WORD_SIZE 4