summaryrefslogtreecommitdiff
path: root/include/trng.h
blob: abb776904b6c7aefd56d4594fbb7b0adaec9251f (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
/* Copyright 2015 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef __EC_INCLUDE_TRNG_H
#define __EC_INCLUDE_TRNG_H

#include <common.h>
#include <stddef.h>
#include <stdint.h>

/**
 * Initialize the true random number generator.
 *
 * Not supported by all platforms.
 **/
void init_trng(void);

/**
 * Retrieve a 32 bit random value.
 *
 * Not supported on all platforms.
 **/
#ifndef HIDE_EC_STDLIB
uint32_t rand(void);
#endif

/**
 * Output len random bytes into buffer.
 *
 * Not supported on all platforms.
 **/
void rand_bytes(void *buffer, size_t len);

#endif /* __EC_INCLUDE_TRNG_H */