Skip to content

Commit d71485a

Browse files
committed
Use WOLFHSM_CFG_TEST_POSIX in key wrap demo
The key wrap demo uses posixFlashFile callbacks and structs. This must only be compiled in when WOLFHSM_CFG_TEST_POSIX is enabled.
1 parent d44efb6 commit d71485a

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

examples/demo/client/wh_demo_client_all.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ int wh_DemoClient_All(whClientContext* clientContext)
4646
}
4747
#endif
4848

49+
#ifdef WOLFHSM_CFG_TEST_POSIX
4950
#ifdef WOLFHSM_CFG_KEYWRAP
5051
rc = wh_DemoClient_KeyWrap(clientContext);
5152
if (rc != 0) {
5253
return rc;
5354
}
5455
#endif /* WOLFHSM_CFG_KEYWRAP */
56+
#endif /* WOLFHSM_CFG_TEST_POSIX */
5557

5658
/**Crypto demos */
5759
#ifndef NO_RSA

examples/demo/client/wh_demo_client_keywrap.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
#include "wolfssl/wolfcrypt/aes.h"
3232
#include "wolfssl/wolfcrypt/random.h"
3333

34-
#include "port/posix/posix_flash_file.h"
3534

3635
#include "wh_demo_client_keywrap.h"
3736
#include "test/wh_test_keywrap.h"
3837

38+
#ifdef WOLFHSM_CFG_TEST_POSIX
39+
#include "port/posix/posix_flash_file.h"
40+
3941
#ifdef WOLFHSM_CFG_KEYWRAP
4042

4143
int wh_DemoClient_KeyWrap(whClientContext* client)
@@ -44,8 +46,7 @@ int wh_DemoClient_KeyWrap(whClientContext* client)
4446

4547
/* file-based flash state and configuration */
4648
posixFlashFileContext flashFileCtx;
47-
posixFlashFileConfig flashFileCfg = {.filename = "flashFile",
48-
.partition_size = 1024 * 1024,
49+
posixFlashFileConfig flashFileCfg = {.partition_size = 1024 * 1024,
4950
.erased_byte = 0xff};
5051
whFlashCb flashFileCb[1] = {POSIX_FLASH_FILE_CB};
5152

@@ -86,3 +87,4 @@ int wh_DemoClient_KeyWrap(whClientContext* client)
8687
return ret;
8788
}
8889
#endif /* WOLFHSM_CFG_KEYWRAP */
90+
#endif /* WOLFHSM_CFG_TEST_POSIX */

examples/posix/wh_posix_client/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ SRC_C += $(wildcard $(WOLFSSL_DIR)/wolfcrypt/benchmark/*.c)
106106
SRC_C += $(wildcard $(WOLFHSM_DIR)/src/*.c)
107107

108108
# wolfHSM test code
109-
SRC_C += $(wildcard $(WOLFHSM_DIR)/test/wh_test_keywrap.c)
109+
SRC_C += $(WOLFHSM_DIR)/test/wh_test_keywrap.c
110110

111111
# wolfHSM port/HAL code
112112
SRC_C += $(wildcard $(WOLFHSM_PORT_DIR)/*.c)

examples/posix/wh_posix_client/wolfhsm_cfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
#define WOLFHSM_CFG_HEXDUMP
3131
#define WOLFHSM_CFG_COMM_DATA_LEN 5000
3232
#define WOLFHSM_CFG_KEYWRAP
33+
#define WOLFHSM_CFG_TEST_POSIX
3334

3435
#endif /* WOLFHSM_CFG_H_ */

0 commit comments

Comments
 (0)