mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
Add a driver for the STM32 True Random Number Generator. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:62991 TEST=adhoc on STM32L, craft console command and generate/dump buffers of random numbers. Change-Id: Ie7ce890cfc36a3b9a277715b17051e3e42fdfc96 Reviewed-on: https://chromium-review.googlesource.com/445777 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
43 lines
883 B
C
43 lines
883 B
C
/* 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
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* Initialize the true random number generator.
|
|
*
|
|
* Not supported by all platforms.
|
|
**/
|
|
void init_trng(void);
|
|
|
|
/**
|
|
* Shutdown the true random number generator.
|
|
*
|
|
* The opposite operation of init_trng(), disable the hardware resources
|
|
* used by the TRNG to save power.
|
|
*
|
|
* Not supported by all platforms.
|
|
**/
|
|
void exit_trng(void);
|
|
|
|
/**
|
|
* Retrieve a 32 bit random value.
|
|
*
|
|
* Not supported on all platforms.
|
|
**/
|
|
uint32_t rand(void);
|
|
|
|
/**
|
|
* Output len random bytes into buffer.
|
|
*
|
|
* Not supported on all platforms.
|
|
**/
|
|
void rand_bytes(void *buffer, size_t len);
|
|
|
|
#endif /* __EC_INCLUDE_TRNG_H */
|