Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_openssl.c

    r327af51 re046390  
    116116        {
    117117                initialized = TRUE;
    118                 SSL_library_init();
    119                 //SSLeay_add_ssl_algorithms();
    120                 //OpenSSL_add_all_algorithms();
     118                SSLeay_add_ssl_algorithms();
    121119        }
    122120       
     
    207205        }
    208206       
    209         if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st );
    210        
    211207        return st;
    212208}
     
    223219       
    224220        st = SSL_write( ((struct scd*)conn)->ssl, buf, len );
    225        
    226         if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) write( 1, buf, st );
    227221       
    228222        ssl_errno = SSL_OK;
     
    278272        return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ );
    279273}
    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.