FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/random.c
/*
         * wc_Generates a RNG seed using the Random Number Generator Accelerator
         * on the Kinetis K70. Documentation located in Chapter 37 of
         * K70 Sub-Family Reference Manual (see Note 3 in the README for link).
         */
wc_Generates a RNG seed using the Random Number Generator Accelerator
on the Kinetis K70. Documentation located in Chapter 37 of
K70 Sub-Family Reference Manual .
wc_Generates a RNG seed using the Random Number Generator Accelerator on the Kinetis K70 . Documentation located in Chapter 37 of K70 Sub - Family Reference Manual .
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
        {
            word32 i;
            #if defined(SIM_SCGC3_RNGA_MASK)
                SIM_SCGC3 |= SIM_SCGC3_RNGA_MASK;
            #endif
            #if defined(SIM_SCGC6_RNGA_MASK)
                SIM_SCGC6 |= SIM_SCGC6_RNGA_MASK;
            #endif
            RNG_CR &= ~RNG_CR_SLP_MASK;
            RNG_CR |= RNG_CR_HA_MASK;
            RNG_CR |= RNG_CR_GO_MASK;
            for (i = 0; i < sz; i++) {
                while((RNG_SR & RNG_SR_OREG_LVL(0xF)) == 0) {}
                output[i] = RNG_OR;
            }
            return 0;
        }
int wc_GenerateSeed ( OS_Seed * os , byte * output , word32 sz ) { word32 i ; #if defined ( SIM_SCGC3_RNGA_MASK ) SIM_SCGC3 |= SIM_SCGC3_RNGA_MASK ; #endif #if defined ( SIM_SCGC6_RNGA_MASK ) SIM_SCGC6 |= SIM_SCGC6_RNGA_MASK ; #endif RNG_CR &= ~ RNG_CR_SLP_MASK ; RNG_CR |= RNG_CR_HA_MASK ; RNG_CR |= RNG_CR_GO_MASK ; for ( i = 0 ; i < sz ; i ++ ) { while ( ( RNG_SR & RNG_SR_OREG_LVL ( 0xF ) ) == 0 ) { } output [ i ] = RNG_OR ; } return 0 ; }
wc_Generates a RNG seed using the Random Number Generator Accelerator
 on the Kinetis K70.
wc_Generates a RNG seed using the Random Number Generator Accelerator on the Kinetis K70 .
/* turn on RNGA module */ /* additionally needed for at least K64F */ /* set SLP bit to 0 - "RNGA is not in sleep mode" */ /* set HA bit to 1 - "security violations masked" */ /* set GO bit to 1 - "output register loaded with data" */ /* wait for RNG FIFO to be full */ /* get value */