Skip to content

Commit

Permalink
configurable KEYSTORE_PUBKEY_SIZE_ML_DSA.
Browse files Browse the repository at this point in the history
  • Loading branch information
philljj committed Sep 22, 2024
1 parent 144de50 commit 2a892e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
18 changes: 17 additions & 1 deletion config/examples/sim-ml-dsa.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,29 @@ ARCH=sim
TARGET=sim
SIGN?=ML_DSA
HASH?=SHA256
ML_DSA_LEVEL=2
WOLFBOOT_SMALL_STACK=0
SPI_FLASH=0
DEBUG=0
DELTA_UPDATES=0

#
# ML-DSA config examples:
#
# Category 2:
ML_DSA_LEVEL=2
IMAGE_SIGNATURE_SIZE=2420
IMAGE_HEADER_SIZE?=4840
#
# Category 3:
# ML_DSA_LEVEL=3
# IMAGE_SIGNATURE_SIZE=3309
# IMAGE_HEADER_SIZE?=6618
#
# Category 5:
# ML_DSA_LEVEL=5
# IMAGE_SIGNATURE_SIZE=4627
# IMAGE_HEADER_SIZE?=9254
#

# sizes should be multiple of system page size
WOLFBOOT_PARTITION_SIZE=0x40000
Expand Down
10 changes: 9 additions & 1 deletion include/wolfboot/wolfboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ extern "C" {
#define KEYSTORE_PUBKEY_SIZE_XMSS 68
/* ML-DSA pub key size is a function of parameters.
* This needs to be configurable. */
#define KEYSTORE_PUBKEY_SIZE_ML_DSA 1312
#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

/* Mask for key permissions */
#define KEY_VERIFY_ALL (0xFFFFFFFFU)
Expand Down

0 comments on commit 2a892e8

Please sign in to comment.