Select one of the symbols to view example projects that use it.
 
Outline
#include "mbedtls_config.h"
#include "main.h"
#include <string.h>
#include "mbedtls/entropy_poll.h"
mbedtls_hardware_poll(void *, unsigned char *, size_t, size_t *)
Files
loading...
CodeScopeSTM32 Libraries and SamplesSSL_ServerSrc/hardware_rng.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file hardware_rng.c * @author MCD Application Team * @brief mbedtls entropy data generator using the HAL_RNG API. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ #include "mbedtls_config.h" #ifdef MBEDTLS_ENTROPY_HARDWARE_ALT #include "main.h" #include <string.h> #include "mbedtls/entropy_poll.h" extern RNG_HandleTypeDef RngHandle; 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++) { if (HAL_RNG_GenerateRandomNumber(&RngHandle, &randomValue) == HAL_OK) { *oLen += 4; memset(&(Output[index * 4]), (int)randomValue, 4); }if (HAL_RNG_GenerateRandomNumber(&RngHandle, &randomValue) == HAL_OK) { ... } else { Error_Handler(); }else { ... } }for (index = 0; index < Len/4; index++) { ... } return 0; }{ ... } /* ... */#endif /*MBEDTLS_ENTROPY_HARDWARE_ALT*/