-
+ 54AFE77A6A278EB793ECF8CA19CD3B1DEC64AE9D59826DCAD3ABC4DF46C0C3BC7A16E178A05690BF930C1935A94DD12EB635E6D37B4F6F89CB478FD92A2A0B7A
eucrypt/smg_rsa/include/smg_rsa.h
(0 . 0)(1 . 44)
70 /* smg_rsa.h
71 * S.MG, 2017
72 */
73
74 #ifndef SMG_RSA_H
75 #define SMG_RSA_H
76
77 #include "mpi.h"
78 #include "knobs.h"
79
80 /*********truerandom.c*********/
81
82 /*
83 * Opens and configures (as per FG requirements) the specified entropy source (e.g. "/dev/ttyUSB0")
84 * @param source_name the name of the file to open (e.g. "/dev/ttyUSB0")
85 * @return the descriptor of the open file when successful; negative value otherwise
86 */
87 int open_entropy_source(char* source_name);
88
89
90 /*
91 * Returns noctets random octets (i.e. 8*noctets bits in total) as obtained from EuCrypt's preferred source.
92 * Preferred source is defined in knobs.h as ENTROPY_SOURCE and should be a TRNG (e.g. Fuckgoats).
93 * @param nboctets the length of desired random sequence, in octets
94 * @param out pointer to allocated memory space for the requested random noctets; NB: this method does NOT allocate space!
95 * @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)
96 */
97 int get_random_octets(int noctets, unsigned char *out);
98
99 /* Returns noctets random octets as obtained from the specified "from" source;
100 * NB: the "from" source is considered to be the handle of an already opened stream;
101 * This method will simply attempt to read from the source as needed!
102 *
103 * @param noctets the length of desired random sequence, in octets
104 * @param out pointer to allocated memory space for the requested random octets;
105 * NB: this method does NOT allocate space!
106 * @param from handle of an already opened entropy source - this method will just READ from it as needed
107 * @return the actual number of octets that were obtained
108 */
109 int get_random_octets_from(int noctets, unsigned char *out, int from);
110
111
112 #endif /*SMG_RSA*/
113