summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinoguchi <>2022-01-22 00:45:17 +0000
committerinoguchi <>2022-01-22 00:45:17 +0000
commit4e5a2a133677d1a18498becda56e1ec104740a03 (patch)
treeb8c58d811febd72f85c01bdc4618ee0be4e4da2a
parent8e35a088e29e2c33fce87a0ec3c3d397e101b1a1 (diff)
downloadopenbsd-4e5a2a133677d1a18498becda56e1ec104740a03.tar.gz
openbsd-4e5a2a133677d1a18498becda56e1ec104740a03.tar.bz2
openbsd-4e5a2a133677d1a18498becda56e1ec104740a03.zip
Use memmove instead of memcpy for overlapping memory
CID 251047 251094 OK beck@ jsing@ millert@ tb@
-rw-r--r--src/lib/libcrypto/modes/cbc128.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/modes/cbc128.c b/src/lib/libcrypto/modes/cbc128.c
index fe45103b0c..c5cf5a632d 100644
--- a/src/lib/libcrypto/modes/cbc128.c
+++ b/src/lib/libcrypto/modes/cbc128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cbc128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ 1/* $OpenBSD: cbc128.c,v 1.5 2022/01/22 00:45:17 inoguchi Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -110,7 +110,7 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
110 in += 16; 110 in += 16;
111 out += 16; 111 out += 16;
112 } 112 }
113 memcpy(ivec,iv,16); 113 memmove(ivec,iv,16);
114} 114}
115 115
116void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, 116void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
@@ -148,7 +148,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
148 out += 16; 148 out += 16;
149 } 149 }
150 } 150 }
151 memcpy(ivec,iv,16); 151 memmove(ivec,iv,16);
152 } else { 152 } else {
153 if (STRICT_ALIGNMENT && 153 if (STRICT_ALIGNMENT &&
154 ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) { 154 ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) {