File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22require_relative "utils"
33
4- require 'benchmark'
5-
64if defined? ( OpenSSL )
75
86class OpenSSL ::OSSL < OpenSSL ::SSLTestCase
@@ -44,6 +42,12 @@ def test_secure_compare
4442 end
4543
4644 def test_memcmp_timing
45+ begin
46+ require "benchmark"
47+ rescue LoadError
48+ pend "Benchmark is not available in this environment. Please install it with `gem install benchmark`."
49+ end
50+
4751 # Ensure using fixed_length_secure_compare takes almost exactly the same amount of time to compare two different strings.
4852 # Regular string comparison will short-circuit on the first non-matching character, failing this test.
4953 # NOTE: this test may be susceptible to noise if the system running the tests is otherwise under load.
You can’t perform that action at this time.
0 commit comments