diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-11 09:08:39 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-11 09:08:39 +0100 | 
| commit | 523fb2324a351e9607ad2a803c6e866c5175aa16 (patch) | |
| tree | 52e1d753a149196a50630415d51bb22f46b9b94e /lib/ssl_openssl.c | |
| parent | 7db65b7df08a3c7cab28e065b2ffa3d9941ceccb (diff) | |
Implement MSNP15 SSO (Sadistic Sign-On).
Diffstat (limited to 'lib/ssl_openssl.c')
| -rw-r--r-- | lib/ssl_openssl.c | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/lib/ssl_openssl.c b/lib/ssl_openssl.c index 8abff390..1c70eb0f 100644 --- a/lib/ssl_openssl.c +++ b/lib/ssl_openssl.c @@ -271,3 +271,27 @@ 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) +{ +	OpenSSL_add_all_algorithms(); +	int output_length = 0;     +	 +	*res = g_new0(unsigned char, 72); +	 +	EVP_CIPHER_CTX ctx; +	/* 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; +} | 
