@@ -2412,8 +2412,6 @@ ossl_ssl_tmp_key(VALUE self)
2412
2412
# endif /* defined(HAVE_SSL_GET_SERVER_TMP_KEY) */
2413
2413
#endif /* !defined(OPENSSL_NO_SOCK) */
2414
2414
2415
- #undef rb_intern
2416
- #define rb_intern (s ) rb_intern_const(s)
2417
2415
void
2418
2416
Init_ossl_ssl (void )
2419
2417
{
@@ -2424,8 +2422,8 @@ Init_ossl_ssl(void)
2424
2422
rb_mWaitWritable = rb_define_module_under (rb_cIO , "WaitWritable" );
2425
2423
#endif
2426
2424
2427
- id_call = rb_intern ("call" );
2428
- ID_callback_state = rb_intern ("callback_state" );
2425
+ id_call = rb_intern_const ("call" );
2426
+ ID_callback_state = rb_intern_const ("callback_state" );
2429
2427
2430
2428
ossl_ssl_ex_vcb_idx = SSL_get_ex_new_index (0 , (void * )"ossl_ssl_ex_vcb_idx" , 0 , 0 , 0 );
2431
2429
if (ossl_ssl_ex_vcb_idx < 0 )
@@ -2492,37 +2490,37 @@ Init_ossl_ssl(void)
2492
2490
* The _cert_, _key_, and _extra_chain_cert_ attributes are deprecated.
2493
2491
* It is recommended to use #add_certificate instead.
2494
2492
*/
2495
- rb_attr (cSSLContext , rb_intern ("cert" ), 1 , 1 , Qfalse );
2493
+ rb_attr (cSSLContext , rb_intern_const ("cert" ), 1 , 1 , Qfalse );
2496
2494
2497
2495
/*
2498
2496
* Context private key
2499
2497
*
2500
2498
* The _cert_, _key_, and _extra_chain_cert_ attributes are deprecated.
2501
2499
* It is recommended to use #add_certificate instead.
2502
2500
*/
2503
- rb_attr (cSSLContext , rb_intern ("key" ), 1 , 1 , Qfalse );
2501
+ rb_attr (cSSLContext , rb_intern_const ("key" ), 1 , 1 , Qfalse );
2504
2502
2505
2503
/*
2506
2504
* A certificate or Array of certificates that will be sent to the client.
2507
2505
*/
2508
- rb_attr (cSSLContext , rb_intern ("client_ca" ), 1 , 1 , Qfalse );
2506
+ rb_attr (cSSLContext , rb_intern_const ("client_ca" ), 1 , 1 , Qfalse );
2509
2507
2510
2508
/*
2511
2509
* The path to a file containing a PEM-format CA certificate
2512
2510
*/
2513
- rb_attr (cSSLContext , rb_intern ("ca_file" ), 1 , 1 , Qfalse );
2511
+ rb_attr (cSSLContext , rb_intern_const ("ca_file" ), 1 , 1 , Qfalse );
2514
2512
2515
2513
/*
2516
2514
* The path to a directory containing CA certificates in PEM format.
2517
2515
*
2518
2516
* Files are looked up by subject's X509 name's hash value.
2519
2517
*/
2520
- rb_attr (cSSLContext , rb_intern ("ca_path" ), 1 , 1 , Qfalse );
2518
+ rb_attr (cSSLContext , rb_intern_const ("ca_path" ), 1 , 1 , Qfalse );
2521
2519
2522
2520
/*
2523
2521
* Maximum session lifetime in seconds.
2524
2522
*/
2525
- rb_attr (cSSLContext , rb_intern ("timeout" ), 1 , 1 , Qfalse );
2523
+ rb_attr (cSSLContext , rb_intern_const ("timeout" ), 1 , 1 , Qfalse );
2526
2524
2527
2525
/*
2528
2526
* Session verification mode.
@@ -2535,12 +2533,12 @@ Init_ossl_ssl(void)
2535
2533
*
2536
2534
* See SSL_CTX_set_verify(3) for details.
2537
2535
*/
2538
- rb_attr (cSSLContext , rb_intern ("verify_mode" ), 1 , 1 , Qfalse );
2536
+ rb_attr (cSSLContext , rb_intern_const ("verify_mode" ), 1 , 1 , Qfalse );
2539
2537
2540
2538
/*
2541
2539
* Number of CA certificates to walk when verifying a certificate chain.
2542
2540
*/
2543
- rb_attr (cSSLContext , rb_intern ("verify_depth" ), 1 , 1 , Qfalse );
2541
+ rb_attr (cSSLContext , rb_intern_const ("verify_depth" ), 1 , 1 , Qfalse );
2544
2542
2545
2543
/*
2546
2544
* A callback for additional certificate verification. The callback is
@@ -2554,20 +2552,20 @@ Init_ossl_ssl(void)
2554
2552
* If the callback returns +false+, the chain verification is immediately
2555
2553
* stopped and a bad_certificate alert is then sent.
2556
2554
*/
2557
- rb_attr (cSSLContext , rb_intern ("verify_callback" ), 1 , 1 , Qfalse );
2555
+ rb_attr (cSSLContext , rb_intern_const ("verify_callback" ), 1 , 1 , Qfalse );
2558
2556
2559
2557
/*
2560
2558
* Whether to check the server certificate is valid for the hostname.
2561
2559
*
2562
2560
* In order to make this work, verify_mode must be set to VERIFY_PEER and
2563
2561
* the server hostname must be given by OpenSSL::SSL::SSLSocket#hostname=.
2564
2562
*/
2565
- rb_attr (cSSLContext , rb_intern ("verify_hostname" ), 1 , 1 , Qfalse );
2563
+ rb_attr (cSSLContext , rb_intern_const ("verify_hostname" ), 1 , 1 , Qfalse );
2566
2564
2567
2565
/*
2568
2566
* An OpenSSL::X509::Store used for certificate verification.
2569
2567
*/
2570
- rb_attr (cSSLContext , rb_intern ("cert_store" ), 1 , 1 , Qfalse );
2568
+ rb_attr (cSSLContext , rb_intern_const ("cert_store" ), 1 , 1 , Qfalse );
2571
2569
2572
2570
/*
2573
2571
* An Array of extra X509 certificates to be added to the certificate
@@ -2576,7 +2574,7 @@ Init_ossl_ssl(void)
2576
2574
* The _cert_, _key_, and _extra_chain_cert_ attributes are deprecated.
2577
2575
* It is recommended to use #add_certificate instead.
2578
2576
*/
2579
- rb_attr (cSSLContext , rb_intern ("extra_chain_cert" ), 1 , 1 , Qfalse );
2577
+ rb_attr (cSSLContext , rb_intern_const ("extra_chain_cert" ), 1 , 1 , Qfalse );
2580
2578
2581
2579
/*
2582
2580
* A callback invoked when a client certificate is requested by a server
@@ -2586,14 +2584,14 @@ Init_ossl_ssl(void)
2586
2584
* containing an OpenSSL::X509::Certificate and an OpenSSL::PKey. If any
2587
2585
* other value is returned the handshake is suspended.
2588
2586
*/
2589
- rb_attr (cSSLContext , rb_intern ("client_cert_cb" ), 1 , 1 , Qfalse );
2587
+ rb_attr (cSSLContext , rb_intern_const ("client_cert_cb" ), 1 , 1 , Qfalse );
2590
2588
2591
2589
/*
2592
2590
* Sets the context in which a session can be reused. This allows
2593
2591
* sessions for multiple applications to be distinguished, for example, by
2594
2592
* name.
2595
2593
*/
2596
- rb_attr (cSSLContext , rb_intern ("session_id_context" ), 1 , 1 , Qfalse );
2594
+ rb_attr (cSSLContext , rb_intern_const ("session_id_context" ), 1 , 1 , Qfalse );
2597
2595
2598
2596
/*
2599
2597
* A callback invoked on a server when a session is proposed by the client
@@ -2602,15 +2600,15 @@ Init_ossl_ssl(void)
2602
2600
* The callback is invoked with the SSLSocket and session id. The
2603
2601
* callback may return a Session from an external cache.
2604
2602
*/
2605
- rb_attr (cSSLContext , rb_intern ("session_get_cb" ), 1 , 1 , Qfalse );
2603
+ rb_attr (cSSLContext , rb_intern_const ("session_get_cb" ), 1 , 1 , Qfalse );
2606
2604
2607
2605
/*
2608
2606
* A callback invoked when a new session was negotiated.
2609
2607
*
2610
2608
* The callback is invoked with an SSLSocket. If +false+ is returned the
2611
2609
* session will be removed from the internal cache.
2612
2610
*/
2613
- rb_attr (cSSLContext , rb_intern ("session_new_cb" ), 1 , 1 , Qfalse );
2611
+ rb_attr (cSSLContext , rb_intern_const ("session_new_cb" ), 1 , 1 , Qfalse );
2614
2612
2615
2613
/*
2616
2614
* A callback invoked when a session is removed from the internal cache.
@@ -2621,7 +2619,7 @@ Init_ossl_ssl(void)
2621
2619
* multi-threaded application. The callback is called inside a global lock
2622
2620
* and it can randomly cause deadlock on Ruby thread switching.
2623
2621
*/
2624
- rb_attr (cSSLContext , rb_intern ("session_remove_cb" ), 1 , 1 , Qfalse );
2622
+ rb_attr (cSSLContext , rb_intern_const ("session_remove_cb" ), 1 , 1 , Qfalse );
2625
2623
2626
2624
rb_define_const (mSSLExtConfig , "HAVE_TLSEXT_HOST_NAME" , Qtrue );
2627
2625
@@ -2644,7 +2642,7 @@ Init_ossl_ssl(void)
2644
2642
* raise RuntimeError, "Client renegotiation disabled"
2645
2643
* end
2646
2644
*/
2647
- rb_attr (cSSLContext , rb_intern ("renegotiation_cb" ), 1 , 1 , Qfalse );
2645
+ rb_attr (cSSLContext , rb_intern_const ("renegotiation_cb" ), 1 , 1 , Qfalse );
2648
2646
#ifndef OPENSSL_NO_NEXTPROTONEG
2649
2647
/*
2650
2648
* An Enumerable of Strings. Each String represents a protocol to be
@@ -2657,7 +2655,7 @@ Init_ossl_ssl(void)
2657
2655
*
2658
2656
* ctx.npn_protocols = ["http/1.1", "spdy/2"]
2659
2657
*/
2660
- rb_attr (cSSLContext , rb_intern ("npn_protocols" ), 1 , 1 , Qfalse );
2658
+ rb_attr (cSSLContext , rb_intern_const ("npn_protocols" ), 1 , 1 , Qfalse );
2661
2659
/*
2662
2660
* A callback invoked on the client side when the client needs to select
2663
2661
* a protocol from the list sent by the server. Supported in OpenSSL 1.0.1
@@ -2674,7 +2672,7 @@ Init_ossl_ssl(void)
2674
2672
* protocols.first
2675
2673
* end
2676
2674
*/
2677
- rb_attr (cSSLContext , rb_intern ("npn_select_cb" ), 1 , 1 , Qfalse );
2675
+ rb_attr (cSSLContext , rb_intern_const ("npn_select_cb" ), 1 , 1 , Qfalse );
2678
2676
#endif
2679
2677
2680
2678
#ifdef HAVE_SSL_CTX_SET_ALPN_SELECT_CB
@@ -2689,7 +2687,7 @@ Init_ossl_ssl(void)
2689
2687
*
2690
2688
* ctx.alpn_protocols = ["http/1.1", "spdy/2", "h2"]
2691
2689
*/
2692
- rb_attr (cSSLContext , rb_intern ("alpn_protocols" ), 1 , 1 , Qfalse );
2690
+ rb_attr (cSSLContext , rb_intern_const ("alpn_protocols" ), 1 , 1 , Qfalse );
2693
2691
/*
2694
2692
* A callback invoked on the server side when the server needs to select
2695
2693
* a protocol from the list sent by the client. Supported in OpenSSL 1.0.2
@@ -2706,7 +2704,7 @@ Init_ossl_ssl(void)
2706
2704
* protocols.first
2707
2705
* end
2708
2706
*/
2709
- rb_attr (cSSLContext , rb_intern ("alpn_select_cb" ), 1 , 1 , Qfalse );
2707
+ rb_attr (cSSLContext , rb_intern_const ("alpn_select_cb" ), 1 , 1 , Qfalse );
2710
2708
#endif
2711
2709
2712
2710
rb_define_alias (cSSLContext , "ssl_timeout" , "timeout" );
@@ -2934,15 +2932,15 @@ Init_ossl_ssl(void)
2934
2932
#endif
2935
2933
2936
2934
2937
- sym_exception = ID2SYM (rb_intern ("exception" ));
2938
- sym_wait_readable = ID2SYM (rb_intern ("wait_readable" ));
2939
- sym_wait_writable = ID2SYM (rb_intern ("wait_writable" ));
2935
+ sym_exception = ID2SYM (rb_intern_const ("exception" ));
2936
+ sym_wait_readable = ID2SYM (rb_intern_const ("wait_readable" ));
2937
+ sym_wait_writable = ID2SYM (rb_intern_const ("wait_writable" ));
2940
2938
2941
- id_tmp_dh_callback = rb_intern ("tmp_dh_callback" );
2942
- id_npn_protocols_encoded = rb_intern ("npn_protocols_encoded" );
2939
+ id_tmp_dh_callback = rb_intern_const ("tmp_dh_callback" );
2940
+ id_npn_protocols_encoded = rb_intern_const ("npn_protocols_encoded" );
2943
2941
2944
2942
#define DefIVarID (name ) do \
2945
- id_i_##name = rb_intern ("@"#name); while (0)
2943
+ id_i_##name = rb_intern_const ("@"#name); while (0)
2946
2944
2947
2945
DefIVarID (cert_store );
2948
2946
DefIVarID (ca_file );
0 commit comments