openssl/rand.h: fix formatting.
[openssl.git] / include / openssl / rand.h
1 /*
2  * Copyright 1995-2018 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 struct rand_meth_st {
23     int (*seed) (const void *buf, int num);
24     int (*bytes) (unsigned char *buf, int num);
25     void (*cleanup) (void);
26     int (*add) (const void *buf, int num, double randomness);
27     int (*pseudorand) (unsigned char *buf, int num);
28     int (*status) (void);
29 };
30
31 int RAND_set_rand_method(const RAND_METHOD *meth);
32 const RAND_METHOD *RAND_get_rand_method(void);
33 # ifndef OPENSSL_NO_ENGINE
34 int RAND_set_rand_engine(ENGINE *engine);
35 # endif
36
37 RAND_METHOD *RAND_OpenSSL(void);
38
39 # if OPENSSL_API_COMPAT < 0x10100000L
40 #   define RAND_cleanup() while(0) continue
41 # endif
42 int RAND_bytes(unsigned char *buf, int num);
43 int RAND_priv_bytes(unsigned char *buf, int num);
44 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
45
46 void RAND_seed(const void *buf, int num);
47
48 # if defined(__ANDROID__) && defined(__NDK_FPABI__)
49 __NDK_FPABI__   /* __attribute__((pcs("aapcs"))) on ARM */
50 # endif
51 void RAND_add(const void *buf, int num, double randomness);
52 int RAND_load_file(const char *file, long max_bytes);
53 int RAND_write_file(const char *file);
54 const char *RAND_file_name(char *file, size_t num);
55 int RAND_status(void);
56
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
63 typedef void (*RAND_poll_cb)(void *arg,
64                              const void *buf, int num, double randomness);
65 int RAND_poll(void);
66
67 # if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H))
68 /* application has to include <windows.h> in order to use these */
69 DEPRECATEDIN_1_1_0(void RAND_screen(void))
70 DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM))
71 # endif
72
73
74 #ifdef  __cplusplus
75 }
76 #endif
77
78 #endif