@@ -551,73 +551,65 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
551
551
// are still accepted. They are OpenSSL's way of saying that all known
552
552
// protocols below TLS 1.3 are supported unless explicitly disabled (which
553
553
// we do below for SSLv2 and SSLv3.)
554
- if (strcmp (*sslmethod, " SSLv2_method" ) == 0 ) {
554
+ if (sslmethod == " SSLv2_method" ||
555
+ sslmethod == " SSLv2_server_method" ||
556
+ sslmethod == " SSLv2_client_method" ) {
555
557
THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv2 methods disabled" );
556
558
return ;
557
- } else if (strcmp (*sslmethod, " SSLv2_server_method" ) == 0 ) {
558
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv2 methods disabled" );
559
- return ;
560
- } else if (strcmp (*sslmethod, " SSLv2_client_method" ) == 0 ) {
561
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv2 methods disabled" );
562
- return ;
563
- } else if (strcmp (*sslmethod, " SSLv3_method" ) == 0 ) {
564
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv3 methods disabled" );
565
- return ;
566
- } else if (strcmp (*sslmethod, " SSLv3_server_method" ) == 0 ) {
567
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv3 methods disabled" );
568
- return ;
569
- } else if (strcmp (*sslmethod, " SSLv3_client_method" ) == 0 ) {
559
+ } else if (sslmethod == " SSLv3_method" ||
560
+ sslmethod == " SSLv3_server_method" ||
561
+ sslmethod == " SSLv3_client_method" ) {
570
562
THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv3 methods disabled" );
571
563
return ;
572
- } else if (strcmp (* sslmethod, " SSLv23_method " ) == 0 ) {
564
+ } else if (sslmethod == " SSLv23_method " ) {
573
565
max_version = TLS1_2_VERSION;
574
- } else if (strcmp (* sslmethod, " SSLv23_server_method " ) == 0 ) {
566
+ } else if (sslmethod == " SSLv23_server_method " ) {
575
567
max_version = TLS1_2_VERSION;
576
568
method = TLS_server_method ();
577
- } else if (strcmp (* sslmethod, " SSLv23_client_method " ) == 0 ) {
569
+ } else if (sslmethod == " SSLv23_client_method " ) {
578
570
max_version = TLS1_2_VERSION;
579
571
method = TLS_client_method ();
580
- } else if (strcmp (* sslmethod, " TLS_method " ) == 0 ) {
572
+ } else if (sslmethod == " TLS_method " ) {
581
573
min_version = 0 ;
582
574
max_version = MAX_SUPPORTED_VERSION;
583
- } else if (strcmp (* sslmethod, " TLS_server_method " ) == 0 ) {
575
+ } else if (sslmethod == " TLS_server_method " ) {
584
576
min_version = 0 ;
585
577
max_version = MAX_SUPPORTED_VERSION;
586
578
method = TLS_server_method ();
587
- } else if (strcmp (* sslmethod, " TLS_client_method " ) == 0 ) {
579
+ } else if (sslmethod == " TLS_client_method " ) {
588
580
min_version = 0 ;
589
581
max_version = MAX_SUPPORTED_VERSION;
590
582
method = TLS_client_method ();
591
- } else if (strcmp (* sslmethod, " TLSv1_method " ) == 0 ) {
583
+ } else if (sslmethod == " TLSv1_method " ) {
592
584
min_version = TLS1_VERSION;
593
585
max_version = TLS1_VERSION;
594
- } else if (strcmp (* sslmethod, " TLSv1_server_method " ) == 0 ) {
586
+ } else if (sslmethod == " TLSv1_server_method " ) {
595
587
min_version = TLS1_VERSION;
596
588
max_version = TLS1_VERSION;
597
589
method = TLS_server_method ();
598
- } else if (strcmp (* sslmethod, " TLSv1_client_method " ) == 0 ) {
590
+ } else if (sslmethod == " TLSv1_client_method " ) {
599
591
min_version = TLS1_VERSION;
600
592
max_version = TLS1_VERSION;
601
593
method = TLS_client_method ();
602
- } else if (strcmp (* sslmethod, " TLSv1_1_method " ) == 0 ) {
594
+ } else if (sslmethod == " TLSv1_1_method " ) {
603
595
min_version = TLS1_1_VERSION;
604
596
max_version = TLS1_1_VERSION;
605
- } else if (strcmp (* sslmethod, " TLSv1_1_server_method " ) == 0 ) {
597
+ } else if (sslmethod == " TLSv1_1_server_method " ) {
606
598
min_version = TLS1_1_VERSION;
607
599
max_version = TLS1_1_VERSION;
608
600
method = TLS_server_method ();
609
- } else if (strcmp (* sslmethod, " TLSv1_1_client_method " ) == 0 ) {
601
+ } else if (sslmethod == " TLSv1_1_client_method " ) {
610
602
min_version = TLS1_1_VERSION;
611
603
max_version = TLS1_1_VERSION;
612
604
method = TLS_client_method ();
613
- } else if (strcmp (* sslmethod, " TLSv1_2_method " ) == 0 ) {
605
+ } else if (sslmethod == " TLSv1_2_method " ) {
614
606
min_version = TLS1_2_VERSION;
615
607
max_version = TLS1_2_VERSION;
616
- } else if (strcmp (* sslmethod, " TLSv1_2_server_method " ) == 0 ) {
608
+ } else if (sslmethod == " TLSv1_2_server_method " ) {
617
609
min_version = TLS1_2_VERSION;
618
610
max_version = TLS1_2_VERSION;
619
611
method = TLS_server_method ();
620
- } else if (strcmp (* sslmethod, " TLSv1_2_client_method " ) == 0 ) {
612
+ } else if (sslmethod == " TLSv1_2_client_method " ) {
621
613
min_version = TLS1_2_VERSION;
622
614
max_version = TLS1_2_VERSION;
623
615
method = TLS_client_method ();
0 commit comments