blake2b-ref: memcpy() -> memmove() for overlapping regions

This commit is contained in:
Frank Denis 2014-09-15 17:45:07 -07:00
parent d7edf5c34b
commit 136af03cc3

View File

@ -395,7 +395,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES ); blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
blake2b_compress( S, S->buf ); blake2b_compress( S, S->buf );
S->buflen -= BLAKE2B_BLOCKBYTES; S->buflen -= BLAKE2B_BLOCKBYTES;
memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen ); memmove( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
} }
blake2b_increment_counter( S, S->buflen ); blake2b_increment_counter( S, S->buflen );