Changeset 8e9e2b7 for lib/ssl_openssl.c
- Timestamp:
- 2010-10-03T02:45:26Z (14 years ago)
- Branches:
- master
- Children:
- 04f0c10
- Parents:
- 88de0c9 (diff), 2af3e23 (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
r88de0c9 r8e9e2b7 60 60 { 61 61 initialized = TRUE; 62 SSLeay_add_ssl_algorithms(); 62 SSL_library_init(); 63 // SSLeay_add_ssl_algorithms(); 63 64 } 64 65 … … 210 211 } 211 212 213 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st ); 214 212 215 return st; 213 216 } … … 224 227 225 228 st = SSL_write( ((struct scd*)conn)->ssl, buf, len ); 229 230 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st ); 226 231 227 232 ssl_errno = SSL_OK; … … 277 282 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); 278 283 } 284 285 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) 286 { 287 int output_length = 0; 288 EVP_CIPHER_CTX ctx; 289 290 *res = g_new0(unsigned char, 72); 291 292 /* Don't set key or IV because we will modify the parameters */ 293 EVP_CIPHER_CTX_init(&ctx); 294 EVP_CipherInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, NULL, NULL, 1); 295 EVP_CIPHER_CTX_set_key_length(&ctx, key_len); 296 EVP_CIPHER_CTX_set_padding(&ctx, 0); 297 /* We finished modifying parameters so now we can set key and IV */ 298 EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, 1); 299 EVP_CipherUpdate(&ctx, *res, &output_length, input, input_len); 300 EVP_CipherFinal_ex(&ctx, *res, &output_length); 301 EVP_CIPHER_CTX_cleanup(&ctx); 302 //EVP_cleanup(); 303 304 return output_length; 305 }
Note: See TracChangeset
for help on using the changeset viewer.