Skip to content

Commit c3a17b3

Browse files
authored
Merge pull request #215 from bigbrett/aes-gcm-dma-missing-callbacks
add missing post-write DMA callbacks for AES GCM
2 parents 6449396 + 02d49fa commit c3a17b3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/wh_server_crypto.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,33 @@ static int _HandleAesGcmDma(whServerContext* ctx, uint16_t magic, uint16_t seq,
21122112
}
21132113
}
21142114

2115+
/* Post-write DMA address processing for output/authTag (on success) */
2116+
if (ret == WH_ERROR_OK) {
2117+
if (req.output.sz > 0) {
2118+
int rc2 = wh_Server_DmaProcessClientAddress(
2119+
ctx, req.output.addr, &outAddr, req.output.sz,
2120+
WH_DMA_OPER_CLIENT_WRITE_POST, (whServerDmaFlags){0});
2121+
if (rc2 != WH_ERROR_OK) {
2122+
if (rc2 == WH_ERROR_ACCESS) {
2123+
res.dmaAddrStatus.badAddr = req.output;
2124+
}
2125+
ret = rc2;
2126+
}
2127+
}
2128+
/* During encryption, the auth tag is written to client memory */
2129+
if (ret == WH_ERROR_OK && req.enc && req.authTag.sz > 0) {
2130+
int rc2 = wh_Server_DmaProcessClientAddress(
2131+
ctx, req.authTag.addr, &authTagAddr, req.authTag.sz,
2132+
WH_DMA_OPER_CLIENT_WRITE_POST, (whServerDmaFlags){0});
2133+
if (rc2 != WH_ERROR_OK) {
2134+
if (rc2 == WH_ERROR_ACCESS) {
2135+
res.dmaAddrStatus.badAddr = req.authTag;
2136+
}
2137+
ret = rc2;
2138+
}
2139+
}
2140+
}
2141+
21152142
wc_AesFree(aes);
21162143
res.outSz = outSz;
21172144

0 commit comments

Comments
 (0)