Changeset 83e47ec
- Timestamp:
- 2010-10-17T06:44:35Z (14 years ago)
- Branches:
- master
- Children:
- 79b5c41
- Parents:
- 3fc6c32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r3fc6c32 r83e47ec 269 269 if $PKG_CONFIG --exists gnutls; then 270 270 cat <<EOF>>Makefile.settings 271 EFLAGS+=`$PKG_CONFIG --libs gnutls` 272 CFLAGS+=`$PKG_CONFIG --cflags gnutls` 271 EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` 272 CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` 273 273 EOF 274 274 ssl=gnutls … … 276 276 elif libgnutls-config --version > /dev/null 2> /dev/null; then 277 277 cat <<EOF>>Makefile.settings 278 EFLAGS+=`libgnutls-config --libs` 279 CFLAGS+=`libgnutls-config --cflags` 278 EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` 279 CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` 280 280 EOF 281 281 … … 427 427 fi; 428 428 429 if [ "$msn" = "1" -a "$ssl" != "openssl" ]; then429 if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then 430 430 # Needed for MSN only. OpenSSL exports nice cipher functions already, 431 # others don't, so use our own 3des code. 431 # in case of GnuTLS we should be able to use gcrypt. Otherwise, use 432 # built-in stuff. (Since right now those are the only two supported 433 # SSL modules anyway, this is mostly unnecessary.) 432 434 echo 'DES=des.o' >> Makefile.settings 433 435 fi -
lib/ssl_gnutls.c
r3fc6c32 r83e47ec 25 25 26 26 #include <gnutls/gnutls.h> 27 #include <gcrypt.h> 27 28 #include <fcntl.h> 28 29 #include <unistd.h> … … 63 64 void ssl_init( void ) 64 65 { 66 if( initialized ) 67 return; 68 65 69 gnutls_global_init(); 66 70 initialized = TRUE; … … 127 131 } 128 132 129 if( !initialized ) 130 { 131 ssl_init(); 132 } 133 ssl_init(); 133 134 134 135 gnutls_certificate_allocate_credentials( &conn->xcred ); … … 255 256 B_EV_IO_WRITE : B_EV_IO_READ ); 256 257 } 258 259 size_t ssl_des3_encrypt( const unsigned char *key, size_t key_len, const unsigned char *input, 260 size_t input_len, const unsigned char *iv, unsigned char **res ) 261 { 262 gcry_cipher_hd_t gcr; 263 gcry_error_t st; 264 265 ssl_init(); 266 267 *res = g_malloc( input_len ); 268 st = gcry_cipher_open( &gcr, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0 ) || 269 gcry_cipher_setkey( gcr, key, key_len ) || 270 gcry_cipher_setiv( gcr, iv, 8 ) || 271 gcry_cipher_encrypt( gcr, *res, input_len, input, input_len ); 272 273 gcry_cipher_close( gcr ); 274 275 if( st == 0 ) 276 return input_len; 277 278 g_free( *res ); 279 return 0; 280 }
Note: See TracChangeset
for help on using the changeset viewer.