Skip to content

Commit ff0ab4a

Browse files
committed
server: dma: allow to build without cmac and key DMA
1 parent 1f50321 commit ff0ab4a

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/wh_client_cryptocb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ int wh_Client_CryptoCbDma(int devId, wc_CryptoInfo* info, void* inCtx)
670670
}
671671
} break; /* case WC_ALGO_TYPE_PK */
672672

673-
#ifdef WOLFSSL_CMAC
673+
#if defined(WOLFSSL_CMAC) && !defined(WOLFHSM_CFG_NO_CMAC_DMA)
674674
case WC_ALGO_TYPE_CMAC: {
675675
Cmac* cmac = info->cmac.cmac;
676676
CmacType type = info->cmac.type;
@@ -684,7 +684,7 @@ int wh_Client_CryptoCbDma(int devId, wc_CryptoInfo* info, void* inCtx)
684684
ret = wh_Client_CmacDma(ctx, cmac, type, key, keyLen, in, inLen, outMac,
685685
outMacLen);
686686
} break;
687-
#endif
687+
#endif /* WOLFSSL_CMAC && !WOLFHSM_CFG_NO_CMAC_DMA */
688688

689689
case WC_ALGO_TYPE_NONE:
690690
default:

src/wh_server_crypto.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,9 +3223,11 @@ int wh_Server_HandleCryptoDmaRequest(whServerContext* ctx, uint16_t magic,
32233223
break; /* WC_ALGO_TYPE_PK */
32243224

32253225
case WC_ALGO_TYPE_CMAC:
3226+
#if defined(WOLFSSL_CMAC) && !defined(WOLFHSM_CFG_NO_CMAC_DMA)
32263227
ret = _HandleCmacDma(ctx, magic, seq, cryptoDataIn, cryptoInSize,
32273228
cryptoDataOut, &cryptoOutSize);
32283229
break;
3230+
#endif /* WOLFSSL_CMAC && !WOLFHSM_CFG_NO_CMAC_DMA */
32293231

32303232
case WC_ALGO_TYPE_NONE:
32313233
default:

test/wh_test_crypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ static int whTest_KeyCache(whClientContext* ctx, int devId, WC_RNG* rng)
10991099
}
11001100
}
11011101

1102-
#ifdef WOLFHSM_CFG_DMA
1102+
#if defined(WOLFHSM_CFG_DMA) && !defined(WOLFHSM_CFG_NO_KEY_DMA)
11031103
/* test cache/export using DMA */
11041104
if (ret == 0) {
11051105
keyId = WH_KEYID_ERASED;
@@ -1298,7 +1298,7 @@ static int whTest_KeyCache(whClientContext* ctx, int devId, WC_RNG* rng)
12981298
printf("KEY CROSS-CACHE EVICTION AND REPLACEMENT DMA SUCCESS\n");
12991299
}
13001300
}
1301-
#endif /* WOLFHSM_CFG_DMA */
1301+
#endif /* WOLFHSM_CFG_DMA && !WOLFHSM_CFG_NO_KEY_DMA */
13021302

13031303
return ret;
13041304
}

wolfhsm/wh_settings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
* operation in DMA requests.
7373
* Default: Not defined
7474
*
75+
* WOLFHSM_CFG_NO_CMAC_DMA - if defined, disables the use of CMAC for DMA
76+
* Default: Not defined
77+
*
78+
* WOLFHSM_CFG_NO_KEY_DMA - if defined, disables the use of DMA for keys
79+
* Default: Not defined
80+
*
7581
* Overridable porting functions:
7682
*
7783
* XMEMFENCE() - Create a sequential memory consistency sync point. Note this

0 commit comments

Comments
 (0)