summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2018-11-07 18:31:17 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2018-11-07 18:31:17 +0000
commitc406b7ddfe11e7c928af5daed7ee21c8211f1ea2 (patch)
tree711e2a9407eb32ec75e9be9cfc5e7a5e9dae6dc2 /lib
parente1994194774e25d9c29f0e372a1034c923d59e8d (diff)
Use memmove() instead of memcpy() to get rid of the need for
non-overlapping *in and *out buffers as we're already implementing the "in place (un)wrapping" algorithms as given in RFC 3394. This removes a gratuitous API difference to OpenSSLin these undocumented functions. Found while working on wycheproof regress tests. ok beck jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/aes/aes_wrap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypto/aes/aes_wrap.c b/lib/libcrypto/aes/aes_wrap.c
index b7e08ab75f2..b30630fe479 100644
--- a/lib/libcrypto/aes/aes_wrap.c
+++ b/lib/libcrypto/aes/aes_wrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aes_wrap.c,v 1.11 2018/10/20 15:53:09 tb Exp $ */
+/* $OpenBSD: aes_wrap.c,v 1.12 2018/11/07 18:31:16 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@@ -71,7 +71,7 @@ AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out,
return -1;
A = B;
t = 1;
- memcpy(out + 8, in, inlen);
+ memmove(out + 8, in, inlen);
if (!iv)
iv = default_iv;
@@ -108,7 +108,7 @@ AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out,
A = B;
t = 6 * (inlen >> 3);
memcpy(A, in, 8);
- memcpy(out, in + 8, inlen);
+ memmove(out, in + 8, inlen);
for (j = 0; j < 6; j++) {
R = out + inlen - 8;
for (i = 0; i < inlen; i += 8, t--, R -= 8) {