projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removing those memcpy()s also took away the possibility for in and out to
[openssl.git]
/
crypto
/
aes
/
aes_cbc.c
diff --git
a/crypto/aes/aes_cbc.c
b/crypto/aes/aes_cbc.c
index c5f1a13c24ffede8e77f1cd47c8efbd8dc74a011..1222a21002c1add66fcfbf5fe57c84475838102b 100644
(file)
--- a/
crypto/aes/aes_cbc.c
+++ b/
crypto/aes/aes_cbc.c
@@
-63,7
+63,7
@@
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
const unsigned long length, const AES_KEY *key,
unsigned char *ivec, const int enc) {
const unsigned long length, const AES_KEY *key,
unsigned char *ivec, const int enc) {
-
int
n;
+
unsigned long
n;
unsigned long len = length;
unsigned char tmp[AES_BLOCK_SIZE];
unsigned long len = length;
unsigned char tmp[AES_BLOCK_SIZE];
@@
-86,7
+86,7
@@
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
for(n=len; n < AES_BLOCK_SIZE; ++n)
tmp[n] = ivec[n];
AES_encrypt(tmp, tmp, key);
for(n=len; n < AES_BLOCK_SIZE; ++n)
tmp[n] = ivec[n];
AES_encrypt(tmp, tmp, key);
- memcpy(out, tmp,
len
);
+ memcpy(out, tmp,
AES_BLOCK_SIZE
);
memcpy(ivec, tmp, AES_BLOCK_SIZE);
}
} else {
memcpy(ivec, tmp, AES_BLOCK_SIZE);
}
} else {
@@
-104,7
+104,7
@@
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
memcpy(tmp, in, AES_BLOCK_SIZE);
AES_decrypt(tmp, tmp, key);
for(n=0; n < len; ++n)
memcpy(tmp, in, AES_BLOCK_SIZE);
AES_decrypt(tmp, tmp, key);
for(n=0; n < len; ++n)
- out[n]
^=
ivec[n];
+ out[n]
= tmp[n] ^
ivec[n];
memcpy(ivec, tmp, AES_BLOCK_SIZE);
}
}
memcpy(ivec, tmp, AES_BLOCK_SIZE);
}
}