/* smg_rsa.h * S.MG, 2017 */ #ifndef SMG_RSA_H #define SMG_RSA_H #include "mpi.h" #include "knobs.h" /*********truerandom.c*********/ /* * Opens and configures (as per FG requirements) the specified entropy source (e.g. "/dev/ttyUSB0") * @param source_name the name of the file to open (e.g. "/dev/ttyUSB0") * @return the descriptor of the open file when successful; negative value otherwise */ int open_entropy_source(char* source_name); /* * Returns noctets random octets (i.e. 8*noctets bits in total) as obtained from EuCrypt's preferred source. * Preferred source is defined in knobs.h as ENTROPY_SOURCE and should be a TRNG (e.g. Fuckgoats). * @param nboctets the length of desired random sequence, in octets * @param out pointer to allocated memory space for the requested random noctets; NB: this method does NOT allocate space! * @return the actual number of octets that were obtained from the currently configured entropy source (this is equal to noctets on successful read of required noctets) */ int get_random_octets(int noctets, unsigned char *out); /* Returns noctets random octets as obtained from the specified "from" source; * NB: the "from" source is considered to be the handle of an already opened stream; * This method will simply attempt to read from the source as needed! * * @param noctets the length of desired random sequence, in octets * @param out pointer to allocated memory space for the requested random octets; * NB: this method does NOT allocate space! * @param from handle of an already opened entropy source - this method will just READ from it as needed * @return the actual number of octets that were obtained */ int get_random_octets_from(int noctets, unsigned char *out, int from); #endif /*SMG_RSA*/