crypto: memcpy() in overlapping data in ccm
`memcpy()` must not be used if the input and output ranges overlap, because it is undefined if the data if copied from front to the end or vice versa. Found via valgrind.
This commit is contained in:
parent
7af7d37531
commit
d2afdf5079
@ -40,7 +40,7 @@ int ccm_compute_cbc_mac(cipher_t* cipher, uint8_t iv[16],
|
|||||||
uint8_t offset, block_size, mac_enc[16] = {0};
|
uint8_t offset, block_size, mac_enc[16] = {0};
|
||||||
|
|
||||||
block_size = cipher_get_block_size(cipher);
|
block_size = cipher_get_block_size(cipher);
|
||||||
memcpy(mac, iv, 16);
|
memmove(mac, iv, 16);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
do {
|
do {
|
||||||
uint8_t block_size_input = (length - offset > block_size) ?
|
uint8_t block_size_input = (length - offset > block_size) ?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user