diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-05-14 10:54:39 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-05-14 13:55:56 +0200 |
commit | 7eea232f449c19048197eca0b010ccfef675d92f (patch) | |
tree | 1e62fe80639b1824de2286c159ddea6166e80e07 /src/libstrongswan/plugins | |
parent | 111b96393136851d011684b3181d73650d7b6150 (diff) | |
download | strongswan-7eea232f449c19048197eca0b010ccfef675d92f.tar.bz2 strongswan-7eea232f449c19048197eca0b010ccfef675d92f.tar.xz |
clone iv before blowfish en|decryption
Diffstat (limited to 'src/libstrongswan/plugins')
-rw-r--r-- | src/libstrongswan/plugins/blowfish/blowfish_crypter.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/blowfish/blowfish_crypter.c b/src/libstrongswan/plugins/blowfish/blowfish_crypter.c index b70ea22c1..01e6cf513 100644 --- a/src/libstrongswan/plugins/blowfish/blowfish_crypter.c +++ b/src/libstrongswan/plugins/blowfish/blowfish_crypter.c @@ -109,8 +109,11 @@ static void decrypt(private_blowfish_crypter_t *this, chunk_t data, chunk_t iv, out = data.ptr; } in = data.ptr; + iv = chunk_clone(iv); - BF_cbc_encrypt(in, out, data.len, &this->schedule, iv.ptr, 0); + BF_cbc_encrypt(in, out, data.len, &this->schedule, iv.ptr, 0); + + free(iv.ptr); } /** @@ -131,8 +134,11 @@ static void encrypt (private_blowfish_crypter_t *this, chunk_t data, chunk_t iv, out = data.ptr; } in = data.ptr; + iv = chunk_clone(iv); + + BF_cbc_encrypt(in, out, data.len, &this->schedule, iv.ptr, 1); - BF_cbc_encrypt(in, out, data.len, &this->schedule, iv.ptr, 1); + free(iv.ptr); } /** |