File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
components/esp_hw_support/port/linux Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -17,22 +17,29 @@ static void __attribute__((constructor)) esp_random_init(void) { }
1717uint32_t esp_random (void )
1818{
1919 uint32_t random_number ;
20- assert (getentropy (& random_number , sizeof (random_number )) == 0 );
20+ int result = getentropy (& random_number , sizeof (random_number ));
21+ assert (result == 0 );
22+ (void )result ;
2123 return random_number ;
2224}
2325
2426void esp_fill_random (void * buf , size_t len )
2527{
2628 assert (buf != NULL );
29+ int result ;
2730
2831 // Note that we can't use getentropy() with len > 256 directly (see getentropy man page),
2932 // hence reading in chunks
3033 const size_t FULL_CHUNKS_NUM = (len / GETENTROPY_MAX_LEN );
3134 const size_t REST_CHUNK_SIZE = len % GETENTROPY_MAX_LEN ;
3235
3336 for (size_t chunk_num = 0 ; chunk_num < FULL_CHUNKS_NUM ; chunk_num ++ ) {
34- assert (getentropy (buf + chunk_num * GETENTROPY_MAX_LEN , GETENTROPY_MAX_LEN ) == 0 );
37+ result = getentropy (buf + chunk_num * GETENTROPY_MAX_LEN , GETENTROPY_MAX_LEN );
38+ assert (result == 0 );
39+ (void )result ;
3540 }
3641
37- assert (getentropy (buf + FULL_CHUNKS_NUM * GETENTROPY_MAX_LEN , REST_CHUNK_SIZE ) == 0 );
42+ result = getentropy (buf + FULL_CHUNKS_NUM * GETENTROPY_MAX_LEN , REST_CHUNK_SIZE );
43+ assert (result == 0 );
44+ (void )result ;
3845}
You can’t perform that action at this time.
0 commit comments