Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of fsl_phy_mcr20a by
RNG_Interface.h
00001 /*! 00002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 00003 * All rights reserved. 00004 * 00005 * \file RNG_interface.h 00006 * RNG implementation header file for the ARM CORTEX-M4 processor 00007 * 00008 * Redistribution and use in source and binary forms, with or without modification, 00009 * are permitted provided that the following conditions are met: 00010 * 00011 * o Redistributions of source code must retain the above copyright notice, this list 00012 * of conditions and the following disclaimer. 00013 * 00014 * o Redistributions in binary form must reproduce the above copyright notice, this 00015 * list of conditions and the following disclaimer in the documentation and/or 00016 * other materials provided with the distribution. 00017 * 00018 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its 00019 * contributors may be used to endorse or promote products derived from this 00020 * software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00024 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00026 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00027 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00029 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00031 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 #ifndef _RNG_INTERFACE_H_ 00035 #define _RNG_INTERFACE_H_ 00036 00037 #include "EmbeddedTypes.h " 00038 00039 00040 /****************************************************************************** 00041 ******************************************************************************* 00042 * Public macros 00043 ******************************************************************************* 00044 ******************************************************************************/ 00045 #define gRNG_NoHWSupport_d 0 00046 #define gRNG_RNGAHWSupport_d 1 00047 #define gRNG_RNGBHWSupport_d 2 00048 #define gRNG_TRNGHWSupport_d 3 00049 00050 #ifndef gRNG_HWSupport_d 00051 #define gRNG_HWSupport_d gRNG_NoHWSupport_d 00052 #endif 00053 00054 #define gRngSuccess_d (0x00) 00055 #define gRngInternalError_d (0x01) 00056 #define gRngNullPointer_d (0x80) 00057 #define gRngMaxRequests_d (100000) 00058 00059 00060 /****************************************************************************** 00061 ******************************************************************************* 00062 * Public type definitions 00063 ******************************************************************************* 00064 ******************************************************************************/ 00065 00066 /****************************************************************************** 00067 ******************************************************************************* 00068 * Public memory declarations 00069 ******************************************************************************* 00070 ******************************************************************************/ 00071 00072 /****************************************************************************** 00073 ******************************************************************************* 00074 * Public function prototypes 00075 ******************************************************************************* 00076 ******************************************************************************/ 00077 00078 /****************************************************************************** 00079 * Name: RNG_Init() 00080 * Description: Initialize the RNG HW module 00081 * Parameter(s): - 00082 * Return: Status of the RNG module 00083 ******************************************************************************/ 00084 uint8_t RNG_Init(void); 00085 00086 /****************************************************************************** 00087 * Name: RNG_GetRandomNo() 00088 * Description: Reads a 32-bit statistically random number from the RNG module or from 802.15.4 PHY 00089 * Parameter(s): [OUT] pRandomNo - pointer to location where the RN will be stored 00090 * Return: none 00091 ******************************************************************************/ 00092 void RNG_GetRandomNo(uint32_t* pRandomNo); 00093 00094 /****************************************************************************** 00095 * Name: PRNG_SetSeed() 00096 * Description: Initialize seed for the PRNG algorithm. 00097 * Parameter(s): 00098 * pSeed - can be set using the RNG_GetRandomNo() function 00099 * Return: None 00100 ******************************************************************************/ 00101 void RNG_SetPseudoRandomNoSeed(uint8_t* pSeed); 00102 00103 /****************************************************************************** 00104 * Name: PRNG_GetRandomNo() 00105 * Description: Generates a NIST FIPS Publication 186-2-compliant 160 bit pseudo-random number 00106 * Parameter(s): 00107 * pOut - pointer to the output buffer 00108 * outBytes - the number of bytes to be copyed (1-20) 00109 * pXSEED - optional user SEED. Should be NULL if not used. 00110 * Return: The number of bytes copied or -1 if reseed is needed 00111 ******************************************************************************/ 00112 int16_t RNG_GetPseudoRandomNo(uint8_t* pOut, uint8_t outBytes, uint8_t* pXSEED); 00113 00114 #endif /* _RNG_INTERFACE_H_ */
Generated on Fri Jul 15 2022 21:41:18 by
