diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2014-07-31 01:03:30 +0200 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2014-07-31 01:12:38 +0200 |
commit | 028a408d57cfcc891b9b88f1d56bc130980e11d0 (patch) | |
tree | 34728adea815d852d18752dc3166b0f8ff9d9c23 /lib/vtls/axtls.c | |
parent | 3d5be801b9cdf51c6056e48cd87c0225555f23da (diff) |
axtls: define curlssl_random using axTLS's PRNG
Diffstat (limited to 'lib/vtls/axtls.c')
-rw-r--r-- | lib/vtls/axtls.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c index 36cb7ad65..1b577b152 100644 --- a/lib/vtls/axtls.c +++ b/lib/vtls/axtls.c @@ -664,4 +664,21 @@ size_t Curl_axtls_version(char *buffer, size_t size) return snprintf(buffer, size, "axTLS/%s", ssl_version()); } +int Curl_axtls_random(struct SessionHandle *data, + unsigned char *entropy, + size_t length) +{ + static bool ssl_seeded = FALSE; + (void)data; + if(!ssl_seeded) { + ssl_seeded = TRUE; + /* Initialize the seed if not already done. This call is not exactly thread + * safe (and neither is the ssl_seeded check), but the worst effect of a + * race condition is that some global resources will leak. */ + RNG_initialize(); + } + get_random(length, entropy); + return 0; +} + #endif /* USE_AXTLS */ |