blob: 17eb0a55b4a3afffb7badaace2142a6fd396e4ae (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* ctr_prng.h - TinyCrypt interface to an CTR-PRNG implementation */
#ifndef __TC_CTR_PRNG_H__
#define __TC_CTR_PRNG_H__
#include <tinycrypt/aes.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
/* updated each time another BLOCKLEN_BYTES bytes are produced */
uint8_t V[TC_AES_BLOCK_SIZE];
/* updated whenever the PRNG is reseeded */
struct tc_aes_key_sched_struct key;
/* number of requests since initialisation/reseeding */
uint64_t reseedCount;
} TCCtrPrng_t;
//todo comment
int32_t tc_ctr_prng_init(TCCtrPrng_t * const ctx,
uint8_t const entropy[],
uint32_t entropyLen,
uint8_t const personalization[],
uint32_t pLen);
//todo comment
int32_t tc_ctr_prng_reseed(TCCtrPrng_t * const ctx,
uint8_t const entropy[],
uint32_t entropyLen);
int32_t tc_ctr_prng_generate(TCCtrPrng_t * const ctx,
uint8_t out[],
uint32_t outlen);
#ifdef __cplusplus
}
#endif
#endif
|