mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Make psa_hash_compare go through hash_compute
It's more efficient when dealing with hardware drivers. Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
		
							parent
							
								
									0e307647e6
								
							
						
					
					
						commit
						84d670d20c
					
				| @ -2298,25 +2298,18 @@ psa_status_t psa_hash_compare( psa_algorithm_t alg, | |||||||
|                                const uint8_t *input, size_t input_length, |                                const uint8_t *input, size_t input_length, | ||||||
|                                const uint8_t *hash, size_t hash_length ) |                                const uint8_t *hash, size_t hash_length ) | ||||||
| { | { | ||||||
|     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT; |     uint8_t actual_hash[MBEDTLS_MD_MAX_SIZE]; | ||||||
|     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; |     size_t actual_hash_length; | ||||||
| 
 |     psa_status_t status = psa_hash_compute( alg, input, input_length, | ||||||
|     status = psa_hash_setup( &operation, alg ); |                                             actual_hash, sizeof(actual_hash), | ||||||
|  |                                             &actual_hash_length ); | ||||||
|     if( status != PSA_SUCCESS ) |     if( status != PSA_SUCCESS ) | ||||||
|         goto exit; |  | ||||||
|     status = psa_hash_update( &operation, input, input_length ); |  | ||||||
|     if( status != PSA_SUCCESS ) |  | ||||||
|         goto exit; |  | ||||||
|     status = psa_hash_verify( &operation, hash, hash_length ); |  | ||||||
|     if( status != PSA_SUCCESS ) |  | ||||||
|         goto exit; |  | ||||||
| 
 |  | ||||||
| exit: |  | ||||||
|     if( status == PSA_SUCCESS ) |  | ||||||
|         status = psa_hash_abort( &operation ); |  | ||||||
|     else |  | ||||||
|         psa_hash_abort( &operation ); |  | ||||||
|         return( status ); |         return( status ); | ||||||
|  |     if( actual_hash_length != hash_length ) | ||||||
|  |         return( PSA_ERROR_INVALID_SIGNATURE ); | ||||||
|  |     if( safer_memcmp( hash, actual_hash, actual_hash_length ) != 0 ) | ||||||
|  |         return( PSA_ERROR_INVALID_SIGNATURE ); | ||||||
|  |     return( PSA_SUCCESS ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| psa_status_t psa_hash_clone( const psa_hash_operation_t *source_operation, | psa_status_t psa_hash_clone( const psa_hash_operation_t *source_operation, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Steven Cooreman
						Steven Cooreman