Commit 961d74eb authored by Milan Broz's avatar Milan Broz
Browse files

OpenSSL crypto backend: check for maximal RAND_bytes buffer size

parent 6695c572
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -546,6 +546,9 @@ void crypt_hmac_destroy(struct crypt_hmac *ctx)
int crypt_backend_rng(char *buffer, size_t length,
	int quality __attribute__((unused)), int fips __attribute__((unused)))
{
	if (length > INT_MAX)
		return -EINVAL;

	if (RAND_bytes((unsigned char *)buffer, length) != 1)
		return -EINVAL;