]> git.ipfire.org Git - thirdparty/openssl.git/blob - include/openssl/rand.h
157d1ef916783db14e8ddc53231c418b3b831995
[thirdparty/openssl.git] / include / openssl / rand.h
1 /*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
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
8 */
9
10 #ifndef HEADER_RAND_H
11 # define HEADER_RAND_H
12
13 # include <stdlib.h>
14 # include <openssl/ossl_typ.h>
15 # include <openssl/e_os2.h>
16 # include <openssl/randerr.h>
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 /* Already defined in ossl_typ.h */
23 /* typedef struct rand_meth_st RAND_METHOD; */
24
25 struct rand_meth_st {
26 int (*seed) (const void *buf, int num);
27 int (*bytes) (unsigned char *buf, int num);
28 void (*cleanup) (void);
29 int (*add) (const void *buf, int num, double entropy);
30 int (*pseudorand) (unsigned char *buf, int num);
31 int (*status) (void);
32 };
33
34 # ifdef BN_DEBUG
35 extern int rand_predictable;
36 # endif
37
38 int RAND_set_rand_method(const RAND_METHOD *meth);
39 const RAND_METHOD *RAND_get_rand_method(void);
40 # ifndef OPENSSL_NO_ENGINE
41 int RAND_set_rand_engine(ENGINE *engine);
42 # endif
43 RAND_METHOD *RAND_OpenSSL(void);
44 #if OPENSSL_API_COMPAT < 0x10100000L
45 # define RAND_cleanup() while(0) continue
46 #endif
47 int RAND_bytes(unsigned char *buf, int num);
48 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
49 void RAND_seed(const void *buf, int num);
50 #if defined(__ANDROID__) && defined(__NDK_FPABI__)
51 __NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */
52 #endif
53 void RAND_add(const void *buf, int num, double entropy);
54 int RAND_load_file(const char *file, long max_bytes);
55 int RAND_write_file(const char *file);
56 const char *RAND_file_name(char *file, size_t num);
57 int RAND_status(void);
58 # ifndef OPENSSL_NO_EGD
59 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
60 int RAND_egd(const char *path);
61 int RAND_egd_bytes(const char *path, int bytes);
62 # endif
63 int RAND_poll(void);
64
65 #if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H))
66 /* application has to include <windows.h> in order to use these */
67 DEPRECATEDIN_1_1_0(void RAND_screen(void))
68 DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM))
69 #endif
70
71 int ERR_load_RAND_strings(void);
72
73 # ifdef __cplusplus
74 }
75 # endif
76 #endif