mirror of
				https://github.com/yuzu-emu/mbedtls.git
				synced 2025-11-04 10:54:52 +00:00 
			
		
		
		
	Fix bug in rnd_pseudo_rnd() test helper function
Only the first 4 bytes of the output were set, the rest was untouched.
This commit is contained in:
		
							parent
							
								
									d83584e9aa
								
							
						
					
					
						commit
						ec8f2ffe90
					
				| 
						 | 
					@ -190,7 +190,7 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    rnd_pseudo_info *info = (rnd_pseudo_info *) rng_state;
 | 
					    rnd_pseudo_info *info = (rnd_pseudo_info *) rng_state;
 | 
				
			||||||
    uint32_t i, *k, sum, delta=0x9E3779B9;
 | 
					    uint32_t i, *k, sum, delta=0x9E3779B9;
 | 
				
			||||||
    unsigned char result[4];
 | 
					    unsigned char result[4], *out = output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if( rng_state == NULL )
 | 
					    if( rng_state == NULL )
 | 
				
			||||||
        return( rnd_std_rand( NULL, output, len ) );
 | 
					        return( rnd_std_rand( NULL, output, len ) );
 | 
				
			||||||
| 
						 | 
					@ -210,8 +210,9 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PUT_UINT32_BE( info->v0, result, 0 );
 | 
					        PUT_UINT32_BE( info->v0, result, 0 );
 | 
				
			||||||
        memcpy( output, result, use_len );
 | 
					        memcpy( out, result, use_len );
 | 
				
			||||||
        len -= use_len;
 | 
					        len -= use_len;
 | 
				
			||||||
 | 
					        out += 4;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return( 0 );
 | 
					    return( 0 );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue