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.
dev/timer
René Kijewski 8 years ago committed by Oleg Hahm
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};
block_size = cipher_get_block_size(cipher);
memcpy(mac, iv, 16);
memmove(mac, iv, 16);
offset = 0;
do {
uint8_t block_size_input = (length - offset > block_size) ?

Loading…
Cancel
Save