Remove an unused file
[openssl.git] / include / internal / rand.h
1 /*
2  * Copyright 2017 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_DRBG_RAND_H
11 # define HEADER_DRBG_RAND_H
12
13 /* In CTR mode, use derivation function ctr_df */
14 #define RAND_DRBG_FLAG_CTR_USE_DF            0x2
15
16 /*
17  * Object lifetime functions.
18  */
19 RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent);
20 int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags);
21 int RAND_DRBG_instantiate(RAND_DRBG *drbg,
22                           const unsigned char *pers, size_t perslen);
23 int RAND_DRBG_uninstantiate(RAND_DRBG *drbg);
24 void RAND_DRBG_free(RAND_DRBG *drbg);
25
26 /*
27  * Object "use" functions.
28  */
29 int RAND_DRBG_reseed(RAND_DRBG *drbg,
30                      const unsigned char *adin, size_t adinlen);
31 int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,
32                        int prediction_resistance,
33                        const unsigned char *adin, size_t adinlen);
34 int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, int interval);
35 RAND_DRBG *RAND_DRBG_get0_global(void);
36 RAND_DRBG *RAND_DRBG_get0_priv_global(void);
37
38 /*
39  * EXDATA
40  */
41 #define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \
42     CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef)
43 int RAND_DRBG_set_ex_data(RAND_DRBG *dctx, int idx, void *arg);
44 void *RAND_DRBG_get_ex_data(const RAND_DRBG *dctx, int idx);
45
46 /*
47  * Callback functions.  See comments in drbg_lib.c
48  */
49 typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *ctx,
50                                            unsigned char **pout,
51                                            int entropy, size_t min_len,
52                                            size_t max_len);
53 typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx,
54                                              unsigned char *out, size_t outlen);
55 typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *ctx, unsigned char **pout,
56                                          int entropy, size_t min_len,
57                                          size_t max_len);
58 typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *ctx,
59                                            unsigned char *out, size_t outlen);
60
61 int RAND_DRBG_set_callbacks(RAND_DRBG *dctx,
62                             RAND_DRBG_get_entropy_fn get_entropy,
63                             RAND_DRBG_cleanup_entropy_fn cleanup_entropy,
64                             RAND_DRBG_get_nonce_fn get_nonce,
65                             RAND_DRBG_cleanup_nonce_fn cleanup_nonce);
66
67 #endif