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