Changeset 5c163e5 for lib/ssl_openssl.c
- Timestamp:
- 2018-05-25T02:15:12Z (6 years ago)
- Branches:
- master
- Children:
- 17cc2fe
- Parents:
- 896bea2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/ssl_openssl.c
r896bea2 r5c163e5 65 65 const SSL_METHOD *meth; 66 66 67 #if OPENSSL_VERSION_NUMBER < 0x10100000L 67 68 SSL_library_init(); 68 69 … … 70 71 ssl_ctx = SSL_CTX_new(meth); 71 72 SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); 73 #else 74 meth = TLS_client_method(); 75 ssl_ctx = SSL_CTX_new(meth); 76 SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION); 77 #endif 72 78 73 79 initialized = TRUE; … … 301 307 { 302 308 int output_length = 0; 303 EVP_CIPHER_CTX ctx;309 EVP_CIPHER_CTX *ctx; 304 310 305 311 *res = g_new0(unsigned char, 72); 306 312 307 313 /* Don't set key or IV because we will modify the parameters */ 308 EVP_CIPHER_CTX_init(&ctx);309 EVP_CipherInit_ex( &ctx, EVP_des_ede3_cbc(), NULL, NULL, NULL, 1);310 EVP_CIPHER_CTX_set_key_length( &ctx, key_len);311 EVP_CIPHER_CTX_set_padding( &ctx, 0);314 ctx = EVP_CIPHER_CTX_new(); 315 EVP_CipherInit_ex(ctx, EVP_des_ede3_cbc(), NULL, NULL, NULL, 1); 316 EVP_CIPHER_CTX_set_key_length(ctx, key_len); 317 EVP_CIPHER_CTX_set_padding(ctx, 0); 312 318 /* We finished modifying parameters so now we can set key and IV */ 313 EVP_CipherInit_ex( &ctx, NULL, NULL, key, iv, 1);314 EVP_CipherUpdate( &ctx, *res, &output_length, input, input_len);315 EVP_CipherFinal_ex( &ctx, *res, &output_length);316 EVP_CIPHER_CTX_ cleanup(&ctx);319 EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, 1); 320 EVP_CipherUpdate(ctx, *res, &output_length, input, input_len); 321 EVP_CipherFinal_ex(ctx, *res, &output_length); 322 EVP_CIPHER_CTX_free(ctx); 317 323 //EVP_cleanup(); 318 324
Note: See TracChangeset
for help on using the changeset viewer.