34 lines
		
	
	
		
			491 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			491 B
		
	
	
	
		
			C
		
	
	
	
	
	
| 
 | |
| #include <stdio.h>
 | |
| #include <string.h>
 | |
| #include "iot_io.h"
 | |
| #include "sec_sys.h"
 | |
| 
 | |
| 
 | |
| #define mbedtls_printf iot_printf
 | |
| 
 | |
| static unsigned char rng_buf[128];
 | |
| 
 | |
| int rng_main()
 | |
| {
 | |
|     unsigned int len = 128;
 | |
|     int loop = 100;
 | |
|     int i, j;
 | |
| 
 | |
|     sec_sys_rng_init();
 | |
| 
 | |
|     for(i = 0; i < loop; i++) {
 | |
|     	sec_sys_rng_get_random(rng_buf, len);
 | |
| 
 | |
| 		mbedtls_printf("R%d:\n", i+1);
 | |
| 
 | |
| 		for(j = 0; j < len; j++){
 | |
| 			mbedtls_printf("%02x ", rng_buf[j]);
 | |
| 		}
 | |
| 
 | |
| 		mbedtls_printf( "\n" );
 | |
|     }
 | |
| 
 | |
|     return 0;
 | |
| }
 |