diff options
author | Martin Willi <martin@revosec.ch> | 2012-07-06 16:11:15 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-07-16 14:53:38 +0200 |
commit | 3b96189a2afa4949e1d9cdf7c9fa8244d8d817f0 (patch) | |
tree | 16564618b94304c2bca7e925fc9e6693b6226161 /src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c | |
parent | e35abbe588636c5ca73d8aaa9082314289346bd9 (diff) | |
download | strongswan-3b96189a2afa4949e1d9cdf7c9fa8244d8d817f0.tar.bz2 strongswan-3b96189a2afa4949e1d9cdf7c9fa8244d8d817f0.tar.xz |
Add a return value to crypter_t.decrypt()
Diffstat (limited to 'src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c')
-rw-r--r-- | src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c index c1f2b65c5..3627c5064 100644 --- a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c @@ -70,20 +70,20 @@ static bool set_iv(private_gcrypt_crypter_t *this, chunk_t iv) return gcry_cipher_setiv(this->h, iv.ptr, iv.len) == 0; } -METHOD(crypter_t, decrypt, void, +METHOD(crypter_t, decrypt, bool, private_gcrypt_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *dst) { - set_iv(this, iv); - - if (dst) + if (!set_iv(this, iv)) { - *dst = chunk_alloc(data.len); - gcry_cipher_decrypt(this->h, dst->ptr, dst->len, data.ptr, data.len); + return FALSE; } - else + if (dst) { - gcry_cipher_decrypt(this->h, data.ptr, data.len, NULL, 0); + *dst = chunk_alloc(data.len); + return gcry_cipher_decrypt(this->h, dst->ptr, dst->len, + data.ptr, data.len) == 0; } + return gcry_cipher_decrypt(this->h, data.ptr, data.len, NULL, 0) == 0; } METHOD(crypter_t, encrypt, bool, |