]>
Commit | Line | Data |
---|---|---|
21dcbebc RS |
1 | /* |
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. | |
d02b48c6 | 3 | * |
21dcbebc RS |
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 | |
d02b48c6 RE |
8 | */ |
9 | ||
10 | #ifndef HEADER_RAND_H | |
0f113f3e | 11 | # define HEADER_RAND_H |
d02b48c6 | 12 | |
0f113f3e MC |
13 | # include <stdlib.h> |
14 | # include <openssl/ossl_typ.h> | |
15 | # include <openssl/e_os2.h> | |
fb96d9d9 | 16 | |
0f113f3e MC |
17 | # if defined(OPENSSL_SYS_WINDOWS) |
18 | # include <windows.h> | |
19 | # endif | |
627774fd | 20 | |
d02b48c6 RE |
21 | #ifdef __cplusplus |
22 | extern "C" { | |
23 | #endif | |
24 | ||
3a87a9b9 GT |
25 | /* Already defined in ossl_typ.h */ |
26 | /* typedef struct rand_meth_st RAND_METHOD; */ | |
27 | ||
0f113f3e MC |
28 | struct rand_meth_st { |
29 | int (*seed) (const void *buf, int num); | |
30 | int (*bytes) (unsigned char *buf, int num); | |
31 | void (*cleanup) (void); | |
32 | int (*add) (const void *buf, int num, double entropy); | |
33 | int (*pseudorand) (unsigned char *buf, int num); | |
34 | int (*status) (void); | |
35 | }; | |
36 | ||
37 | # ifdef BN_DEBUG | |
c9e1fe33 | 38 | extern int rand_predictable; |
0f113f3e | 39 | # endif |
c9e1fe33 | 40 | |
cb78486d GT |
41 | int RAND_set_rand_method(const RAND_METHOD *meth); |
42 | const RAND_METHOD *RAND_get_rand_method(void); | |
0f113f3e | 43 | # ifndef OPENSSL_NO_ENGINE |
cb78486d | 44 | int RAND_set_rand_engine(ENGINE *engine); |
0f113f3e | 45 | # endif |
b0700d2c | 46 | RAND_METHOD *RAND_OpenSSL(void); |
f3cd81d6 | 47 | #if OPENSSL_API_COMPAT < 0x10100000L |
6457615a | 48 | # define RAND_cleanup() while(0) continue |
f3cd81d6 | 49 | #endif |
0f113f3e | 50 | int RAND_bytes(unsigned char *buf, int num); |
98186eb4 | 51 | DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) |
0f113f3e | 52 | void RAND_seed(const void *buf, int num); |
449e3f26 AP |
53 | #if defined(__ANDROID__) && defined(__NDK_FPABI__) |
54 | __NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ | |
55 | #endif | |
0f113f3e MC |
56 | void RAND_add(const void *buf, int num, double entropy); |
57 | int RAND_load_file(const char *file, long max_bytes); | |
58 | int RAND_write_file(const char *file); | |
59 | const char *RAND_file_name(char *file, size_t num); | |
4ec2d4d2 | 60 | int RAND_status(void); |
0423f812 | 61 | # ifndef OPENSSL_NO_EGD |
6343829a | 62 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); |
4ec2d4d2 | 63 | int RAND_egd(const char *path); |
0f113f3e | 64 | int RAND_egd_bytes(const char *path, int bytes); |
0423f812 | 65 | # endif |
c0722725 | 66 | int RAND_poll(void); |
82271cee | 67 | |
0f113f3e | 68 | # if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
82271cee | 69 | |
d02b48c6 | 70 | void RAND_screen(void); |
c97b11f4 | 71 | int RAND_event(UINT, WPARAM, LPARAM); |
82271cee | 72 | |
0f113f3e | 73 | # endif |
627774fd | 74 | |
eb952088 | 75 | /* BEGIN ERROR CODES */ |
0f113f3e MC |
76 | /* |
77 | * The following lines are auto generated by the script mkerr.pl. Any changes | |
eb952088 UM |
78 | * made after this point may be overwritten when the script is next run. |
79 | */ | |
7ae551fd | 80 | void ERR_load_RAND_strings(void); |
eb952088 UM |
81 | |
82 | /* Error codes for the RAND functions. */ | |
83 | ||
84 | /* Function codes. */ | |
0f113f3e MC |
85 | # define RAND_F_FIPS_RAND 102 |
86 | # define RAND_F_FIPS_RAND_SET_DT 103 | |
87 | # define RAND_F_FIPS_SET_PRNG_SEED 104 | |
88 | # define RAND_F_FIPS_SET_TEST_MODE 105 | |
89 | # define RAND_F_FIPS_X931_SET_DT 106 | |
b0700d2c | 90 | # define RAND_F_RAND_BYTES 100 |
0f113f3e | 91 | # define RAND_F_RAND_GET_RAND_METHOD 101 |
eb952088 UM |
92 | |
93 | /* Reason codes. */ | |
0f113f3e MC |
94 | # define RAND_R_NOT_IN_TEST_MODE 101 |
95 | # define RAND_R_NO_KEY_SET 102 | |
96 | # define RAND_R_PRNG_ERROR 103 | |
97 | # define RAND_R_PRNG_KEYED 104 | |
98 | # define RAND_R_PRNG_NOT_SEEDED 100 | |
99 | # define RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY 105 | |
100 | # define RAND_R_PRNG_STUCK 106 | |
eb952088 | 101 | |
65e81670 BM |
102 | #ifdef __cplusplus |
103 | } | |
104 | #endif | |
d02b48c6 | 105 | #endif |