提交 0a94f16b 编写于 作者: J Joshua Peek

Fallback to Ruby's pseudo random number generator if the system does not have SHA512 installed.

上级 de8b0087
......@@ -76,7 +76,12 @@ def generate_secret_with_openssl
OpenSSL::Random.seed(rand(0).to_s + Time.now.usec.to_s)
end
data = OpenSSL::BN.rand(2048, -1, false).to_s
return OpenSSL::Digest::SHA512.new(data).hexdigest
if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000
OpenSSL::Digest::SHA512.new(data).hexdigest
else
generate_secret_with_prng
end
end
# Generate a random secret key with /dev/urandom.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册