.\" $OpenBSD: RAND_bytes.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ .\" .Dd $Mdocdate: November 6 2016 $ .Dt RAND_BYTES 3 .Os .Sh NAME .Nm RAND_bytes , .Nm RAND_pseudo_bytes .Nd generate random data .Sh SYNOPSIS .In openssl/rand.h .Ft int .Fo RAND_bytes .Fa "unsigned char *buf" .Fa "int num" .Fc .Ft int .Fo RAND_pseudo_bytes .Fa "unsigned char *buf" .Fa "int num" .Fc .Sh DESCRIPTION .Fn RAND_bytes puts .Fa num cryptographically strong pseudo-random bytes into .Fa buf . .Pp .Fn RAND_pseudo_bytes puts .Fa num pseudo-random bytes into .Fa buf . Pseudo-random byte sequences generated by .Fn RAND_pseudo_bytes will be unique if they are of sufficient length, but are not necessarily unpredictable. They can be used for non-cryptographic purposes and for certain purposes in cryptographic protocols, but usually not for key generation etc. .Sh RETURN VALUES .Fn RAND_bytes returns 1. .Fn RAND_pseudo_bytes returns 1. .Sh SEE ALSO .Xr ERR_get_error 3 , .Xr RAND_add 3 .Sh HISTORY .Fn RAND_bytes is available in all versions of SSLeay and OpenSSL. It has a return value since OpenSSL 0.9.5. .Fn RAND_pseudo_bytes was added in OpenSSL 0.9.5.