]>
git.ipfire.org Git - thirdparty/openssl.git/blob - include/openssl/rand.h
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
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
11 # define HEADER_RAND_H
14 # include <openssl/ossl_typ.h>
15 # include <openssl/e_os2.h>
17 # if defined(OPENSSL_SYS_WINDOWS)
25 /* Already defined in ossl_typ.h */
26 /* typedef struct rand_meth_st RAND_METHOD; */
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
);
38 extern int rand_predictable
;
41 int RAND_set_rand_method(const RAND_METHOD
*meth
);
42 const RAND_METHOD
*RAND_get_rand_method(void);
43 # ifndef OPENSSL_NO_ENGINE
44 int RAND_set_rand_engine(ENGINE
*engine
);
46 RAND_METHOD
*RAND_OpenSSL(void);
47 #if OPENSSL_API_COMPAT < 0x10100000L
48 # define RAND_cleanup() while(0) continue
50 int RAND_bytes(unsigned char *buf
, int num
);
51 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf
, int num
))
52 void RAND_seed(const void *buf
, int num
);
53 #if defined(__ANDROID__) && defined(__NDK_FPABI__)
54 __NDK_FPABI__
/* __attribute__((pcs("aapcs"))) on ARM */
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
);
60 int RAND_status(void);
61 # ifndef OPENSSL_NO_EGD
62 int RAND_query_egd_bytes(const char *path
, unsigned char *buf
, int bytes
);
63 int RAND_egd(const char *path
);
64 int RAND_egd_bytes(const char *path
, int bytes
);
68 # if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
70 void RAND_screen(void);
71 int RAND_event(UINT
, WPARAM
, LPARAM
);
75 /* BEGIN ERROR CODES */
77 * The following lines are auto generated by the script mkerr.pl. Any changes
78 * made after this point may be overwritten when the script is next run.
80 void ERR_load_RAND_strings(void);
82 /* Error codes for the RAND functions. */
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
90 # define RAND_F_RAND_BYTES 100
91 # define RAND_F_RAND_GET_RAND_METHOD 101
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