From 6ac55a30be1ddda7e17f69f31200738aea26376c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 1 Mar 2017 14:07:12 +0100 Subject: [PATCH] No need for memmove() when no overlap is possible --- .../box_curve25519xchacha20poly1305.c | 2 +- .../curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c b/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c index 0d0965ed..aab38c04 100644 --- a/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c @@ -21,7 +21,7 @@ crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char * pk, unsigned char hash[64]; crypto_hash_sha512(hash, seed, 32); - memmove(sk, hash, 32); + memcpy(sk, hash, 32); sodium_memzero(hash, sizeof hash); return crypto_scalarmult_curve25519_base(pk, sk); diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c index 61f02053..b506c6bf 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c @@ -16,7 +16,7 @@ crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char * pk, unsigned char hash[64]; crypto_hash_sha512(hash, seed, 32); - memmove(sk, hash, 32); + memcpy(sk, hash, 32); sodium_memzero(hash, sizeof hash); return crypto_scalarmult_curve25519_base(pk, sk);