Changes in lib/ssl_openssl.c [327af51:e046390]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/ssl_openssl.c
r327af51 re046390 116 116 { 117 117 initialized = TRUE; 118 SSL_library_init(); 119 //SSLeay_add_ssl_algorithms(); 120 //OpenSSL_add_all_algorithms(); 118 SSLeay_add_ssl_algorithms(); 121 119 } 122 120 … … 207 205 } 208 206 209 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st );210 211 207 return st; 212 208 } … … 223 219 224 220 st = SSL_write( ((struct scd*)conn)->ssl, buf, len ); 225 226 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st );227 221 228 222 ssl_errno = SSL_OK; … … 278 272 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); 279 273 } 280 281 size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, const unsigned char *input, size_t input_len, const unsigned char *iv, unsigned char **res)282 {283 int output_length = 0;284 EVP_CIPHER_CTX ctx;285 286 *res = g_new0(unsigned char, 72);287 288 /* Don't set key or IV because we will modify the parameters */289 EVP_CIPHER_CTX_init(&ctx);290 EVP_CipherInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, NULL, NULL, 1);291 EVP_CIPHER_CTX_set_key_length(&ctx, key_len);292 EVP_CIPHER_CTX_set_padding(&ctx, 0);293 /* We finished modifying parameters so now we can set key and IV */294 EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, 1);295 EVP_CipherUpdate(&ctx, *res, &output_length, input, input_len);296 EVP_CipherFinal_ex(&ctx, *res, &output_length);297 EVP_CIPHER_CTX_cleanup(&ctx);298 //EVP_cleanup();299 300 return output_length;301 }
Note: See TracChangeset
for help on using the changeset viewer.