@@ -46,44 +46,6 @@ static ID id_i_cert_store, id_i_ca_file, id_i_ca_path, id_i_verify_mode,
4646 id_i_verify_hostname ;
4747static ID id_i_io , id_i_context , id_i_hostname ;
4848
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-
8749static int ossl_ssl_ex_vcb_idx ;
8850static int ossl_ssl_ex_ptr_idx ;
8951static int ossl_sslctx_ex_ptr_idx ;
@@ -148,51 +110,6 @@ ossl_sslctx_s_alloc(VALUE klass)
148110 return obj ;
149111}
150112
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-
196113static int
197114parse_proto_version (VALUE str )
198115{
@@ -2326,9 +2243,6 @@ ossl_ssl_tmp_key(VALUE self)
23262243void
23272244Init_ossl_ssl (void )
23282245{
2329- int i ;
2330- VALUE ary ;
2331-
23322246#if 0
23332247 mOSSL = rb_define_module ("OpenSSL" );
23342248 eOSSLError = rb_define_class_under (mOSSL , "OpenSSLError" , rb_eStandardError );
@@ -2625,7 +2539,6 @@ Init_ossl_ssl(void)
26252539
26262540 rb_define_alias (cSSLContext , "ssl_timeout" , "timeout" );
26272541 rb_define_alias (cSSLContext , "ssl_timeout=" , "timeout=" );
2628- rb_define_method (cSSLContext , "ssl_version=" , ossl_sslctx_set_ssl_version , 1 );
26292542 rb_define_private_method (cSSLContext , "set_minmax_proto_version" ,
26302543 ossl_sslctx_set_minmax_proto_version , 2 );
26312544 rb_define_method (cSSLContext , "ciphers" , ossl_sslctx_get_ciphers , 0 );
@@ -2695,14 +2608,6 @@ Init_ossl_ssl(void)
26952608 rb_define_method (cSSLContext , "options" , ossl_sslctx_get_options , 0 );
26962609 rb_define_method (cSSLContext , "options=" , ossl_sslctx_set_options , 1 );
26972610
2698- ary = rb_ary_new2 (numberof (ossl_ssl_method_tab ));
2699- for (i = 0 ; i < numberof (ossl_ssl_method_tab ); i ++ ) {
2700- rb_ary_push (ary , ID2SYM (rb_intern (ossl_ssl_method_tab [i ].name )));
2701- }
2702- rb_obj_freeze (ary );
2703- /* The list of available SSL/TLS methods */
2704- rb_define_const (cSSLContext , "METHODS" , ary );
2705-
27062611 /*
27072612 * Document-class: OpenSSL::SSL::SSLSocket
27082613 */
0 commit comments