diff options
author | Nikos <nmav@crystal.(none)> | 2008-03-16 17:57:16 +0200 |
---|---|---|
committer | Nikos <nmav@crystal.(none)> | 2008-03-16 17:57:16 +0200 |
commit | c54d8ce49564b19b2a39995cf8b12cc41ebd9097 (patch) | |
tree | 9cafe9fc2b83ca7e99f75329391a1ef464df18dd /lib/gnutls_cipher_int.c | |
parent | 568801e89300da2ac4d6fe5364ce2746f5f21f2f (diff) | |
download | gnutls-c54d8ce49564b19b2a39995cf8b12cc41ebd9097.tar.gz |
fixes for all tests to succeed.
Diffstat (limited to 'lib/gnutls_cipher_int.c')
-rw-r--r-- | lib/gnutls_cipher_int.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c index af3060e668..a7b50b9b1c 100644 --- a/lib/gnutls_cipher_int.c +++ b/lib/gnutls_cipher_int.c @@ -130,11 +130,14 @@ cc_cleanup: int _gnutls_cipher_encrypt (const cipher_hd_st* handle, void *text, int textlen) { - if (handle != GNUTLS_CIPHER_FAILED) + if (handle != NULL) { if (handle->registered) { + if (handle->hd.rh.ctx == NULL) return 0; return handle->hd.rh.cc->encrypt( handle->hd.rh.ctx, text, textlen, text, textlen); } + + if (handle->hd.gc == NULL) return 0; if (gc_cipher_encrypt_inline (handle->hd.gc, textlen, text) != 0) { gnutls_assert (); @@ -148,11 +151,14 @@ int _gnutls_cipher_decrypt (const cipher_hd_st *handle, void *ciphertext, int ciphertextlen) { - if (handle != GNUTLS_CIPHER_FAILED) + if (handle != NULL) { if (handle->registered) { + if (handle->hd.rh.ctx == NULL) return 0; return handle->hd.rh.cc->decrypt( handle->hd.rh.ctx, ciphertext, ciphertextlen, ciphertext, ciphertextlen); } + + if (handle->hd.gc == NULL) return 0; if (gc_cipher_decrypt_inline (handle->hd.gc, ciphertextlen, ciphertext) != 0) { gnutls_assert (); @@ -165,11 +171,11 @@ _gnutls_cipher_decrypt (const cipher_hd_st *handle, void *ciphertext, void _gnutls_cipher_deinit (cipher_hd_st* handle) { - if (handle != GNUTLS_CIPHER_FAILED) + if (handle != NULL) { if (handle->registered && handle->hd.rh.ctx != NULL) { return handle->hd.rh.cc->deinit( handle->hd.rh.ctx); } - gc_cipher_close (handle); + gc_cipher_close (handle->hd.gc); } } |