2020
2121
2222#include <stdlib.h>
23+ #include <string.h>
2324#include "cmsis.h"
2425#include "NUC472_442.h"
25-
26+ #include "us_ticker_api.h"
2627
2728/*
2829 * Get Random number generator.
@@ -37,10 +38,12 @@ void CRYPTO_IRQHandler()
3738 }
3839}
3940
40- static void rng_get ( int32_t * p32ConversionData )
41+ static void rng_get (unsigned char * pConversionData )
4142{
42- int32_t i32ConversionData ;
43- uint32_t au32PrngData [8 ];
43+ uint32_t * p32ConversionData ;
44+
45+ p32ConversionData = (uint32_t * )pConversionData ;
46+
4447 /* Unlock protected registers */
4548 SYS_UnlockReg ();
4649 /* Enable IP clock */
@@ -53,19 +56,19 @@ static void rng_get( int32_t *p32ConversionData)
5356 PRNG_ENABLE_INT ();
5457
5558// PRNG_Open(PRNG_KEY_SIZE_64, 0, 0);
56- PRNG_Open (PRNG_KEY_SIZE_256 , 1 , us_ticker_read ());
59+ PRNG_Open (PRNG_KEY_SIZE_256 , 1 , us_ticker_read ());
5760 PRNG_Start ();
5861 while (!g_PRNG_done );
5962
6063
6164 PRNG_Read (p32ConversionData );
6265
63- // printf(" 0x%08x 0x%08x 0x%08x 0x%08x\n\r", *p32ConversionData, *(p32ConversionData+1), *(p32ConversionData+2), *(p32ConversionData+3));
66+ // printf(" 0x%08x 0x%08x 0x%08x 0x%08x\n\r", *p32ConversionData, *(p32ConversionData+1), *(p32ConversionData+2), *(p32ConversionData+3));
6467// printf(" 0x%08x 0x%08x 0x%08x 0x%08x\n\r", *(p32ConversionData+4), *(p32ConversionData+5), *(p32ConversionData+6), *(p32ConversionData+7));
6568
6669 PRNG_DISABLE_INT ();
6770 NVIC_DisableIRQ (CRPT_IRQn );
68- CLK_DisableModuleClock (CRPT_MODULE );
71+ // CLK_DisableModuleClock(CRPT_MODULE);
6972
7073}
7174
0 commit comments