summaryrefslogtreecommitdiffstats
path: root/crypto/modes
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2010-04-14 07:47:53 +0000
committerAndy Polyakov <appro@openssl.org>2010-04-14 07:47:53 +0000
commit8a898a6fcc06d0739f5c9578c23d5dd0ef9e1c4f (patch)
tree42e0c8be4272bf7a3b306aa3a1eaf6fd2e6139a2 /crypto/modes
parent9f827ded1ca570881550095e5eb9b6055301c719 (diff)
[co]cf128.c: fix "n=0" bug [from HEAD].
Diffstat (limited to 'crypto/modes')
-rw-r--r--crypto/modes/cfb128.c8
-rw-r--r--crypto/modes/ofb128.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/crypto/modes/cfb128.c b/crypto/modes/cfb128.c
index 98f4cf315c..e5938c6137 100644
--- a/crypto/modes/cfb128.c
+++ b/crypto/modes/cfb128.c
@@ -96,15 +96,15 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
#endif
while (len>=16) {
(*block)(ivec, ivec, key);
- for (n=0; n<16; n+=sizeof(size_t)) {
+ for (; n<16; n+=sizeof(size_t)) {
*(size_t*)(out+n) =
*(size_t*)(ivec+n) ^= *(size_t*)(in+n);
}
len -= 16;
out += 16;
in += 16;
+ n = 0;
}
- n = 0;
if (len) {
(*block)(ivec, ivec, key);
while (len--) {
@@ -141,7 +141,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
#endif
while (len>=16) {
(*block)(ivec, ivec, key);
- for (n=0; n<16; n+=sizeof(size_t)) {
+ for (; n<16; n+=sizeof(size_t)) {
size_t t = *(size_t*)(in+n);
*(size_t*)(out+n) = *(size_t*)(ivec+n) ^ t;
*(size_t*)(ivec+n) = t;
@@ -149,8 +149,8 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
len -= 16;
out += 16;
in += 16;
+ n = 0;
}
- n = 0;
if (len) {
(*block)(ivec, ivec, key);
while (len--) {
diff --git a/crypto/modes/ofb128.c b/crypto/modes/ofb128.c
index 09b3430034..c732e2ec58 100644
--- a/crypto/modes/ofb128.c
+++ b/crypto/modes/ofb128.c
@@ -95,14 +95,14 @@ void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
#endif
while (len>=16) {
(*block)(ivec, ivec, key);
- for (n=0; n<16; n+=sizeof(size_t))
+ for (; n<16; n+=sizeof(size_t))
*(size_t*)(out+n) =
*(size_t*)(in+n) ^ *(size_t*)(ivec+n);
len -= 16;
out += 16;
in += 16;
+ n = 0;
}
- n = 0;
if (len) {
(*block)(ivec, ivec, key);
while (len--) {