mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
cyassl: use RNG_GenerateBlock to generate a good random number
This commit is contained in:
parent
524bb823c9
commit
1aa6418af9
@ -54,6 +54,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <cyassl/error.h>
|
#include <cyassl/error.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <cyassl/ctaocrypt/random.h>
|
||||||
|
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
@ -638,4 +639,17 @@ Curl_cyassl_connect(struct connectdata *conn,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Curl_cyassl_random(struct SessionHandle *data,
|
||||||
|
unsigned char *entropy,
|
||||||
|
size_t length)
|
||||||
|
{
|
||||||
|
RNG rng;
|
||||||
|
(void)data;
|
||||||
|
if(InitRng(&rng))
|
||||||
|
return 1;
|
||||||
|
if(RNG_GenerateBlock(&rng, entropy, length))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,6 +43,9 @@ int Curl_cyassl_init(void);
|
|||||||
CURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,
|
CURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,
|
||||||
int sockindex,
|
int sockindex,
|
||||||
bool *done);
|
bool *done);
|
||||||
|
int Curl_cyassl_random(struct SessionHandle *data,
|
||||||
|
unsigned char *entropy,
|
||||||
|
size_t length);
|
||||||
|
|
||||||
/* API setup for CyaSSL */
|
/* API setup for CyaSSL */
|
||||||
#define curlssl_init Curl_cyassl_init
|
#define curlssl_init Curl_cyassl_init
|
||||||
@ -59,9 +62,7 @@ CURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,
|
|||||||
#define curlssl_version Curl_cyassl_version
|
#define curlssl_version Curl_cyassl_version
|
||||||
#define curlssl_check_cxn(x) (x=x, -1)
|
#define curlssl_check_cxn(x) (x=x, -1)
|
||||||
#define curlssl_data_pending(x,y) Curl_cyassl_data_pending(x,y)
|
#define curlssl_data_pending(x,y) Curl_cyassl_data_pending(x,y)
|
||||||
|
#define curlssl_random(x,y,z) Curl_cyassl_random(x,y,z)
|
||||||
/* this might cause libcurl to use a weeker random! */
|
|
||||||
#define curlssl_random(x,y,z) (x=x, y=y, z=z, CURLE_NOT_BUILT_IN)
|
|
||||||
|
|
||||||
#endif /* USE_CYASSL */
|
#endif /* USE_CYASSL */
|
||||||
#endif /* HEADER_CURL_CYASSL_H */
|
#endif /* HEADER_CURL_CYASSL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user