iPXE
rbg.h
Go to the documentation of this file.
00001 #ifndef _IPXE_RBG_H
00002 #define _IPXE_RBG_H
00003 
00004 /** @file
00005  *
00006  * RBG mechanism
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/drbg.h>
00014 
00015 /** An RBG */
00016 struct random_bit_generator {
00017         /** DRBG state */
00018         struct drbg_state state;
00019 };
00020 
00021 extern struct random_bit_generator rbg;
00022 
00023 /**
00024  * Generate bits using RBG
00025  *
00026  * @v additional        Additional input
00027  * @v additional_len    Length of additional input
00028  * @v prediction_resist Prediction resistance is required
00029  * @v data              Output buffer
00030  * @v len               Length of output buffer
00031  * @ret rc              Return status code
00032  *
00033  * This is the RBG_Generate function defined in ANS X9.82 Part 4
00034  * (April 2011 Draft) Section 9.1.2.2.
00035  */
00036 static inline int rbg_generate ( const void *additional, size_t additional_len,
00037                                  int prediction_resist, void *data,
00038                                  size_t len ) {
00039         return drbg_generate ( &rbg.state, additional, additional_len,
00040                                prediction_resist, data, len );
00041 }
00042 
00043 #endif /* _IPXE_RBG_H */