From 657eb93c44cbf21eb2e56cba5d23835c940e4ab4 Mon Sep 17 00:00:00 2001 From: "Jason B. Cox" Date: Tue, 13 May 2025 10:36:55 -0700 Subject: [PATCH] Set cache set depending on architecture --- src/mesh/CryptoEngine.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mesh/CryptoEngine.h b/src/mesh/CryptoEngine.h index f0a214e5a..6c2c70be5 100644 --- a/src/mesh/CryptoEngine.h +++ b/src/mesh/CryptoEngine.h @@ -28,7 +28,18 @@ struct CachedSharedSecret { #define MAX_BLOCKSIZE 256 #define TEST_CURVE25519_FIELD_OPS // Exposes Curve25519::isWeakPoint() for testing keys -#define MAX_CACHED_SHARED_SECRETS 64 + +/** + * Max number of cached secrets to track. This should be roughly dependent on MAX_NUM_NODES but + * cannot be directly because it is not a constant expression. + */ +#if defined(ARCH_STM32WL) +#define MAX_CACHED_SHARED_SECRETS 2 +#elif defined(ARCH_NRF52) +#define MAX_CACHED_SHARED_SECRETS 8 +#else +#define MAX_CACHED_SHARED_SECRETS 10 +#endif class CryptoEngine {