Fixed Chacha in C keytools

pull/167/head
Daniele Lacamera 2022-02-07 16:39:56 +01:00
parent 61275ec9dd
commit 67912790de
2 changed files with 1 additions and 2 deletions

View File

@ -771,13 +771,13 @@ static int make_header_ex(int is_diff, uint8_t *pubkey, uint32_t pubkey_sz, cons
exit(100);
#endif
wc_Chacha_SetKey(&cha, key, sizeof(key));
wc_Chacha_SetIV(&cha, iv, 0);
for (pos = 0; pos < fsize; pos += ENC_BLOCK_SIZE) {
int fread_retval;
fread_retval = fread(buf, 1, ENC_BLOCK_SIZE, f);
if ((fread_retval == 0) && feof(f)) {
break;
}
wc_Chacha_SetIV(&cha, iv, (pos >> 4));
wc_Chacha_Process(&cha, enc_buf, buf, fread_retval);
fwrite(enc_buf, 1, fread_retval, fef);
}

View File

@ -68,7 +68,6 @@
#define HAVE_CHACHA
/* Disables */
#define NO_AES
#define NO_CMAC
#define NO_HMAC
#define NO_RC4