diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-10-16 14:32:33 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-17 04:56:06 -0700 |
commit | 95fdecb7b4898082b29f5e0f390b4dc794e5cbb6 (patch) | |
tree | 4f3cb355eafe8d860010bd692da82f96f2fcd73d /include/trng.h | |
parent | 0686445847dac456e867f96968b2ee29d7cce74a (diff) | |
download | chrome-ec-95fdecb7b4898082b29f5e0f390b4dc794e5cbb6.tar.gz |
common: expose true random number generator API
When supported, the true random number generator provide to API calls,
to initialize it and to retrieve a random number.
BRANCH=none
BUG=chrome-os-partner:43025
TEST=with other patches in place TPM2 gets proper random numbers
stream.
Change-Id: I11effdf6f81ca76581a354218203620708195b2b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/306688
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include/trng.h')
-rw-r--r-- | include/trng.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/trng.h b/include/trng.h new file mode 100644 index 0000000000..fe1c96825e --- /dev/null +++ b/include/trng.h @@ -0,0 +1,22 @@ +/* Copyright 2015 The Chromium OS Authors. All rights reserved. + * 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 + +/** + * 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. + **/ +uint32_t rand(void); + +#endif /* __EC_INCLUDE_TRNG_H */ |