diff options
author | Peiwei Hu <jlu.hpw@foxmail.com> | 2021-11-15 00:20:32 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-11-16 20:01:57 +1000 |
commit | 1373090503ecdcc93623218913477113d34883e1 (patch) | |
tree | f9ec145ed66f2ef9dcbc488bce125e1324810c3a /test | |
parent | 0b7dc2f52ba6c4b100284008fbd259f07687ad6f (diff) |
RAND_bytes_ex: fix return check
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17032)
(cherry picked from commit c9007bda79291179ed2df31b3dfd9f1311102847)
Diffstat (limited to 'test')
-rw-r--r-- | test/provfetchtest.c | 2 | ||||
-rw-r--r-- | test/sslapitest.c | 2 | ||||
-rw-r--r-- | test/tls-provider.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/test/provfetchtest.c b/test/provfetchtest.c index ca154dd463..95ae87910e 100644 --- a/test/provfetchtest.c +++ b/test/provfetchtest.c @@ -213,7 +213,7 @@ static int dummy_provider_init(const OSSL_CORE_HANDLE *handle, * Do some work using the child libctx, to make sure this is possible from * inside the init function. */ - if (!RAND_bytes_ex(libctx, buf, sizeof(buf), 0)) + if (RAND_bytes_ex(libctx, buf, sizeof(buf), 0) <= 0) return 0; return 1; diff --git a/test/sslapitest.c b/test/sslapitest.c index c85c8f42c3..3257e1ee36 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -1337,7 +1337,7 @@ static int execute_test_ktls_sendfile(int tls_version, const char *cipher) goto end; } - if (!TEST_true(RAND_bytes_ex(libctx, buf, SENDFILE_SZ, 0))) + if (!TEST_int_gt(RAND_bytes_ex(libctx, buf, SENDFILE_SZ, 0), 0)) goto end; out = BIO_new_file(tmpfilename, "wb"); diff --git a/test/tls-provider.c b/test/tls-provider.c index f8eeaeb363..9ac1db51b3 100644 --- a/test/tls-provider.c +++ b/test/tls-provider.c @@ -813,7 +813,7 @@ unsigned int randomize_tls_group_id(OSSL_LIB_CTX *libctx) int i; retry: - if (!RAND_bytes_ex(libctx, (unsigned char *)&group_id, sizeof(group_id), 0)) + if (RAND_bytes_ex(libctx, (unsigned char *)&group_id, sizeof(group_id), 0) <= 0) return 0; /* * Ensure group_id is within the IANA Reserved for private use range |