From 745893f9e0781ccc650dac337249903a3b4d8a5f Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 28 Nov 2024 11:30:17 +0100 Subject: [PATCH] fixup! feat(core): introduce storage insecure mode --- storage/storage.c | 1 - storage/storage_utils.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/storage/storage.c b/storage/storage.c index 97c5fbf76d..e3c54dadb0 100644 --- a/storage/storage.c +++ b/storage/storage.c @@ -87,7 +87,6 @@ const uint32_t V0_PIN_EMPTY = 1; #define MAX_WIPE_CODE_LEN 50 #if STORAGE_INSECURE_TESTING_MODE && !PRODUCTION -#pragma message("STORAGE IS INSECURE DO NOT USE THIS IN PRODUCTION") #define PIN_ITER_COUNT 1 #else // The total number of iterations to use in PBKDF2. diff --git a/storage/storage_utils.h b/storage/storage_utils.h index f34e8e3edf..b6e12757b7 100644 --- a/storage/storage_utils.h +++ b/storage/storage_utils.h @@ -2,3 +2,15 @@ #include uint32_t hamming_weight(uint32_t value); + +#ifndef STORAGE_INSECURE_TESTING_MODE +#define STORAGE_INSECURE_TESTING_MODE 0 +#endif + +#if STORAGE_INSECURE_TESTING_MODE +#if PRODUCTION +#error "STORAGE_INSECURE_TESTING_MODE can't be used in production" +#else +#pragma message("STORAGE IS INSECURE DO NOT USE THIS IN PRODUCTION") +#endif +#endif