summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2008-02-26 10:48:16 +0000
committerderaadt <>2008-02-26 10:48:16 +0000
commitb89c0dd40131bd782fa134e50e256db35c015e98 (patch)
tree86a92578c0743b9db700aaa03d43873539eb447c
parentaf70d9f43988faac4e1d4c23c2ee82a7f1fc0776 (diff)
downloadopenbsd-b89c0dd40131bd782fa134e50e256db35c015e98.tar.gz
openbsd-b89c0dd40131bd782fa134e50e256db35c015e98.tar.bz2
openbsd-b89c0dd40131bd782fa134e50e256db35c015e98.zip
fix memory leak (in one case of unaligned buffers); from Markus Kvetter
ok markus
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c5
-rw-r--r--src/lib/libssl/src/crypto/engine/hw_cryptodev.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c
index d3b186c132..a98f5d7e57 100644
--- a/src/lib/libcrypto/engine/hw_cryptodev.c
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -693,8 +693,9 @@ xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
693 693
694 viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp); 694 viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp);
695 695
696 if (ISUNALIGNED(out)) { 696 if (ISUNALIGNED(in) || ISUNALIGNED(out)) {
697 bcopy(spare, out, inl); 697 if (ISUNALIGNED(out))
698 bcopy(spare, out, inl);
698 free(spare); 699 free(spare);
699 } 700 }
700 701
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
index d3b186c132..a98f5d7e57 100644
--- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
+++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
@@ -693,8 +693,9 @@ xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
693 693
694 viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp); 694 viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp);
695 695
696 if (ISUNALIGNED(out)) { 696 if (ISUNALIGNED(in) || ISUNALIGNED(out)) {
697 bcopy(spare, out, inl); 697 if (ISUNALIGNED(out))
698 bcopy(spare, out, inl);
698 free(spare); 699 free(spare);
699 } 700 }
700 701