File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
hal/targets/hal/TARGET_NUVOTON/TARGET_NUC472/crypto/aes Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -409,10 +409,12 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
409
409
}
410
410
411
411
// For address or byte count non-word alignment, go through reserved DMA buffer.
412
- if ( (((uint32_t )input ) & 0x03 ) || (((uint32_t )output ) & 0x03 ) || ( length % 4 ) )
412
+ if ( (((uint32_t )input ) & 0x03 ) || (((uint32_t )output ) & 0x03 ) ) // Must reserved DMA buffer for each block
413
413
{
414
414
blockChainLen = (( length > MAX_DMA_CHAIN_SIZE ) ? MAX_DMA_CHAIN_SIZE : length );
415
- } else {
415
+ } else if (length %4 ) { // Need reserved DMA buffer once for last chain
416
+ blockChainLen = (( length > MAX_DMA_CHAIN_SIZE ) ? (length - length %16 ) : length );
417
+ } else { // Not need reserved DMA buffer
416
418
blockChainLen = length ;
417
419
}
418
420
You can’t perform that action at this time.
0 commit comments