axtls: define curlssl_random using axTLS's PRNG
This commit is contained in:
@@ -664,4 +664,21 @@ size_t Curl_axtls_version(char *buffer, size_t size)
|
|||||||
return snprintf(buffer, size, "axTLS/%s", ssl_version());
|
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 */
|
#endif /* USE_AXTLS */
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ void Curl_axtls_session_free(void *ptr);
|
|||||||
size_t Curl_axtls_version(char *buffer, size_t size);
|
size_t Curl_axtls_version(char *buffer, size_t size);
|
||||||
int Curl_axtls_shutdown(struct connectdata *conn, int sockindex);
|
int Curl_axtls_shutdown(struct connectdata *conn, int sockindex);
|
||||||
int Curl_axtls_check_cxn(struct connectdata *conn);
|
int Curl_axtls_check_cxn(struct connectdata *conn);
|
||||||
|
int Curl_axtls_random(struct SessionHandle *data,
|
||||||
|
unsigned char *entropy,
|
||||||
|
size_t length);
|
||||||
|
|
||||||
/* API setup for axTLS */
|
/* API setup for axTLS */
|
||||||
#define curlssl_init Curl_axtls_init
|
#define curlssl_init Curl_axtls_init
|
||||||
@@ -62,6 +65,7 @@ int Curl_axtls_check_cxn(struct connectdata *conn);
|
|||||||
#define curlssl_version Curl_axtls_version
|
#define curlssl_version Curl_axtls_version
|
||||||
#define curlssl_check_cxn(x) Curl_axtls_check_cxn(x)
|
#define curlssl_check_cxn(x) Curl_axtls_check_cxn(x)
|
||||||
#define curlssl_data_pending(x,y) (x=x, y=y, 0)
|
#define curlssl_data_pending(x,y) (x=x, y=y, 0)
|
||||||
|
#define curlssl_random(x,y,z) Curl_axtls_random(x,y,z)
|
||||||
|
|
||||||
#endif /* USE_AXTLS */
|
#endif /* USE_AXTLS */
|
||||||
#endif /* HEADER_CURL_AXTLS_H */
|
#endif /* HEADER_CURL_AXTLS_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user