@@ -46,44 +46,6 @@ static ID id_i_cert_store, id_i_ca_file, id_i_ca_path, id_i_verify_mode,
46
46
id_i_verify_hostname ;
47
47
static ID id_i_io , id_i_context , id_i_hostname ;
48
48
49
- /*
50
- * SSLContext class
51
- */
52
- static const struct {
53
- const char * name ;
54
- const SSL_METHOD * (* func )(void );
55
- int version ;
56
- } ossl_ssl_method_tab [] = {
57
- #if defined(HAVE_SSL_CTX_SET_MIN_PROTO_VERSION )
58
- #define OSSL_SSL_METHOD_ENTRY (name , version ) \
59
- { #name , TLS_method, version }, \
60
- { #name"_server", TLS_server_method, version }, \
61
- { #name"_client", TLS_client_method, version }
62
- #else
63
- #define OSSL_SSL_METHOD_ENTRY (name , version ) \
64
- { #name, name##_method, version }, \
65
- { #name"_server", name##_server_method, version }, \
66
- { #name"_client", name##_client_method, version }
67
- #endif
68
- #if !defined(OPENSSL_NO_SSL2 ) && !defined(OPENSSL_NO_SSL2_METHOD ) && defined(HAVE_SSLV2_METHOD )
69
- OSSL_SSL_METHOD_ENTRY (SSLv2 , SSL2_VERSION ),
70
- #endif
71
- #if !defined(OPENSSL_NO_SSL3 ) && !defined(OPENSSL_NO_SSL3_METHOD ) && defined(HAVE_SSLV3_METHOD )
72
- OSSL_SSL_METHOD_ENTRY (SSLv3 , SSL3_VERSION ),
73
- #endif
74
- #if !defined(OPENSSL_NO_TLS1 ) && !defined(OPENSSL_NO_TLS1_METHOD )
75
- OSSL_SSL_METHOD_ENTRY (TLSv1 , TLS1_VERSION ),
76
- #endif
77
- #if !defined(OPENSSL_NO_TLS1_1 ) && !defined(OPENSSL_NO_TLS1_1_METHOD )
78
- OSSL_SSL_METHOD_ENTRY (TLSv1_1 , TLS1_1_VERSION ),
79
- #endif
80
- #if !defined(OPENSSL_NO_TLS1_2 ) && !defined(OPENSSL_NO_TLS1_2_METHOD )
81
- OSSL_SSL_METHOD_ENTRY (TLSv1_2 , TLS1_2_VERSION ),
82
- #endif
83
- OSSL_SSL_METHOD_ENTRY (SSLv23 , 0 ),
84
- #undef OSSL_SSL_METHOD_ENTRY
85
- };
86
-
87
49
static int ossl_ssl_ex_vcb_idx ;
88
50
static int ossl_ssl_ex_ptr_idx ;
89
51
static int ossl_sslctx_ex_ptr_idx ;
@@ -148,51 +110,6 @@ ossl_sslctx_s_alloc(VALUE klass)
148
110
return obj ;
149
111
}
150
112
151
- /*
152
- * call-seq:
153
- * ctx.ssl_version = :TLSv1
154
- * ctx.ssl_version = "SSLv23_client"
155
- *
156
- * Sets the SSL/TLS protocol version for the context. This forces connections to
157
- * use only the specified protocol version.
158
- *
159
- * You can get a list of valid versions with OpenSSL::SSL::SSLContext::METHODS
160
- */
161
- static VALUE
162
- ossl_sslctx_set_ssl_version (VALUE self , VALUE ssl_method )
163
- {
164
- SSL_CTX * ctx ;
165
- const char * s ;
166
- VALUE m = ssl_method ;
167
- int i ;
168
-
169
- GetSSLCTX (self , ctx );
170
- if (RB_TYPE_P (ssl_method , T_SYMBOL ))
171
- m = rb_sym2str (ssl_method );
172
- s = StringValueCStr (m );
173
- for (i = 0 ; i < numberof (ossl_ssl_method_tab ); i ++ ) {
174
- if (strcmp (ossl_ssl_method_tab [i ].name , s ) == 0 ) {
175
- #if defined(HAVE_SSL_CTX_SET_MIN_PROTO_VERSION )
176
- int version = ossl_ssl_method_tab [i ].version ;
177
- #endif
178
- const SSL_METHOD * method = ossl_ssl_method_tab [i ].func ();
179
-
180
- if (SSL_CTX_set_ssl_version (ctx , method ) != 1 )
181
- ossl_raise (eSSLError , "SSL_CTX_set_ssl_version" );
182
-
183
- #if defined(HAVE_SSL_CTX_SET_MIN_PROTO_VERSION )
184
- if (!SSL_CTX_set_min_proto_version (ctx , version ))
185
- ossl_raise (eSSLError , "SSL_CTX_set_min_proto_version" );
186
- if (!SSL_CTX_set_max_proto_version (ctx , version ))
187
- ossl_raise (eSSLError , "SSL_CTX_set_max_proto_version" );
188
- #endif
189
- return ssl_method ;
190
- }
191
- }
192
-
193
- ossl_raise (rb_eArgError , "unknown SSL method `%" PRIsVALUE "'." , m );
194
- }
195
-
196
113
static int
197
114
parse_proto_version (VALUE str )
198
115
{
@@ -2318,9 +2235,6 @@ ossl_ssl_tmp_key(VALUE self)
2318
2235
void
2319
2236
Init_ossl_ssl (void )
2320
2237
{
2321
- int i ;
2322
- VALUE ary ;
2323
-
2324
2238
#if 0
2325
2239
mOSSL = rb_define_module ("OpenSSL" );
2326
2240
eOSSLError = rb_define_class_under (mOSSL , "OpenSSLError" , rb_eStandardError );
@@ -2617,7 +2531,6 @@ Init_ossl_ssl(void)
2617
2531
2618
2532
rb_define_alias (cSSLContext , "ssl_timeout" , "timeout" );
2619
2533
rb_define_alias (cSSLContext , "ssl_timeout=" , "timeout=" );
2620
- rb_define_method (cSSLContext , "ssl_version=" , ossl_sslctx_set_ssl_version , 1 );
2621
2534
rb_define_private_method (cSSLContext , "set_minmax_proto_version" ,
2622
2535
ossl_sslctx_set_minmax_proto_version , 2 );
2623
2536
rb_define_method (cSSLContext , "ciphers" , ossl_sslctx_get_ciphers , 0 );
@@ -2687,14 +2600,6 @@ Init_ossl_ssl(void)
2687
2600
rb_define_method (cSSLContext , "options" , ossl_sslctx_get_options , 0 );
2688
2601
rb_define_method (cSSLContext , "options=" , ossl_sslctx_set_options , 1 );
2689
2602
2690
- ary = rb_ary_new2 (numberof (ossl_ssl_method_tab ));
2691
- for (i = 0 ; i < numberof (ossl_ssl_method_tab ); i ++ ) {
2692
- rb_ary_push (ary , ID2SYM (rb_intern (ossl_ssl_method_tab [i ].name )));
2693
- }
2694
- rb_obj_freeze (ary );
2695
- /* The list of available SSL/TLS methods */
2696
- rb_define_const (cSSLContext , "METHODS" , ary );
2697
-
2698
2603
/*
2699
2604
* Document-class: OpenSSL::SSL::SSLSocket
2700
2605
*/
0 commit comments