Changeset 8e9e2b7 for lib/ssl_openssl.c


Ignore:
Timestamp:
2010-10-03T02:45:26Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
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.
Message:

Merging mainline, which includes a huge msnp13 merge.

Not 100% sure about the OpenSSL merge, should double check that but I'm
currently offline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_openssl.c

    r88de0c9 r8e9e2b7  
    6060{
    6161        initialized = TRUE;
    62         SSLeay_add_ssl_algorithms();
     62        SSL_library_init();
     63        // SSLeay_add_ssl_algorithms();
    6364}
    6465
     
    210211        }
    211212       
     213        if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st );
     214       
    212215        return st;
    213216}
     
    224227       
    225228        st = SSL_write( ((struct scd*)conn)->ssl, buf, len );
     229       
     230        if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st );
    226231       
    227232        ssl_errno = SSL_OK;
     
    277282        return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ );
    278283}
     284
     285size_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.