]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/rand.h
Add info on the CMP implementation and HTTP client to NEWS.md and CHANGES.md
[thirdparty/openssl.git] / include / openssl / rand.h
CommitLineData
21dcbebc 1/*
6738bf14 2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
48f4ad77 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
21dcbebc
RS
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
d02b48c6
RE
8 */
9
ae4186b0
DMSP
10#ifndef OPENSSL_RAND_H
11# define OPENSSL_RAND_H
d86167ec
DMSP
12# pragma once
13
14# include <openssl/macros.h>
936c2b9e 15# ifndef OPENSSL_NO_DEPRECATED_3_0
d86167ec
DMSP
16# define HEADER_RAND_H
17# endif
d02b48c6 18
0f113f3e 19# include <stdlib.h>
50cd4768 20# include <openssl/types.h>
0f113f3e 21# include <openssl/e_os2.h>
52df25cf 22# include <openssl/randerr.h>
fb96d9d9 23
d02b48c6
RE
24#ifdef __cplusplus
25extern "C" {
26#endif
27
0f113f3e
MC
28struct rand_meth_st {
29 int (*seed) (const void *buf, int num);
30 int (*bytes) (unsigned char *buf, int num);
31 void (*cleanup) (void);
f367ac2b 32 int (*add) (const void *buf, int num, double randomness);
0f113f3e
MC
33 int (*pseudorand) (unsigned char *buf, int num);
34 int (*status) (void);
35};
36
cb78486d
GT
37int RAND_set_rand_method(const RAND_METHOD *meth);
38const RAND_METHOD *RAND_get_rand_method(void);
0f113f3e 39# ifndef OPENSSL_NO_ENGINE
cb78486d 40int RAND_set_rand_engine(ENGINE *engine);
0f113f3e 41# endif
75e2c877 42
b0700d2c 43RAND_METHOD *RAND_OpenSSL(void);
75e2c877 44
00db8c60 45# ifndef OPENSSL_NO_DEPRECATED_1_1_0
12fb8c3d
RS
46# define RAND_cleanup() while(0) continue
47# endif
0f113f3e 48int RAND_bytes(unsigned char *buf, int num);
ddc6a5c8 49int RAND_priv_bytes(unsigned char *buf, int num);
993ebac9
MC
50
51/* Equivalent of RAND_priv_bytes() but additionally taking an OPENSSL_CTX */
52int RAND_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
53
54/* Equivalent of RAND_bytes() but additionally taking an OPENSSL_CTX */
55int RAND_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num);
56
98186eb4 57DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
75e2c877 58
0f113f3e 59void RAND_seed(const void *buf, int num);
c7504aeb 60void RAND_keep_random_devices_open(int keep);
75e2c877 61
12fb8c3d 62# if defined(__ANDROID__) && defined(__NDK_FPABI__)
dd6b2706 63__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */
12fb8c3d 64# endif
f367ac2b 65void RAND_add(const void *buf, int num, double randomness);
0f113f3e
MC
66int RAND_load_file(const char *file, long max_bytes);
67int RAND_write_file(const char *file);
68const char *RAND_file_name(char *file, size_t num);
4ec2d4d2 69int RAND_status(void);
75e2c877 70
0423f812 71# ifndef OPENSSL_NO_EGD
6343829a 72int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
4ec2d4d2 73int RAND_egd(const char *path);
0f113f3e 74int RAND_egd_bytes(const char *path, int bytes);
0423f812 75# endif
75e2c877 76
c0722725 77int RAND_poll(void);
82271cee 78
12fb8c3d 79# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H))
f1f5ee17 80/* application has to include <windows.h> in order to use these */
73241290
JY
81DEPRECATEDIN_1_1_0(void RAND_screen(void))
82DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM))
12fb8c3d 83# endif
73241290 84
eb952088 85
12fb8c3d 86#ifdef __cplusplus
65e81670 87}
12fb8c3d
RS
88#endif
89
d02b48c6 90#endif