RAND_set_rand_method returns int.

This improves compatibility with cryptography.io. cryptography.io
doesn't actually care what we return, since the code won't run, but
feigning success seems better than failure. If some application does try
to run this function and checks, returning an error will probably crash
it.

Change-Id: I7a8164753a2f1a7b31dbeb10c7030c5e5fea2bc9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46004
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
grpc-202302
David Benjamin 4 years ago committed by CQ bot account: commit-bot@chromium.org
parent eb5640bc44
commit 0a86cbff45
  1. 2
      crypto/rand_extra/rand_extra.c
  2. 4
      include/openssl/rand.h

@ -69,6 +69,6 @@ RAND_METHOD *RAND_OpenSSL(void) {
const RAND_METHOD *RAND_get_rand_method(void) { return RAND_SSLeay(); }
void RAND_set_rand_method(const RAND_METHOD *method) {}
int RAND_set_rand_method(const RAND_METHOD *method) { return 1; }
void RAND_cleanup(void) {}

@ -103,8 +103,8 @@ OPENSSL_EXPORT RAND_METHOD *RAND_OpenSSL(void);
// RAND_get_rand_method returns |RAND_SSLeay()|.
OPENSSL_EXPORT const RAND_METHOD *RAND_get_rand_method(void);
// RAND_set_rand_method does nothing.
OPENSSL_EXPORT void RAND_set_rand_method(const RAND_METHOD *);
// RAND_set_rand_method returns one.
OPENSSL_EXPORT int RAND_set_rand_method(const RAND_METHOD *);
#if defined(__cplusplus)

Loading…
Cancel
Save