aboutsummaryrefslogtreecommitdiff
path: root/crypto/modes/cbc128.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2021-03-25 15:05:31 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2021-03-25 15:05:31 +0000
commit94fa08a4bcdfbb3434b025d67d014af3b18e5380 (patch)
treed9b51f32dc4f6bcd110a92d0374694a93bfa2fb0 /crypto/modes/cbc128.c
parent4f55bd5321b72491d4eff396e4928e9ab0706735 (diff)
downloadsrc-94fa08a4bcdfbb3434b025d67d014af3b18e5380.tar.gz
src-94fa08a4bcdfbb3434b025d67d014af3b18e5380.zip
Diffstat (limited to 'crypto/modes/cbc128.c')
-rw-r--r--crypto/modes/cbc128.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/modes/cbc128.c b/crypto/modes/cbc128.c
index c85e37c6a546..15a14be70872 100644
--- a/crypto/modes/cbc128.c
+++ b/crypto/modes/cbc128.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -69,7 +69,8 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
in += 16;
out += 16;
}
- memcpy(ivec, iv, 16);
+ if (ivec != iv)
+ memcpy(ivec, iv, 16);
}
void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
@@ -114,7 +115,8 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
out += 16;
}
}
- memcpy(ivec, iv, 16);
+ if (ivec != iv)
+ memcpy(ivec, iv, 16);
} else {
if (STRICT_ALIGNMENT &&
((size_t)in | (size_t)out | (size_t)ivec) % sizeof(size_t) != 0) {