summaryrefslogtreecommitdiff
path: root/lib/gnutls_cipher_int.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-01-09 21:52:41 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-01-09 21:52:41 +0000
commit96dbf9713554a3ee9b712d3ff7701f602361312c (patch)
treeab2c68fda2b517a2aad22b54d37ae57afffee3c5 /lib/gnutls_cipher_int.c
parent1fe97a36ba1d398433c2a7f3f0eb2648295da3f6 (diff)
downloadgnutls-96dbf9713554a3ee9b712d3ff7701f602361312c.tar.gz
Only the documented symbols are now exported.
Diffstat (limited to 'lib/gnutls_cipher_int.c')
-rw-r--r--lib/gnutls_cipher_int.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c
index 0620cabce2..49dc86cfb0 100644
--- a/lib/gnutls_cipher_int.c
+++ b/lib/gnutls_cipher_int.c
@@ -33,54 +33,27 @@ GNUTLS_CIPHER_HANDLE ret;
ret = GNUTLS_CIPHER_FAILED;
break;
case GNUTLS_CIPHER_RIJNDAEL_128_CBC:
-#ifdef USE_MCRYPT
- ret = mcrypt_module_open( "rijndael-128", NULL, "cbc", NULL);
-#else
ret = gcry_cipher_open(GCRY_CIPHER_RIJNDAEL, GCRY_CIPHER_MODE_CBC, 0);
-#endif
break;
case GNUTLS_CIPHER_RIJNDAEL_256_CBC:
-#ifdef USE_MCRYPT
- ret = mcrypt_module_open( "rijndael-128", NULL, "cbc", NULL);
-#else
ret = gcry_cipher_open(GCRY_CIPHER_RIJNDAEL256, GCRY_CIPHER_MODE_CBC, 0);
-#endif
break;
case GNUTLS_CIPHER_TWOFISH_128_CBC:
-#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_CIPHER_3DES_CBC:
-#ifdef USE_MCRYPT
- ret = mcrypt_module_open( "tripledes", NULL, "cbc", NULL);
-#else
ret = gcry_cipher_open(GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
-#endif
break;
case GNUTLS_CIPHER_ARCFOUR_128:
case GNUTLS_CIPHER_ARCFOUR_40:
-#ifdef USE_MCRYPT
- ret = mcrypt_module_open( "arcfour", NULL, "stream", NULL);
-#else
ret = gcry_cipher_open(GCRY_CIPHER_ARCFOUR, GCRY_CIPHER_MODE_STREAM, 0);
-#endif
break;
default:
ret = GNUTLS_CIPHER_FAILED;
}
if (ret!=GNUTLS_CIPHER_FAILED) {
-#ifdef USE_MCRYPT
- /* ivsize is assumed to be blocksize */
- if ( mcrypt_generic_init( ret, key.data, key.size, iv.data) < 0) {
- return GNUTLS_CIPHER_FAILED;
- };
-#else
gcry_cipher_setkey(ret, key.data, key.size);
if (iv.data!=NULL && iv.size>0) gcry_cipher_setiv(ret, iv.data, iv.size);
-#endif
}
return ret;
@@ -88,38 +61,26 @@ return ret;
int _gnutls_cipher_encrypt(GNUTLS_CIPHER_HANDLE handle, void* text, int textlen) {
if (handle!=GNUTLS_CIPHER_FAILED) {
-#ifdef USE_MCRYPT
- mcrypt_generic( handle, text, textlen);
-#else
if (gcry_cipher_encrypt( handle, text, textlen, NULL, textlen)!=0) {
gnutls_assert();
return GNUTLS_E_INTERNAL_ERROR;
}
-#endif
}
return 0;
}
int _gnutls_cipher_decrypt(GNUTLS_CIPHER_HANDLE handle, void* ciphertext, int ciphertextlen) {
if (handle!=GNUTLS_CIPHER_FAILED) {
-#ifdef USE_MCRYPT
- mdecrypt_generic( handle, ciphertext, ciphertextlen);
-#else
if (gcry_cipher_decrypt( handle, ciphertext, ciphertextlen, NULL, ciphertextlen)!=0) {
gnutls_assert();
return GNUTLS_E_INTERNAL_ERROR;
}
-#endif
}
return 0;
}
void _gnutls_cipher_deinit(GNUTLS_CIPHER_HANDLE handle) {
if (handle!=GNUTLS_CIPHER_FAILED) {
-#ifdef USE_MCRYPT
- mcrypt_generic_end( handle);
-#else
gcry_cipher_close(handle);
-#endif
}
}