Skip to content

Commit 781c508

Browse files
committed
Resolve merge conflicts and fix DMA address assignment bugs
- Resolved conflicts: kept WOLFHSM_CFG_HEXDUMP instead of DEBUG_CRYPTOCB_VERBOSE - Resolved conflicts: kept WH_DEBUG_CLIENT_VERBOSE instead of printf - Fixed bug: removed redundant address assignments in SHA224/384/512 DMA functions that were overwriting properly translated DMA addresses - The DMA address translation happens earlier in the function; the redundant assignments were breaking DMA by using raw client pointers instead of translated server addresses
2 parents 65ddce3 + 3f08169 commit 781c508

14 files changed

+966
-195
lines changed

port/posix/posix_transport_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ int posixTransportTcp_GetConnectFd(posixTransportTcpClientContext *context,
454454
case PTT_STATE_CONNECT_WAIT:
455455
case PTT_STATE_CONNECTED:
456456
ret = WH_ERROR_OK;
457-
if (*out_fd) {
457+
if (out_fd) {
458458
*out_fd = context->connect_fd_p1 - 1;
459459
}
460460
break;

src/wh_client_crypto.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,12 +3698,6 @@ int wh_Client_Sha224Dma(whClientContext* ctx, wc_Sha224* sha, const uint8_t* in,
36983698
* wc_CryptoCb_Sha224Hash(sha224, data, len, NULL) */
36993699
if (in != NULL && ret == WH_ERROR_OK) {
37003700
req->finalize = 0;
3701-
req->state.addr = (uint64_t)(uintptr_t)sha224;
3702-
req->state.sz = sizeof(*sha224);
3703-
req->input.addr = (uint64_t)(uintptr_t)in;
3704-
req->input.sz = inLen;
3705-
req->output.addr = (uint64_t)(uintptr_t)out;
3706-
req->output.sz = WC_SHA224_DIGEST_SIZE; /* not needed, but YOLO */
37073701
WH_DEBUG_CLIENT_VERBOSE("SHA224 DMA UPDATE: inAddr=%p, inSz=%u\n", in,
37083702
(unsigned int)inLen);
37093703
ret = wh_Client_SendRequest(
@@ -3991,12 +3985,6 @@ int wh_Client_Sha384Dma(whClientContext* ctx, wc_Sha384* sha, const uint8_t* in,
39913985
* wc_CryptoCb_Sha384Hash(sha384, data, len, NULL) */
39923986
if (in != NULL && ret == WH_ERROR_OK) {
39933987
req->finalize = 0;
3994-
req->state.addr = (uint64_t)(uintptr_t)sha384;
3995-
req->state.sz = sizeof(*sha384);
3996-
req->input.addr = (uint64_t)(uintptr_t)in;
3997-
req->input.sz = inLen;
3998-
req->output.addr = (uint64_t)(uintptr_t)out;
3999-
req->output.sz = WC_SHA384_DIGEST_SIZE; /* not needed, but YOLO */
40003988
WH_DEBUG_CLIENT_VERBOSE("SHA384 DMA UPDATE: inAddr=%p, inSz=%u\n", in,
40013989
(unsigned int)inLen);
40023990
ret = wh_Client_SendRequest(
@@ -4296,12 +4284,6 @@ int wh_Client_Sha512Dma(whClientContext* ctx, wc_Sha512* sha, const uint8_t* in,
42964284
* wc_CryptoCb_Sha512Hash(sha512, data, len, NULL) */
42974285
if (in != NULL && ret == WH_ERROR_OK) {
42984286
req->finalize = 0;
4299-
req->state.addr = (uint64_t)(uintptr_t)sha512;
4300-
req->state.sz = sizeof(*sha512);
4301-
req->input.addr = (uint64_t)(uintptr_t)in;
4302-
req->input.sz = inLen;
4303-
req->output.addr = (uint64_t)(uintptr_t)out;
4304-
req->output.sz = WC_SHA512_DIGEST_SIZE; /* not needed, but YOLO */
43054287
WH_DEBUG_CLIENT_VERBOSE("SHA512 DMA UPDATE: inAddr=%p, inSz=%u\n", in,
43064288
(unsigned int)inLen);
43074289
ret = wh_Client_SendRequest(

0 commit comments

Comments
 (0)