mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-14 04:15:08 +02:00
methods: do not unnecessarily zero padding of input data
We only support stream ciphers, so trailing garbage in the last block isn't an issue.
This commit is contained in:
parent
4d25d50366
commit
9ddd40e5b6
2 changed files with 0 additions and 6 deletions
|
@ -194,9 +194,6 @@ static bool method_encrypt(
|
||||||
*out = fastd_buffer_alloc(
|
*out = fastd_buffer_alloc(
|
||||||
sizeof(fastd_block128_t) + in.len, COMMON_HEADROOM, sizeof(fastd_block128_t) + tail_len);
|
sizeof(fastd_block128_t) + in.len, COMMON_HEADROOM, sizeof(fastd_block128_t) + tail_len);
|
||||||
|
|
||||||
if (tail_len)
|
|
||||||
memset(in.data + in.len, 0, tail_len);
|
|
||||||
|
|
||||||
int n_blocks = block_count(in.len, sizeof(fastd_block128_t));
|
int n_blocks = block_count(in.len, sizeof(fastd_block128_t));
|
||||||
|
|
||||||
fastd_block128_t *inblocks = in.data;
|
fastd_block128_t *inblocks = in.data;
|
||||||
|
|
|
@ -165,9 +165,6 @@ static bool method_encrypt(
|
||||||
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t)) - in.len;
|
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t)) - in.len;
|
||||||
*out = fastd_buffer_alloc(in.len, COMMON_HEADROOM, sizeof(fastd_block128_t) + tail_len);
|
*out = fastd_buffer_alloc(in.len, COMMON_HEADROOM, sizeof(fastd_block128_t) + tail_len);
|
||||||
|
|
||||||
if (tail_len)
|
|
||||||
memset(in.data + in.len, 0, tail_len);
|
|
||||||
|
|
||||||
uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
|
uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
|
||||||
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
|
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue