mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #8437 from NXPmicro/Fix_TRNG_HAL
MCUXpresso: Fix for the TRNG HAL driverpull/8446/head
commit
00e3064f58
|
@ -22,6 +22,8 @@
|
||||||
* Reference: "K66 Sub-Family Reference Manual, Rev. 2", chapter 38
|
* Reference: "K66 Sub-Family Reference Manual, Rev. 2", chapter 38
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(DEVICE_TRNG)
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "fsl_common.h"
|
#include "fsl_common.h"
|
||||||
|
@ -48,6 +50,7 @@ void trng_free(trng_t *obj)
|
||||||
*/
|
*/
|
||||||
static void trng_get_byte(unsigned char *byte)
|
static void trng_get_byte(unsigned char *byte)
|
||||||
{
|
{
|
||||||
|
*byte = 0;
|
||||||
size_t bit;
|
size_t bit;
|
||||||
|
|
||||||
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
||||||
|
@ -62,7 +65,6 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
|
||||||
{
|
{
|
||||||
(void)obj;
|
(void)obj;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Set "Interrupt Mask", "High Assurance" and "Go",
|
/* Set "Interrupt Mask", "High Assurance" and "Go",
|
||||||
* unset "Clear interrupt" and "Sleep" */
|
* unset "Clear interrupt" and "Sleep" */
|
||||||
|
@ -81,3 +83,5 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Reference: "K64 Sub-Family Reference Manual, Rev. 2", chapter 34
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(DEVICE_TRNG)
|
#if defined(DEVICE_TRNG)
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -46,10 +42,11 @@ void trng_free(trng_t *obj)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get one byte of entropy from the RNG, assuming it is up and running.
|
* Get one byte of entropy from the RNG, assuming it is up and running.
|
||||||
* As recommended (34.1.1), get only one bit of each output.
|
* As recommended, get only one bit of each output.
|
||||||
*/
|
*/
|
||||||
static void trng_get_byte(unsigned char *byte)
|
static void trng_get_byte(unsigned char *byte)
|
||||||
{
|
{
|
||||||
|
*byte = 0;
|
||||||
size_t bit;
|
size_t bit;
|
||||||
|
|
||||||
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
||||||
|
@ -64,7 +61,6 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
|
||||||
{
|
{
|
||||||
(void)obj;
|
(void)obj;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Set "Interrupt Mask", "High Assurance" and "Go",
|
/* Set "Interrupt Mask", "High Assurance" and "Go",
|
||||||
* unset "Clear interrupt" and "Sleep" */
|
* unset "Clear interrupt" and "Sleep" */
|
||||||
|
|
|
@ -46,6 +46,7 @@ void trng_free(trng_t *obj)
|
||||||
*/
|
*/
|
||||||
static void trng_get_byte(unsigned char *byte)
|
static void trng_get_byte(unsigned char *byte)
|
||||||
{
|
{
|
||||||
|
*byte = 0;
|
||||||
size_t bit;
|
size_t bit;
|
||||||
|
|
||||||
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Reference: "K64 Sub-Family Reference Manual, Rev. 2", chapter 34
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(DEVICE_TRNG)
|
#if defined(DEVICE_TRNG)
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -46,10 +42,11 @@ void trng_free(trng_t *obj)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get one byte of entropy from the RNG, assuming it is up and running.
|
* Get one byte of entropy from the RNG, assuming it is up and running.
|
||||||
* As recommended (34.1.1), get only one bit of each output.
|
* As recommended, get only one bit of each output.
|
||||||
*/
|
*/
|
||||||
static void trng_get_byte(unsigned char *byte)
|
static void trng_get_byte(unsigned char *byte)
|
||||||
{
|
{
|
||||||
|
*byte = 0;
|
||||||
size_t bit;
|
size_t bit;
|
||||||
|
|
||||||
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
/* 34.5 Steps 3-4-5: poll SR and read from OR when ready */
|
||||||
|
|
Loading…
Reference in New Issue