-
Notifications
You must be signed in to change notification settings - Fork 0
/
random.c
25 lines (21 loc) · 881 Bytes
/
random.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/***********************************************************************************
* FourQlib: a high-performance crypto library based on the elliptic curve FourQ
*
* Abstract: pseudorandom generation function
*
* Author: Geovandro C. C. F. Pereira
************************************************************************************/
#include "../FourQ_internal.h"
#include "random.h"
#include <stdlib.h>
/**
* SECURITY NOTE: this function does not provide cryptographically secure pseudo-random numbers.
* Users are responsible for replacing it with a secure function for production.
*/
int random_bytes(unsigned char* random_array, unsigned int nbytes)
{ // Generation of "nbytes" of random values
for (uint8_t i = 0; i < nbytes; i++) {
random_array[i] = (unsigned char)rand();
}
return true;
}