mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Merge pull request #5323 from SparkiDev/sha512_arm32_asm_align
This commit is contained in:
@@ -472,7 +472,25 @@ static WC_INLINE int Sha512Update(wc_Sha512* sha512, const byte* data, word32 le
|
|||||||
blocksLen = len & ~(WC_SHA512_BLOCK_SIZE-1);
|
blocksLen = len & ~(WC_SHA512_BLOCK_SIZE-1);
|
||||||
if (blocksLen > 0) {
|
if (blocksLen > 0) {
|
||||||
/* Byte reversal performed in function if required. */
|
/* Byte reversal performed in function if required. */
|
||||||
|
#ifndef WOLFSSL_ARMASM_NO_NEON
|
||||||
|
/* Data must be 64-bit aligned to be passed to Transform_Sha512_Len().
|
||||||
|
* 64 bits is 8 bytes.
|
||||||
|
*/
|
||||||
|
if (((size_t)data & 0x7) != 0) {
|
||||||
|
word32 i;
|
||||||
|
|
||||||
|
for (i = 0; i < blocksLen; i += WC_SHA512_BLOCK_SIZE) {
|
||||||
|
word64 buffer[WC_SHA512_BLOCK_SIZE / sizeof(word64)];
|
||||||
|
XMEMCPY(buffer, data + i, WC_SHA512_BLOCK_SIZE);
|
||||||
|
Transform_Sha512_Len(sha512, (const byte*)buffer,
|
||||||
|
WC_SHA512_BLOCK_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
Transform_Sha512_Len(sha512, data, blocksLen);
|
Transform_Sha512_Len(sha512, data, blocksLen);
|
||||||
|
}
|
||||||
data += blocksLen;
|
data += blocksLen;
|
||||||
len -= blocksLen;
|
len -= blocksLen;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user