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 | |
17 | #ifdef __cplusplus |
18 | extern "C" { |
19 | #endif |
20 | |
21 | /* Already defined in ossl_typ.h */ |
22 | /* typedef struct rand_meth_st RAND_METHOD; */ |
23 | |
24 | struct rand_meth_st { |
25 | int (*seed) (const void *buf, int num); |
26 | int (*bytes) (unsigned char *buf, int num); |
27 | void (*cleanup) (void); |
28 | int (*add) (const void *buf, int num, double entropy); |
29 | int (*pseudorand) (unsigned char *buf, int num); |
30 | int (*status) (void); |
31 | }; |
32 | |
33 | # ifdef BN_DEBUG |
34 | extern int rand_predictable; |
35 | # endif |
36 | |
37 | int RAND_set_rand_method(const RAND_METHOD *meth); |
38 | const RAND_METHOD *RAND_get_rand_method(void); |
39 | # ifndef OPENSSL_NO_ENGINE |
40 | int RAND_set_rand_engine(ENGINE *engine); |
41 | # endif |
42 | RAND_METHOD *RAND_OpenSSL(void); |
43 | #if OPENSSL_API_COMPAT < 0x10100000L |
44 | # define RAND_cleanup() while(0) continue |
45 | #endif |
46 | int RAND_bytes(unsigned char *buf, int num); |
47 | DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) |
48 | void RAND_seed(const void *buf, int num); |
49 | #if defined(__ANDROID__) && defined(__NDK_FPABI__) |
50 | __NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ |
51 | #endif |
52 | void RAND_add(const void *buf, int num, double entropy); |
53 | int RAND_load_file(const char *file, long max_bytes); |
54 | int RAND_write_file(const char *file); |
55 | const char *RAND_file_name(char *file, size_t num); |
56 | int RAND_status(void); |
57 | # ifndef OPENSSL_NO_EGD |
58 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); |
59 | int RAND_egd(const char *path); |
60 | int RAND_egd_bytes(const char *path, int bytes); |
61 | # endif |
62 | int RAND_poll(void); |
63 | |
64 | #if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) |
65 | /* application has to include <windows.h> in order to use these */ |
66 | DEPRECATEDIN_1_1_0(void RAND_screen(void)) |
67 | DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) |
68 | #endif |
69 | |
70 | /* BEGIN ERROR CODES */ |
71 | /* |
72 | * The following lines are auto generated by the script mkerr.pl. Any changes |
73 | * made after this point may be overwritten when the script is next run. |
74 | */ |
75 | |
76 | int ERR_load_RAND_strings(void); |
77 | |
78 | /* Error codes for the RAND functions. */ |
79 | |
80 | /* Function codes. */ |
81 | # define RAND_F_RAND_BYTES 100 |
82 | |
83 | /* Reason codes. */ |
84 | # define RAND_R_PRNG_NOT_SEEDED 100 |
85 | |
86 | # ifdef __cplusplus |
87 | } |
88 | # endif |
89 | #endif |
90 | |