| 
									
										
										
										
											2021-10-29 10:09:53 +05:30
										 |  |  | /*
 | 
					
						
							|  |  |  |  * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: Apache-2.0 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-05-28 18:43:32 +05:30
										 |  |  | #include <mbedtls/build_info.h>
 | 
					
						
							| 
									
										
										
										
											2016-08-30 20:40:58 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <sys/types.h>
 | 
					
						
							|  |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							| 
									
										
										
										
											2022-01-12 12:23:47 +05:30
										 |  |  | #include "esp_random.h"
 | 
					
						
							| 
									
										
										
										
											2016-09-02 11:31:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-10 09:13:44 +05:30
										 |  |  | #include <entropy_poll.h>
 | 
					
						
							| 
									
										
										
										
											2018-11-11 15:44:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 18:20:16 +10:00
										 |  |  | #ifndef MBEDTLS_ENTROPY_HARDWARE_ALT
 | 
					
						
							|  |  |  | #error "MBEDTLS_ENTROPY_HARDWARE_ALT should always be set in ESP-IDF"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2016-08-30 20:40:58 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | int mbedtls_hardware_poll( void *data, | 
					
						
							|  |  |  |                            unsigned char *output, size_t len, size_t *olen ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-15 18:20:16 +10:00
										 |  |  |     esp_fill_random(output, len); | 
					
						
							| 
									
										
										
										
											2016-09-02 11:31:38 +08:00
										 |  |  |     *olen = len; | 
					
						
							|  |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2016-08-30 20:40:58 +08:00
										 |  |  | } |