Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / rbg.h
1 #ifndef _IPXE_RBG_H
2 #define _IPXE_RBG_H
3
4 /** @file
5  *
6  * RBG mechanism
7  *
8  */
9
10 FILE_LICENCE ( GPL2_OR_LATER );
11
12 #include <stdint.h>
13 #include <ipxe/drbg.h>
14
15 /** An RBG */
16 struct random_bit_generator {
17         /** DRBG state */
18         struct drbg_state state;
19 };
20
21 extern struct random_bit_generator rbg;
22
23 /**
24  * Generate bits using RBG
25  *
26  * @v additional        Additional input
27  * @v additional_len    Length of additional input
28  * @v prediction_resist Prediction resistance is required
29  * @v data              Output buffer
30  * @v len               Length of output buffer
31  * @ret rc              Return status code
32  *
33  * This is the RBG_Generate function defined in ANS X9.82 Part 4
34  * (April 2011 Draft) Section 9.1.2.2.
35  */
36 static inline int rbg_generate ( const void *additional, size_t additional_len,
37                                  int prediction_resist, void *data,
38                                  size_t len ) {
39         return drbg_generate ( &rbg.state, additional, additional_len,
40                                prediction_resist, data, len );
41 }
42
43 #endif /* _IPXE_RBG_H */