Improve HW AES CFB mode performance for byte cnt non-word alignment

pull/2861/head
cyliangtw 2016-08-30 18:09:36 +08:00 committed by ccli8
parent be9e74b4b4
commit f332ef7a8f
1 changed files with 4 additions and 2 deletions

View File

@ -409,10 +409,12 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
} }
// For address or byte count non-word alignment, go through reserved DMA buffer. // For address or byte count non-word alignment, go through reserved DMA buffer.
if( (((uint32_t)input) & 0x03) || (((uint32_t)output) & 0x03) || (length%4) ) if( (((uint32_t)input) & 0x03) || (((uint32_t)output) & 0x03) ) // Must reserved DMA buffer for each block
{ {
blockChainLen = (( length > MAX_DMA_CHAIN_SIZE ) ? MAX_DMA_CHAIN_SIZE : length ); blockChainLen = (( length > MAX_DMA_CHAIN_SIZE ) ? MAX_DMA_CHAIN_SIZE : length );
} else { } else if(length%4) { // Need reserved DMA buffer once for last chain
blockChainLen = (( length > MAX_DMA_CHAIN_SIZE ) ? (length - length%16) : length );
} else { // Not need reserved DMA buffer
blockChainLen = length; blockChainLen = length;
} }