mirror of https://github.com/wolfSSL/wolfssl.git
Merge pull request #3354 from SparkiDev/mac_arm_asm_2
ARM ASM ChaCha20: Fix calc of left over bytespull/3373/head
commit
c69e9927fa
|
@ -2839,10 +2839,10 @@ static void wc_Chacha_encrypt_bytes(ChaCha* ctx, const byte* m, byte* c,
|
|||
}
|
||||
if (bytes > 0) {
|
||||
wc_Chacha_encrypt_64(ctx->X, m, c, bytes, (byte*)ctx->over);
|
||||
if (bytes > 64)
|
||||
if (bytes > CHACHA_CHUNK_BYTES)
|
||||
ctx->X[CHACHA_IV_BYTES] = PLUSONE(ctx->X[CHACHA_IV_BYTES]);
|
||||
else
|
||||
ctx->left = CHACHA_CHUNK_BYTES - bytes;
|
||||
ctx->left = CHACHA_CHUNK_BYTES - (bytes & (CHACHA_CHUNK_BYTES - 1));
|
||||
ctx->left &= CHACHA_CHUNK_BYTES - 1;
|
||||
ctx->X[CHACHA_IV_BYTES] = PLUSONE(ctx->X[CHACHA_IV_BYTES]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4857,7 +4857,7 @@ static int chacha_test(void)
|
|||
}
|
||||
|
||||
/* Streaming test */
|
||||
for (i = 1; i <= (int)CHACHA_CHUNK_BYTES; i++) {
|
||||
for (i = 1; i <= (int)CHACHA_CHUNK_BYTES + 1; i++) {
|
||||
int j, rem;
|
||||
|
||||
ret = wc_Chacha_SetKey(&enc, keys[0], keySz);
|
||||
|
|
Loading…
Reference in New Issue