Skip to content

Commit 42e7ab6

Browse files
committed
Update Makefiles and settings for WOLFHSM_CFG_DEBUG migration
1 parent 77b0244 commit 42e7ab6

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

benchmark/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ ifeq ($(DEBUG_WOLFSSL),1)
9090
endif
9191

9292
ifeq ($(DEBUG_CRYPTOCB),1)
93-
DEF += -DDEBUG_CRYPTOCB
93+
DEF += -DWOLFHSM_CFG_DEBUG
9494
endif
9595

9696
ifeq ($(DEBUG_CRYPTOCB_VERBOSE),1)
97-
DEF += -DDEBUG_CRYPTOCB -DDEBUG_CRYPTOCB_VERBOSE
97+
DEF += -DWOLFHSM_CFG_DEBUG -DWOLFHSM_CFG_DEBUG_VERBOSE
9898
endif
9999

100100

benchmark/config/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ extern "C" {
3535
/* #define WC_NO_ASYNC_THREADING */
3636

3737
/*
38-
#define DEBUG_CRYPTOCB
39-
#define DEBUG_CRYPTOCB_VERBOSE
38+
#define WOLFHSM_CFG_DEBUG
39+
#define WOLFHSM_CFG_DEBUG_VERBOSE
4040
*/
4141

4242
/** wolfHSM required settings for wolfCrypt */

examples/posix/wh_posix_client/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#define HAVE_ANONYMOUS_INLINE_AGGREGATES 1
99
/* Optional if debugging cryptocb's */
1010
#if 0
11-
#define DEBUG_CRYPTOCB
12-
#define DEBUG_CRYPTOCB_VERBOSE
11+
#define WOLFHSM_CFG_DEBUG
12+
#define WOLFHSM_CFG_DEBUG_VERBOSE
1313
#endif
1414

1515
/* Key DER export/import support */

src/wh_server_crypto.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,10 +2929,8 @@ static int _HandleMlDsaKeyGen(whServerContext* ctx, uint16_t magic,
29292929
ret = wh_Server_MlDsaKeyCacheImport(
29302930
ctx, key, key_id, flags, label_size, label);
29312931
}
2932-
#ifdef WOLFHSM_CFG_DEBUG
29332932
WH_DEBUG_SERVER("CacheImport: keyId:%u, ret:%d\n",
29342933
key_id, ret);
2935-
#endif
29362934
}
29372935
}
29382936
}
@@ -3216,12 +3214,10 @@ int wh_Server_HandleCryptoRequest(whServerContext* ctx, uint16_t magic,
32163214
magic, (whMessageCrypto_GenericRequestHeader*)req_packet, &rqstHeader);
32173215

32183216

3219-
#ifdef WOLFHSM_CFG_DEBUG
32203217
WH_DEBUG_SERVER_VERBOSE("HandleCryptoRequest. Action:%u\n", action);
32213218
#ifdef WOLFHSM_CFG_HEXDUMP
32223219
wh_Utils_Hexdump("[server] Crypto Request:\n", (const uint8_t*)req_packet,
32233220
req_size);
3224-
#endif
32253221
#endif
32263222
switch (action) {
32273223
case WC_ALGO_TYPE_CIPHER:
@@ -3484,9 +3480,7 @@ int wh_Server_HandleCryptoRequest(whServerContext* ctx, uint16_t magic,
34843480
sizeof(whMessageCrypto_GenericResponseHeader) + cryptoOutSize;
34853481
}
34863482

3487-
#ifdef WOLFHSM_CFG_DEBUG
34883483
WH_DEBUG_SERVER_VERBOSE("End ret:%d\n", ret);
3489-
#endif
34903484

34913485
/* Since crypto error codes are propagated to the client in the response
34923486
* packet, return success to the caller unless a cancellation has occurred

test/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ ifeq ($(DEBUG_WOLFSSL),1)
8989
endif
9090

9191
ifeq ($(DEBUG_CRYPTOCB),1)
92-
DEF += -DDEBUG_CRYPTOCB
92+
DEF += -DWOLFHSM_CFG_DEBUG
9393
endif
9494

9595
ifeq ($(DEBUG_CRYPTOCB_VERBOSE),1)
96-
DEF += -DDEBUG_CRYPTOCB -DDEBUG_CRYPTOCB_VERBOSE
96+
DEF += -DWOLFHSM_CFG_DEBUG -DWOLFHSM_CFG_DEBUG_VERBOSE
9797
endif
9898

9999

test/config/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
/* #define WC_NO_ASYNC_THREADING */
3232

3333
/*
34-
#define DEBUG_CRYPTOCB
35-
#define DEBUG_CRYPTOCB_VERBOSE
34+
#define WOLFHSM_CFG_DEBUG
35+
#define WOLFHSM_CFG_DEBUG_VERBOSE
3636
*/
3737

3838
/** wolfHSM required settings for wolfCrypt */

tools/whnvmtool/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ extern "C" {
3535
/* #define WC_NO_ASYNC_THREADING */
3636

3737
/*
38-
#define DEBUG_CRYPTOCB
39-
#define DEBUG_CRYPTOCB_VERBOSE
38+
#define WOLFHSM_CFG_DEBUG
39+
#define WOLFHSM_CFG_DEBUG_VERBOSE
4040
*/
4141

4242
/** wolfHSM required settings for wolfCrypt */

wolfhsm/wh_settings.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
* Debug and Print Configuration
236236
*---------------------------------------------------------------------------*/
237237

238-
/* Legacy compatibility: Map DEBUG_CRYPTOCB to WOLFHSM_CFG_DEBUG for transition */
238+
/* Legacy compatibility: Bidirectional mapping for transition */
239239
#if defined(DEBUG_CRYPTOCB) && !defined(WOLFHSM_CFG_DEBUG)
240240
#define WOLFHSM_CFG_DEBUG
241241
#endif
@@ -244,6 +244,15 @@
244244
#define WOLFHSM_CFG_DEBUG_VERBOSE
245245
#endif
246246

247+
/* Reverse mapping: Allow new macros to work with wolfSSL's DEBUG_CRYPTOCB features */
248+
#if defined(WOLFHSM_CFG_DEBUG) && !defined(DEBUG_CRYPTOCB)
249+
#define DEBUG_CRYPTOCB
250+
#endif
251+
252+
#if defined(WOLFHSM_CFG_DEBUG_VERBOSE) && !defined(DEBUG_CRYPTOCB_VERBOSE)
253+
#define DEBUG_CRYPTOCB_VERBOSE
254+
#endif
255+
247256
/* User can define WOLFHSM_CFG_PRINTF to override the default printf function.
248257
* This should be a function-like macro or function pointer that matches:
249258
* int func(const char* format, ...)

0 commit comments

Comments
 (0)