diff --git a/lib/http/__init__.py b/lib/http/__init__.py index c98fa586dd10323f265ec11cd01f0b5e884f93e7..a1f5e86ed9b0e3e30605ad21d40963fac3bb84ae 100644 --- a/lib/http/__init__.py +++ b/lib/http/__init__.py @@ -545,6 +545,19 @@ def Handshake(sock, write_timeout): raise HttpError("Error in SSL handshake: %s" % err) +def InitSsl(): + """Initializes the SSL infrastructure. + + This function is idempotent. + + """ + if not OpenSSL.rand.status(): + raise EnvironmentError("OpenSSL could not collect enough entropy" + " for the PRNG") + + # TODO: Maybe add some additional seeding for OpenSSL's PRNG + + class HttpSslParams(object): """Data class for SSL key and certificate. diff --git a/lib/rpc.py b/lib/rpc.py index edcb9d7e7c48d55edda4943652187bd9e4545a20..f354a418cc53a7c6fba0abe9fad4a4de187852cc 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -59,6 +59,8 @@ def Init(): assert not _http_manager, "RPC module initialized more than once" + http.InitSsl() + _http_manager = http.client.HttpClientManager()