diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-01 22:34:53 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-01 22:34:53 -0700 |
commit | 62f53b508742804d5df6533150f17d41e6afcbb2 (patch) | |
tree | e01a02a2a730110dde6ded977458090859fe2115 /lib/ssl_openssl.c | |
parent | 05bf2a0d55999c944ac6cf03ad85270cb2165923 (diff) | |
parent | 04cd284bce74c114fde3043c951a5c8ef9eb79ae (diff) |
Merging msnp13 branch which, confusingly, upgrades the msn module to use
MSNP15. (The reason for this is that A) IMHO MSNP13 is what causes most of
the pain in this upgade and B) I initially intended to only implement MSNP13
but then discovered MS doesn't support it anymore.)
This fixes issues with display names being forgotten, adding contacts (and
them automatically getting blocked sometimes!!), and adds support for
away/status messages and some support for sending offline messages.
Diffstat (limited to 'lib/ssl_openssl.c')
-rw-r--r-- | lib/ssl_openssl.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/ssl_openssl.c b/lib/ssl_openssl.c index 8abff390..e0143791 100644 --- a/lib/ssl_openssl.c +++ b/lib/ssl_openssl.c @@ -115,7 +115,9 @@ static gboolean ssl_connected( gpointer data, gint source, b_input_condition con if( !initialized ) { initialized = TRUE; - SSLeay_add_ssl_algorithms(); + SSL_library_init(); + //SSLeay_add_ssl_algorithms(); + //OpenSSL_add_all_algorithms(); } meth = TLSv1_client_method(); @@ -204,6 +206,8 @@ int ssl_read( void *conn, char *buf, int len ) ssl_errno = SSL_AGAIN; } + if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st ); + return st; } @@ -219,6 +223,8 @@ int ssl_write( void *conn, const char *buf, int len ) st = SSL_write( ((struct scd*)conn)->ssl, buf, len ); + if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st ); + ssl_errno = SSL_OK; if( st <= 0 ) { @@ -271,3 +277,25 @@ b_input_condition ssl_getdirection( void *conn ) { return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); } + +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) +{ + int output_length = 0; + EVP_CIPHER_CTX ctx; + + *res = g_new0(unsigned char, 72); + + /* Don't set key or IV because we will modify the parameters */ + EVP_CIPHER_CTX_init(&ctx); + EVP_CipherInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, NULL, NULL, 1); + EVP_CIPHER_CTX_set_key_length(&ctx, key_len); + EVP_CIPHER_CTX_set_padding(&ctx, 0); + /* We finished modifying parameters so now we can set key and IV */ + EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, 1); + EVP_CipherUpdate(&ctx, *res, &output_length, input, input_len); + EVP_CipherFinal_ex(&ctx, *res, &output_length); + EVP_CIPHER_CTX_cleanup(&ctx); + //EVP_cleanup(); + + return output_length; +} |