Make methods of |RAND_SSLEay| do reasonable things.
This means e.g. that a caller can say: RAND_SSLEay()->bytes(...) and so on. But in exchange for this convenience, I've changed the signatures to be more BoringSSL-ish (|size_t| instead of |int|). That's fine; |RAND_set_rand_method(SSLEay())| still works. And by works I mean "does nothing". Change-Id: I35479b5efb759da910ce46e22298168b78c9edcf Reviewed-on: https://boringssl-review.googlesource.com/5472 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
879219b2c0
commit
bc97c69d76
@ -171,8 +171,14 @@ int RAND_status(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const struct rand_meth_st kSSLeayMethod = {NULL, NULL, NULL,
|
||||
NULL, NULL, NULL};
|
||||
static const struct rand_meth_st kSSLeayMethod = {
|
||||
RAND_seed,
|
||||
RAND_bytes,
|
||||
RAND_cleanup,
|
||||
RAND_add,
|
||||
RAND_pseudo_bytes,
|
||||
RAND_status,
|
||||
};
|
||||
|
||||
RAND_METHOD *RAND_SSLeay(void) {
|
||||
return (RAND_METHOD*) &kSSLeayMethod;
|
||||
|
@ -76,10 +76,10 @@ OPENSSL_EXPORT int RAND_status(void);
|
||||
* external so that variables of this type can be initialized. */
|
||||
struct rand_meth_st {
|
||||
void (*seed) (const void *buf, int num);
|
||||
int (*bytes) (unsigned char *buf, int num);
|
||||
int (*bytes) (uint8_t *buf, size_t num);
|
||||
void (*cleanup) (void);
|
||||
void (*add) (const void *buf, int num, double entropy);
|
||||
int (*pseudorand) (unsigned char *buf, int num);
|
||||
int (*pseudorand) (uint8_t *buf, size_t num);
|
||||
int (*status) (void);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user