summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/RAND_bytes.3
blob: 8c17454548bb2069354b5394687efa973480d565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.\"	$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.