@@ -463,75 +463,6 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
463
463
#endif
464
464
}
465
465
466
- #if defined(OSSL_DEBUG )
467
- #if !defined(LIBRESSL_VERSION_NUMBER ) && \
468
- (OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(OPENSSL_NO_CRYPTO_MDEBUG ) || \
469
- defined(CRYPTO_malloc_debug_init ))
470
- /*
471
- * call-seq:
472
- * OpenSSL.mem_check_start -> nil
473
- *
474
- * Calls CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON). Starts tracking memory
475
- * allocations. See also OpenSSL.print_mem_leaks.
476
- *
477
- * This is available only when built with a capable OpenSSL and --enable-debug
478
- * configure option.
479
- */
480
- static VALUE
481
- mem_check_start (VALUE self )
482
- {
483
- CRYPTO_mem_ctrl (CRYPTO_MEM_CHECK_ON );
484
- return Qnil ;
485
- }
486
-
487
- /*
488
- * call-seq:
489
- * OpenSSL.print_mem_leaks -> true | false
490
- *
491
- * For debugging the Ruby/OpenSSL library. Calls CRYPTO_mem_leaks_fp(stderr).
492
- * Prints detected memory leaks to standard error. This cleans the global state
493
- * up thus you cannot use any methods of the library after calling this.
494
- *
495
- * Returns +true+ if leaks detected, +false+ otherwise.
496
- *
497
- * This is available only when built with a capable OpenSSL and --enable-debug
498
- * configure option.
499
- *
500
- * === Example
501
- * OpenSSL.mem_check_start
502
- * NOT_GCED = OpenSSL::PKey::RSA.new(256)
503
- *
504
- * END {
505
- * GC.start
506
- * OpenSSL.print_mem_leaks # will print the leakage
507
- * }
508
- */
509
- static VALUE
510
- print_mem_leaks (VALUE self )
511
- {
512
- #if OPENSSL_VERSION_NUMBER >= 0x10100000
513
- int ret ;
514
- #endif
515
-
516
- #ifndef HAVE_RB_EXT_RACTOR_SAFE
517
- // for Ruby 2.x
518
- void ossl_bn_ctx_free (void ); // ossl_bn.c
519
- ossl_bn_ctx_free ();
520
- #endif
521
-
522
- #if OPENSSL_VERSION_NUMBER >= 0x10100000
523
- ret = CRYPTO_mem_leaks_fp (stderr );
524
- if (ret < 0 )
525
- ossl_raise (eOSSLError , "CRYPTO_mem_leaks_fp" );
526
- return ret ? Qfalse : Qtrue ;
527
- #else
528
- CRYPTO_mem_leaks_fp (stderr );
529
- return Qnil ;
530
- #endif
531
- }
532
- #endif
533
- #endif
534
-
535
466
#if !defined(HAVE_OPENSSL_110_THREADING_API )
536
467
/**
537
468
* Stores locks needed for OpenSSL thread safety
@@ -1239,40 +1170,4 @@ Init_openssl(void)
1239
1170
Init_ossl_provider ();
1240
1171
Init_ossl_asn1 ();
1241
1172
Init_ossl_kdf ();
1242
-
1243
- #if defined(OSSL_DEBUG )
1244
- /*
1245
- * For debugging Ruby/OpenSSL. Enable only when built with --enable-debug
1246
- */
1247
- #if !defined(LIBRESSL_VERSION_NUMBER ) && \
1248
- (OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(OPENSSL_NO_CRYPTO_MDEBUG ) || \
1249
- defined(CRYPTO_malloc_debug_init ))
1250
- rb_define_module_function (mOSSL , "mem_check_start" , mem_check_start , 0 );
1251
- rb_define_module_function (mOSSL , "print_mem_leaks" , print_mem_leaks , 0 );
1252
-
1253
- #if defined(CRYPTO_malloc_debug_init ) /* <= 1.0.2 */
1254
- CRYPTO_malloc_debug_init ();
1255
- #endif
1256
-
1257
- #if defined(V_CRYPTO_MDEBUG_ALL ) /* <= 1.0.2 */
1258
- CRYPTO_set_mem_debug_options (V_CRYPTO_MDEBUG_ALL );
1259
- #endif
1260
-
1261
- #if OPENSSL_VERSION_NUMBER < 0x10100000 /* <= 1.0.2 */
1262
- {
1263
- int i ;
1264
- /*
1265
- * See crypto/ex_data.c; call def_get_class() immediately to avoid
1266
- * allocations. 15 is the maximum number that is used as the class index
1267
- * in OpenSSL 1.0.2.
1268
- */
1269
- for (i = 0 ; i <= 15 ; i ++ ) {
1270
- if (CRYPTO_get_ex_new_index (i , 0 , (void * )"ossl-mdebug-dummy" , 0 , 0 , 0 ) < 0 )
1271
- rb_raise (rb_eRuntimeError , "CRYPTO_get_ex_new_index for "
1272
- "class index %d failed" , i );
1273
- }
1274
- }
1275
- #endif
1276
- #endif
1277
- #endif
1278
1173
}
0 commit comments