Skip to content

Commit 2c04fcc

Browse files
committed
Buffer size fixes
1 parent 8d1b570 commit 2c04fcc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/wh_client_crypto.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5474,7 +5474,7 @@ int wh_Client_MlDsaImportKey(whClientContext* ctx, MlDsaKey* key,
54745474
{
54755475
int ret = WH_ERROR_OK;
54765476
whKeyId key_id = WH_KEYID_ERASED;
5477-
byte buffer[DILITHIUM_MAX_PRV_KEY_SIZE];
5477+
byte buffer[DILITHIUM_MAX_BOTH_KEY_DER_SIZE];
54785478
uint16_t buffer_len = 0;
54795479

54805480
if ((ctx == NULL) || (key == NULL) ||
@@ -5511,7 +5511,7 @@ int wh_Client_MlDsaExportKey(whClientContext* ctx, whKeyId keyId, MlDsaKey* key,
55115511
{
55125512
int ret = WH_ERROR_OK;
55135513
/* buffer cannot be larger than MTU */
5514-
byte buffer[DILITHIUM_MAX_PRV_KEY_SIZE];
5514+
byte buffer[DILITHIUM_MAX_BOTH_KEY_DER_SIZE];
55155515
uint16_t buffer_len = sizeof(buffer);
55165516

55175517
if ((ctx == NULL) || WH_KEYID_ISERASED(keyId) || (key == NULL)) {
@@ -5965,7 +5965,7 @@ int wh_Client_MlDsaImportKeyDma(whClientContext* ctx, MlDsaKey* key,
59655965
{
59665966
int ret = WH_ERROR_OK;
59675967
whKeyId key_id = WH_KEYID_ERASED;
5968-
byte buffer[DILITHIUM_MAX_PRV_KEY_SIZE];
5968+
byte buffer[DILITHIUM_MAX_BOTH_KEY_DER_SIZE];
59695969
uint16_t buffer_len = 0;
59705970

59715971
if ((ctx == NULL) || (key == NULL) ||
@@ -5997,7 +5997,7 @@ int wh_Client_MlDsaExportKeyDma(whClientContext* ctx, whKeyId keyId,
59975997
uint8_t* label)
59985998
{
59995999
int ret = WH_ERROR_OK;
6000-
byte buffer[DILITHIUM_MAX_PRV_KEY_SIZE] = {0};
6000+
byte buffer[DILITHIUM_MAX_BOTH_KEY_DER_SIZE] = {0};
60016001
uint16_t buffer_len = sizeof(buffer);
60026002

60036003
if ((ctx == NULL) || WH_KEYID_ISERASED(keyId) || (key == NULL)) {
@@ -6021,7 +6021,7 @@ static int _MlDsaMakeKeyDma(whClientContext* ctx, int level,
60216021
{
60226022
int ret = WH_ERROR_OK;
60236023
whKeyId key_id = WH_KEYID_ERASED;
6024-
byte buffer[DILITHIUM_MAX_PRV_KEY_SIZE];
6024+
byte buffer[DILITHIUM_MAX_BOTH_KEY_DER_SIZE];
60256025
uint8_t* dataPtr = NULL;
60266026
whMessageCrypto_MlDsaKeyGenDmaRequest* req = NULL;
60276027
whMessageCrypto_MlDsaKeyGenDmaResponse* res = NULL;

test/config/wolfhsm_cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/* #define WOLFHSM_CFG_NO_CRYPTO */
3434
/* #define WOLFHSM_CFG_SHE_EXTENSION */
3535

36-
#define WOLFHSM_CFG_COMM_DATA_LEN (1280 * 4)
36+
#define WOLFHSM_CFG_COMM_DATA_LEN (1024 * 8)
3737

3838
/* Enable global keys feature for testing */
3939
#define WOLFHSM_CFG_GLOBAL_KEYS

test/wh_test_wolfcrypt_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
#endif
7171

7272

73-
#define BUFFER_SIZE 4096
73+
#define BUFFER_SIZE (1024 * 8)
7474
#define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */
7575

7676
#if defined(WOLFHSM_CFG_ENABLE_CLIENT) && !defined(NO_CRYPT_TEST)

0 commit comments

Comments
 (0)