summaryrefslogtreecommitdiff
path: root/lib/gnutls_cipher_int.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2001-01-10 21:23:04 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2001-01-10 21:23:04 +0000
commitb572ae7208bdc12b7f4a803ec590d00166abf6e6 (patch)
treee8b7b924eec775781f50a6f699f37310190fd856 /lib/gnutls_cipher_int.c
parent0eb4a09aed26ca5bf7ca45f74b374ad0006a27ac (diff)
downloadgnutls-b572ae7208bdc12b7f4a803ec590d00166abf6e6.tar.gz
corrected buffer overruns
Diffstat (limited to 'lib/gnutls_cipher_int.c')
-rw-r--r--lib/gnutls_cipher_int.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c
index 549db02462..adc6cfa169 100644
--- a/lib/gnutls_cipher_int.c
+++ b/lib/gnutls_cipher_int.c
@@ -38,6 +38,13 @@ GNUTLS_CIPHER_HANDLE ret;
ret = gcry_cipher_open(GCRY_CIPHER_RIJNDAEL, GCRY_CIPHER_MODE_CBC, 0);
#endif
break;
+ case GNUTLS_TWOFISH:
+#ifdef USE_MCRYPT
+ ret = mcrypt_module_open( "twofish", NULL, "cbc", NULL);
+#else
+ ret = gcry_cipher_open(GCRY_CIPHER_TWOFISH, GCRY_CIPHER_MODE_CBC, 0);
+#endif
+ break;
case GNUTLS_3DES:
#ifdef USE_MCRYPT
ret = mcrypt_module_open( "tripledes", NULL, "cbc", NULL);
@@ -75,7 +82,10 @@ int gnutls_cipher_encrypt(GNUTLS_CIPHER_HANDLE handle, void* text, int textlen)
#ifdef USE_MCRYPT
mcrypt_generic( handle, text, textlen);
#else
- gcry_cipher_encrypt( handle, text, textlen, text, textlen);
+ if (gcry_cipher_encrypt( handle, text, textlen, NULL, textlen)!=0) {
+ gnutls_assert();
+ return GNUTLS_E_UNKNOWN_ERROR;
+ }
#endif
}
return 0;
@@ -86,7 +96,10 @@ int gnutls_cipher_decrypt(GNUTLS_CIPHER_HANDLE handle, void* ciphertext, int cip
#ifdef USE_MCRYPT
mdecrypt_generic( handle, ciphertext, ciphertextlen);
#else
- gcry_cipher_decrypt( handle, ciphertext, ciphertextlen, ciphertext, ciphertextlen);
+ if (gcry_cipher_decrypt( handle, ciphertext, ciphertextlen, NULL, ciphertextlen)!=0) {
+ gnutls_assert();
+ return GNUTLS_E_UNKNOWN_ERROR;
+ }
#endif
}
return 0;