1*10e00d17Sschwarze.\" $OpenBSD: RAND_bytes.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ 26043eef0Sschwarze.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 38974101aSjmc.\" 46043eef0Sschwarze.\" This file was written by Ulf Moeller <ulf@openssl.org>. 56043eef0Sschwarze.\" Copyright (c) 2000 The OpenSSL Project. All rights reserved. 66043eef0Sschwarze.\" 76043eef0Sschwarze.\" Redistribution and use in source and binary forms, with or without 86043eef0Sschwarze.\" modification, are permitted provided that the following conditions 96043eef0Sschwarze.\" are met: 106043eef0Sschwarze.\" 116043eef0Sschwarze.\" 1. Redistributions of source code must retain the above copyright 126043eef0Sschwarze.\" notice, this list of conditions and the following disclaimer. 136043eef0Sschwarze.\" 146043eef0Sschwarze.\" 2. Redistributions in binary form must reproduce the above copyright 156043eef0Sschwarze.\" notice, this list of conditions and the following disclaimer in 166043eef0Sschwarze.\" the documentation and/or other materials provided with the 176043eef0Sschwarze.\" distribution. 186043eef0Sschwarze.\" 196043eef0Sschwarze.\" 3. All advertising materials mentioning features or use of this 206043eef0Sschwarze.\" software must display the following acknowledgment: 216043eef0Sschwarze.\" "This product includes software developed by the OpenSSL Project 226043eef0Sschwarze.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 236043eef0Sschwarze.\" 246043eef0Sschwarze.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 256043eef0Sschwarze.\" endorse or promote products derived from this software without 266043eef0Sschwarze.\" prior written permission. For written permission, please contact 276043eef0Sschwarze.\" openssl-core@openssl.org. 286043eef0Sschwarze.\" 296043eef0Sschwarze.\" 5. Products derived from this software may not be called "OpenSSL" 306043eef0Sschwarze.\" nor may "OpenSSL" appear in their names without prior written 316043eef0Sschwarze.\" permission of the OpenSSL Project. 326043eef0Sschwarze.\" 336043eef0Sschwarze.\" 6. Redistributions of any form whatsoever must retain the following 346043eef0Sschwarze.\" acknowledgment: 356043eef0Sschwarze.\" "This product includes software developed by the OpenSSL Project 366043eef0Sschwarze.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 376043eef0Sschwarze.\" 386043eef0Sschwarze.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 396043eef0Sschwarze.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 406043eef0Sschwarze.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 416043eef0Sschwarze.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 426043eef0Sschwarze.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 436043eef0Sschwarze.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 446043eef0Sschwarze.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 456043eef0Sschwarze.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 466043eef0Sschwarze.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 476043eef0Sschwarze.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 486043eef0Sschwarze.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 496043eef0Sschwarze.\" OF THE POSSIBILITY OF SUCH DAMAGE. 506043eef0Sschwarze.\" 51*10e00d17Sschwarze.Dd $Mdocdate: March 27 2018 $ 52b6b28d4cSschwarze.Dt RAND_BYTES 3 53b6b28d4cSschwarze.Os 54b6b28d4cSschwarze.Sh NAME 55b6b28d4cSschwarze.Nm RAND_bytes , 56b6b28d4cSschwarze.Nm RAND_pseudo_bytes 57b6b28d4cSschwarze.Nd generate random data 58b6b28d4cSschwarze.Sh SYNOPSIS 59b6b28d4cSschwarze.In openssl/rand.h 60b6b28d4cSschwarze.Ft int 61b6b28d4cSschwarze.Fo RAND_bytes 62b6b28d4cSschwarze.Fa "unsigned char *buf" 63b6b28d4cSschwarze.Fa "int num" 64b6b28d4cSschwarze.Fc 65b6b28d4cSschwarze.Ft int 66b6b28d4cSschwarze.Fo RAND_pseudo_bytes 67b6b28d4cSschwarze.Fa "unsigned char *buf" 68b6b28d4cSschwarze.Fa "int num" 69b6b28d4cSschwarze.Fc 70b6b28d4cSschwarze.Sh DESCRIPTION 716043eef0SschwarzeThese functions are deprecated and only retained for compatibility 726043eef0Sschwarzewith legacy application programs. 736043eef0SschwarzeUse 746043eef0Sschwarze.Xr arc4random_buf 3 756043eef0Sschwarzeinstead. 766043eef0Sschwarze.Pp 77b6b28d4cSschwarze.Fn RAND_bytes 78b6b28d4cSschwarzeputs 79b6b28d4cSschwarze.Fa num 80b6b28d4cSschwarzecryptographically strong pseudo-random bytes into 81b6b28d4cSschwarze.Fa buf . 82b6b28d4cSschwarze.Pp 83b6b28d4cSschwarze.Fn RAND_pseudo_bytes 84b6b28d4cSschwarzeputs 85b6b28d4cSschwarze.Fa num 86b6b28d4cSschwarzepseudo-random bytes into 87b6b28d4cSschwarze.Fa buf . 88b6b28d4cSschwarzePseudo-random byte sequences generated by 89b6b28d4cSschwarze.Fn RAND_pseudo_bytes 90b6b28d4cSschwarzewill be unique if they are of sufficient length, but are not necessarily 91b6b28d4cSschwarzeunpredictable. 92b6b28d4cSschwarzeThey can be used for non-cryptographic purposes and for certain purposes 93b6b28d4cSschwarzein cryptographic protocols, but usually not for key generation etc. 94b6b28d4cSschwarze.Sh RETURN VALUES 95b6b28d4cSschwarze.Fn RAND_bytes 96b6b28d4cSschwarzereturns 1. 97b6b28d4cSschwarze.Fn RAND_pseudo_bytes 98b6b28d4cSschwarzereturns 1. 99b6b28d4cSschwarze.Sh HISTORY 100b6b28d4cSschwarze.Fn RAND_bytes 101*10e00d17Sschwarzefirst appeared in SSLeay 0.5.1 and has been available since 102f4821cf1Sschwarze.Ox 2.4 . 103958c08b5SschwarzeIt has a return value since OpenSSL 0.9.5 and 104958c08b5Sschwarze.Ox 2.7 . 105f4821cf1Sschwarze.Pp 106b6b28d4cSschwarze.Fn RAND_pseudo_bytes 107958c08b5Sschwarzefirst appeared in OpenSSL 0.9.5 and has been available since 108958c08b5Sschwarze.Ox 2.7 . 109