mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Apply same argument checking as in psa_hash_setup
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
		
							parent
							
								
									d50db945c4
								
							
						
					
					
						commit
						f66d5fd2bd
					
				@ -2277,6 +2277,9 @@ psa_status_t psa_hash_compute( psa_algorithm_t alg,
 | 
				
			|||||||
                               uint8_t *hash, size_t hash_size,
 | 
					                               uint8_t *hash, size_t hash_size,
 | 
				
			||||||
                               size_t *hash_length )
 | 
					                               size_t *hash_length )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if( !PSA_ALG_IS_HASH( alg ) )
 | 
				
			||||||
 | 
					        return( PSA_ERROR_INVALID_ARGUMENT );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return( psa_driver_wrapper_hash_compute( alg, input, input_length,
 | 
					    return( psa_driver_wrapper_hash_compute( alg, input, input_length,
 | 
				
			||||||
                                             hash, hash_size, hash_length ) );
 | 
					                                             hash, hash_size, hash_length ) );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -2287,6 +2290,10 @@ psa_status_t psa_hash_compare( psa_algorithm_t alg,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    uint8_t actual_hash[MBEDTLS_MD_MAX_SIZE];
 | 
					    uint8_t actual_hash[MBEDTLS_MD_MAX_SIZE];
 | 
				
			||||||
    size_t actual_hash_length;
 | 
					    size_t actual_hash_length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if( !PSA_ALG_IS_HASH( alg ) )
 | 
				
			||||||
 | 
					        return( PSA_ERROR_INVALID_ARGUMENT );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    psa_status_t status = psa_driver_wrapper_hash_compute(
 | 
					    psa_status_t status = psa_driver_wrapper_hash_compute(
 | 
				
			||||||
                            alg, input, input_length,
 | 
					                            alg, input, input_length,
 | 
				
			||||||
                            actual_hash, sizeof(actual_hash),
 | 
					                            actual_hash, sizeof(actual_hash),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user