@@ -36,7 +36,7 @@ namespace rand {
3636 * \param bytes_to_read The number of random bytes to generate
3737 * \return Vector of random bytes
3838 */
39- bytes randombytes (std::size_t bytes_to_read) {
39+ inline bytes randombytes (std::size_t bytes_to_read) {
4040 bytes result (bytes_to_read);
4141 C::OQS_randombytes (result.data (), bytes_to_read);
4242 return result;
@@ -51,7 +51,7 @@ bytes randombytes(std::size_t bytes_to_read) {
5151 * \param [in] bytes_to_read The number of random bytes to generate
5252 * \param [out] random_array Output vector of random bytes
5353 */
54- void randombytes (bytes& random_array, std::size_t bytes_to_read) {
54+ inline void randombytes (bytes& random_array, std::size_t bytes_to_read) {
5555 if (bytes_to_read > random_array.size ())
5656 throw (std::out_of_range (
5757 " bytes_to_read exceeds the size of random_array" ));
@@ -65,19 +65,21 @@ void randombytes(bytes& random_array, std::size_t bytes_to_read) {
6565 * "OpenSSL", or the corresponding macros OQS_RAND_alg_system,
6666 * OQS_RAND_alg_nist_kat, and OQS_RAND_alg_openssl, respectively.
6767 */
68- void randombytes_switch_algorithm (const std::string& alg_name) {
68+ inline void randombytes_switch_algorithm (const std::string& alg_name) {
6969 if (C::OQS_randombytes_switch_algorithm (alg_name.c_str ()) != C::OQS_SUCCESS)
7070 throw std::runtime_error (" Can not switch algorithm" );
7171}
7272
7373/* *
74- * \brief Initializes the NIST DRBG with the \a entropy_input seed
74+ * \brief Initializes the NIST DRBG with the \a entropy_input seed. The security
75+ * parameter is 256 bits.
7576 * \param entropy_input Entropy input seed, must be exactly 48 bytes long
7677 * \param personalization_string Optional personalization string, which, if
7778 * non-empty, must be at least 48 bytes long
7879 */
79- void randombytes_nist_kat_init (const bytes& entropy_input,
80- const bytes& personalization_string = {}) {
80+ inline void
81+ randombytes_nist_kat_init_256bit (const bytes& entropy_input,
82+ const bytes& personalization_string = {}) {
8183 std::size_t len_str = personalization_string.size ();
8284
8385 if (entropy_input.size () != 48 )
@@ -87,20 +89,20 @@ void randombytes_nist_kat_init(const bytes& entropy_input,
8789 if (len_str < 48 )
8890 throw std::out_of_range (" The personalization string must be either "
8991 " empty or at least 48 bytes long" );
90- C::OQS_randombytes_nist_kat_init (entropy_input.data (),
91- personalization_string.data (), 256 );
92+ C::OQS_randombytes_nist_kat_init_256bit (entropy_input.data (),
93+ personalization_string.data ());
9294 return ;
9395 }
94- C::OQS_randombytes_nist_kat_init (entropy_input.data (), nullptr , 256 );
96+ C::OQS_randombytes_nist_kat_init_256bit (entropy_input.data (), nullptr );
9597}
9698
9799/* *
98100 * \brief Switches oqs::rand::randombytes() to use the given function
99101 * \note This allows additional custom RNGs besides the provided ones.
100102 * \param algorithm_ptr Pointer to RNG function
101103 */
102- void randombytes_custom_algorithm (void (*algorithm_ptr)(uint8_t *,
103- std::size_t )) {
104+ inline void randombytes_custom_algorithm (void (*algorithm_ptr)(uint8_t *,
105+ std::size_t )) {
104106 C::OQS_randombytes_custom_algorithm (algorithm_ptr);
105107}
106108} // namespace rand
0 commit comments