Changeset 4968 for pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c
- Timestamp:
- Dec 18, 2014 4:40:35 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c
r4901 r4968 503 503 EC_KEY *ecdh; 504 504 #endif 505 SSL_METHOD *ssl_method ;505 SSL_METHOD *ssl_method = NULL; 506 506 SSL_CTX *ctx; 507 pj_uint32_t ssl_opt = 0; 507 508 pj_ssl_cert_t *cert; 508 509 int mode, rc; … … 515 516 /* Make sure OpenSSL library has been initialized */ 516 517 init_openssl(); 518 519 if (ssock->param.proto == PJ_SSL_SOCK_PROTO_DEFAULT) 520 ssock->param.proto = PJ_SSL_SOCK_PROTO_SSL23; 517 521 518 522 /* Determine SSL method to use */ … … 529 533 ssl_method = (SSL_METHOD*)SSLv3_method(); 530 534 break; 531 case PJ_SSL_SOCK_PROTO_DEFAULT: 532 case PJ_SSL_SOCK_PROTO_SSL23: 535 } 536 537 if (!ssl_method) { 533 538 ssl_method = (SSL_METHOD*)SSLv23_method(); 534 break; 535 //case PJ_SSL_SOCK_PROTO_DTLS1: 536 //ssl_method = (SSL_METHOD*)DTLSv1_method(); 537 //break; 538 default: 539 return PJ_EINVAL; 539 540 #ifdef SSL_OP_NO_SSLv2 541 /** Check if SSLv2 is enabled */ 542 ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_SSL2)==0)? 543 SSL_OP_NO_SSLv2:0; 544 #endif 545 546 #ifdef SSL_OP_NO_SSLv3 547 /** Check if SSLv3 is enabled */ 548 ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_SSL3)==0)? 549 SSL_OP_NO_SSLv3:0; 550 #endif 551 552 #ifdef SSL_OP_NO_TLSv1 553 /** Check if TLSv1 is enabled */ 554 ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1)==0)? 555 SSL_OP_NO_TLSv1:0; 556 #endif 557 558 #ifdef SSL_OP_NO_TLSv1_1 559 /** Check if TLSv1_1 is enabled */ 560 ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1_1)==0)? 561 SSL_OP_NO_TLSv1_1:0; 562 #endif 563 564 #ifdef SSL_OP_NO_TLSv1_2 565 /** Check if TLSv1_2 is enabled */ 566 ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1_2)==0)? 567 SSL_OP_NO_TLSv1_2:0; 568 569 #endif 570 540 571 } 541 572 … … 545 576 return GET_SSL_STATUS(ssock); 546 577 } 578 if (ssl_opt) 579 SSL_CTX_set_options(ctx, ssl_opt); 547 580 548 581 /* Apply credentials */
Note: See TracChangeset
for help on using the changeset viewer.