diff options
author | Samuel Neves <sneves@dei.uc.pt> | 2018-05-11 21:15:55 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-13 16:58:53 +0200 |
commit | ac659ac1f0a4b18d56b1fa0cc85cbbdff86e3494 (patch) | |
tree | 83105089072768075789b190a25a387f73958bd9 /src/allowedips.c | |
parent | b2c20c032ab89e24c8210b1159348e48d917aea2 (diff) |
chacha20poly1305: make gcc 8.1 happy
GCC 8.1 does not know about the invariant `0 <= ctx->num < POLY1305_BLOCK_SIZE`.
This results in a warning that `memcpy(ctx->data + num, inp, len);` may
overflow the `data` field, which is correct for arbitrary values of `num`.
To make the invariant explicit we ensure that `num` is in the required range.
An alternative would be to change `ctx->num` to a 4-bit bitfield at the point
of declaration.
This changes the code from `test ebp, ebp; jz end` to `and ebp, 15; jz
end`, which have identical performance characteristics.
Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/allowedips.c')
0 files changed, 0 insertions, 0 deletions