mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-11-03 20:33:16 +03:00 
			
		
		
		
	Zeroize temporary stack buffer
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
		@@ -321,10 +321,10 @@ static int ecp_drbg_random( void *p_rng, unsigned char *output, size_t output_le
 | 
				
			|||||||
    ecp_drbg_context *ctx = p_rng;
 | 
					    ecp_drbg_context *ctx = p_rng;
 | 
				
			||||||
    int ret;
 | 
					    int ret;
 | 
				
			||||||
    size_t len_done = 0;
 | 
					    size_t len_done = 0;
 | 
				
			||||||
 | 
					    uint8_t tmp[HASH_BLOCK_BYTES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while( len_done < output_len )
 | 
					    while( len_done < output_len )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        uint8_t tmp[HASH_BLOCK_BYTES];
 | 
					 | 
				
			||||||
        uint8_t use_len;
 | 
					        uint8_t use_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* We don't need to draw more that 255 blocks, so don't bother with
 | 
					        /* We don't need to draw more that 255 blocks, so don't bother with
 | 
				
			||||||
@@ -346,6 +346,8 @@ static int ecp_drbg_random( void *p_rng, unsigned char *output, size_t output_le
 | 
				
			|||||||
        len_done += use_len;
 | 
					        len_done += use_len;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mbedtls_platform_zeroize( tmp, sizeof( tmp ) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return( 0 );
 | 
					    return( 0 );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user