curl / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] Curl_rand: fixed and moved to rand.c

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 11 Nov 2016 23:43:36 +0100 (CET)

Hi friends,

I mean to land this patch (see attachment).

As I've recently cleaned up some of the OpenSSL code[1] to make sure it exists
out with an error if it can't seend the PRNG properly I follow up with some
further changes in that direction.

Now Curl_rand() is made to fail if it cannot get the necessary random level.
Also as a consequence of the fix, when built with a "proper" TLS backend[2],
the code will never fall back to a pseudo random function

I changed the proto of Curl_rand() slightly to provide a number of ints at
once.

Moved out the function from vtls in a the new lib/rand.c file, since it isn't
a TLS function and vtls already provides Curl_ssl_random() for this function
to use.

All tests still run fine.

Comments, suggestions or complaints? Fire them away!

[1] = mostly for OpenSSL versions before 1.1.0

[2] = The gskit, polarssl and mbedtls backends don't have random data
functions in libcurl so they get the same "lame" version provided as when
built entirely without TLS support built-in.

-- 
  / daniel.haxx.se


-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2016-11-11