@@ -572,73 +572,65 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
572
572
// are still accepted. They are OpenSSL's way of saying that all known
573
573
// protocols below TLS 1.3 are supported unless explicitly disabled (which
574
574
// we do below for SSLv2 and SSLv3.)
575
- if (strcmp (*sslmethod, " SSLv2_method" ) == 0 ) {
575
+ if (sslmethod == " SSLv2_method" ||
576
+ sslmethod == " SSLv2_server_method" ||
577
+ sslmethod == " SSLv2_client_method" ) {
576
578
THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv2 methods disabled" );
577
579
return ;
578
- } else if (strcmp (*sslmethod, " SSLv2_server_method" ) == 0 ) {
579
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv2 methods disabled" );
580
- return ;
581
- } else if (strcmp (*sslmethod, " SSLv2_client_method" ) == 0 ) {
582
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv2 methods disabled" );
583
- return ;
584
- } else if (strcmp (*sslmethod, " SSLv3_method" ) == 0 ) {
585
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv3 methods disabled" );
586
- return ;
587
- } else if (strcmp (*sslmethod, " SSLv3_server_method" ) == 0 ) {
588
- THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv3 methods disabled" );
589
- return ;
590
- } else if (strcmp (*sslmethod, " SSLv3_client_method" ) == 0 ) {
580
+ } else if (sslmethod == " SSLv3_method" ||
581
+ sslmethod == " SSLv3_server_method" ||
582
+ sslmethod == " SSLv3_client_method" ) {
591
583
THROW_ERR_TLS_INVALID_PROTOCOL_METHOD (env, " SSLv3 methods disabled" );
592
584
return ;
593
- } else if (strcmp (* sslmethod, " SSLv23_method " ) == 0 ) {
585
+ } else if (sslmethod == " SSLv23_method " ) {
594
586
max_version = TLS1_2_VERSION;
595
- } else if (strcmp (* sslmethod, " SSLv23_server_method " ) == 0 ) {
587
+ } else if (sslmethod == " SSLv23_server_method " ) {
596
588
max_version = TLS1_2_VERSION;
597
589
method = TLS_server_method ();
598
- } else if (strcmp (* sslmethod, " SSLv23_client_method " ) == 0 ) {
590
+ } else if (sslmethod == " SSLv23_client_method " ) {
599
591
max_version = TLS1_2_VERSION;
600
592
method = TLS_client_method ();
601
- } else if (strcmp (* sslmethod, " TLS_method " ) == 0 ) {
593
+ } else if (sslmethod == " TLS_method " ) {
602
594
min_version = 0 ;
603
595
max_version = MAX_SUPPORTED_VERSION;
604
- } else if (strcmp (* sslmethod, " TLS_server_method " ) == 0 ) {
596
+ } else if (sslmethod == " TLS_server_method " ) {
605
597
min_version = 0 ;
606
598
max_version = MAX_SUPPORTED_VERSION;
607
599
method = TLS_server_method ();
608
- } else if (strcmp (* sslmethod, " TLS_client_method " ) == 0 ) {
600
+ } else if (sslmethod == " TLS_client_method " ) {
609
601
min_version = 0 ;
610
602
max_version = MAX_SUPPORTED_VERSION;
611
603
method = TLS_client_method ();
612
- } else if (strcmp (* sslmethod, " TLSv1_method " ) == 0 ) {
604
+ } else if (sslmethod == " TLSv1_method " ) {
613
605
min_version = TLS1_VERSION;
614
606
max_version = TLS1_VERSION;
615
- } else if (strcmp (* sslmethod, " TLSv1_server_method " ) == 0 ) {
607
+ } else if (sslmethod == " TLSv1_server_method " ) {
616
608
min_version = TLS1_VERSION;
617
609
max_version = TLS1_VERSION;
618
610
method = TLS_server_method ();
619
- } else if (strcmp (* sslmethod, " TLSv1_client_method " ) == 0 ) {
611
+ } else if (sslmethod == " TLSv1_client_method " ) {
620
612
min_version = TLS1_VERSION;
621
613
max_version = TLS1_VERSION;
622
614
method = TLS_client_method ();
623
- } else if (strcmp (* sslmethod, " TLSv1_1_method " ) == 0 ) {
615
+ } else if (sslmethod == " TLSv1_1_method " ) {
624
616
min_version = TLS1_1_VERSION;
625
617
max_version = TLS1_1_VERSION;
626
- } else if (strcmp (* sslmethod, " TLSv1_1_server_method " ) == 0 ) {
618
+ } else if (sslmethod == " TLSv1_1_server_method " ) {
627
619
min_version = TLS1_1_VERSION;
628
620
max_version = TLS1_1_VERSION;
629
621
method = TLS_server_method ();
630
- } else if (strcmp (* sslmethod, " TLSv1_1_client_method " ) == 0 ) {
622
+ } else if (sslmethod == " TLSv1_1_client_method " ) {
631
623
min_version = TLS1_1_VERSION;
632
624
max_version = TLS1_1_VERSION;
633
625
method = TLS_client_method ();
634
- } else if (strcmp (* sslmethod, " TLSv1_2_method " ) == 0 ) {
626
+ } else if (sslmethod == " TLSv1_2_method " ) {
635
627
min_version = TLS1_2_VERSION;
636
628
max_version = TLS1_2_VERSION;
637
- } else if (strcmp (* sslmethod, " TLSv1_2_server_method " ) == 0 ) {
629
+ } else if (sslmethod == " TLSv1_2_server_method " ) {
638
630
min_version = TLS1_2_VERSION;
639
631
max_version = TLS1_2_VERSION;
640
632
method = TLS_server_method ();
641
- } else if (strcmp (* sslmethod, " TLSv1_2_client_method " ) == 0 ) {
633
+ } else if (sslmethod == " TLSv1_2_client_method " ) {
642
634
min_version = TLS1_2_VERSION;
643
635
max_version = TLS1_2_VERSION;
644
636
method = TLS_client_method ();
0 commit comments