Changeset 62f53b50 for lib/ssl_openssl.c
- Timestamp:
- 2010-10-02T05:34:53Z (13 years ago)
- Branches:
- master
- Children:
- 2af3e23
- Parents:
- 05bf2a0 (diff), 04cd284 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/ssl_openssl.c
r05bf2a0 r62f53b50 116 116 { 117 117 initialized = TRUE; 118 SSLeay_add_ssl_algorithms(); 118 SSL_library_init(); 119 //SSLeay_add_ssl_algorithms(); 120 //OpenSSL_add_all_algorithms(); 119 121 } 120 122 … … 205 207 } 206 208 209 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st ); 210 207 211 return st; 208 212 } … … 219 223 220 224 st = SSL_write( ((struct scd*)conn)->ssl, buf, len ); 225 226 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st ); 221 227 222 228 ssl_errno = SSL_OK; … … 272 278 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); 273 279 } 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.