From 1d4602a579e612de92312684d5c2933eaf46685d Mon Sep 17 00:00:00 2001 From: jordan Date: Sun, 22 Sep 2024 00:39:03 -0500 Subject: [PATCH] don't break everything. --- include/wolfboot/wolfboot.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/include/wolfboot/wolfboot.h b/include/wolfboot/wolfboot.h index 5cba91285..3140c0e2a 100644 --- a/include/wolfboot/wolfboot.h +++ b/include/wolfboot/wolfboot.h @@ -128,16 +128,21 @@ extern "C" { #define KEYSTORE_PUBKEY_SIZE_LMS 60 #define KEYSTORE_PUBKEY_SIZE_XMSS 68 /* ML-DSA pub key size is a function of parameters. - * This needs to be configurable. */ - #if ML_DSA_LEVEL == 2 - #define KEYSTORE_PUBKEY_SIZE_ML_DSA 1312 - #elif ML_DSA_LEVEL == 3 - #define KEYSTORE_PUBKEY_SIZE_ML_DSA 1952 - #elif ML_DSA_LEVEL == 5 - #define KEYSTORE_PUBKEY_SIZE_ML_DSA 2592 + * This needs to be configurable. Default to security + * category 2. */ + #ifdef ML_DSA_LEVEL + #if ML_DSA_LEVEL == 2 + #define KEYSTORE_PUBKEY_SIZE_ML_DSA 1312 + #elif ML_DSA_LEVEL == 3 + #define KEYSTORE_PUBKEY_SIZE_ML_DSA 1952 + #elif ML_DSA_LEVEL == 5 + #define KEYSTORE_PUBKEY_SIZE_ML_DSA 2592 + #else + #error "Invalid ML_DSA_LEVEL!" + #endif #else - #error "Invalid ML_DSA_LEVEL!" - #endif + #define KEYSTORE_PUBKEY_SIZE_ML_DSA 1312 + #endif /* ML_DSA_LEVEL */ /* Mask for key permissions */ #define KEY_VERIFY_ALL (0xFFFFFFFFU)