/**
  ******************************************************************************
  * @file    hardware_rng.c
  * @author  MCD Application Team
  * @version V1.1.0
  * @date    17-February-2017
  * @brief   mbedtls entropy data generator using the HAL_RNG API.
  ******************************************************************************
  * @attention
  *
  * 
© COPYRIGHT(c) 2017 STMicroelectronics
  *
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  * You may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
  *
  *        http://www.st.com/software_license_agreement_liberty_v2
  *
  * Unless required by applicable law or agreed to in writing, software 
  * distributed under the License is distributed on an "AS IS" BASIS, 
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
  ******************************************************************************
  */
#include "mbedtls_config.h"
#include "rng.h"
#ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
#include "main.h"
#include 
#include "mbedtls/entropy_poll.h"
int mbedtls_hardware_poll( void *Data, unsigned char *Output, size_t Len, size_t *oLen )
{
  uint32_t index;
  uint32_t randomValue;
		
  for (index = 0; index < Len/4; index++)
  {
    randomValue = GetRandomNumber();
    *oLen += 4;
    memset(&(Output[index * 4]), (int)randomValue, 4);
  }
  
  return 0;
}
#endif /*MBEDTLS_ENTROPY_HARDWARE_ALT*/