mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 03:00:21 -04:00 
			
		
		
		
	Rename hash max sizes for consistency
Use "hash" throughout the library, not "md" as in Mbed TLS.
This commit is contained in:
		
							parent
							
								
									dec7261df1
								
							
						
					
					
						commit
						b3e6e5deeb
					
				| @ -46,11 +46,11 @@ | |||||||
| #include "mbedtls/sha512.h" | #include "mbedtls/sha512.h" | ||||||
| 
 | 
 | ||||||
| #if defined(MBEDTLS_SHA512_C) | #if defined(MBEDTLS_SHA512_C) | ||||||
| #define PSA_CRYPTO_MD_MAX_SIZE 64 | #define PSA_HASH_MAX_SIZE 64 | ||||||
| #define PSA_CRYPTO_MD_BLOCK_SIZE 128 | #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 128 | ||||||
| #else | #else | ||||||
| #define PSA_CRYPTO_MD_MAX_SIZE 32 | #define PSA_HASH_MAX_SIZE 32 | ||||||
| #define PSA_CRYPTO_MD_BLOCK_SIZE 64 | #define PSA_HMAC_MAX_HASH_BLOCK_SIZE 64 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| struct psa_hash_operation_s | struct psa_hash_operation_s | ||||||
| @ -89,7 +89,7 @@ typedef struct | |||||||
|         /** The hash context. */ |         /** The hash context. */ | ||||||
|         struct psa_hash_operation_s hash_ctx; |         struct psa_hash_operation_s hash_ctx; | ||||||
|         /** The HMAC part of the context. */ |         /** The HMAC part of the context. */ | ||||||
|         uint8_t opad[PSA_CRYPTO_MD_BLOCK_SIZE]; |         uint8_t opad[PSA_HMAC_MAX_HASH_BLOCK_SIZE]; | ||||||
| } psa_hmac_internal_data; | } psa_hmac_internal_data; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -614,37 +614,6 @@ static const mbedtls_md_info_t *mbedtls_md_info_from_psa( psa_algorithm_t alg ) | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if 0 |  | ||||||
| static psa_algorithm_t mbedtls_md_alg_to_psa( mbedtls_md_type_t md_alg ) |  | ||||||
| { |  | ||||||
|     switch( md_alg ) |  | ||||||
|     { |  | ||||||
|         case MBEDTLS_MD_NONE: |  | ||||||
|             return( 0 ); |  | ||||||
|         case MBEDTLS_MD_MD2: |  | ||||||
|             return( PSA_ALG_MD2 ); |  | ||||||
|         case MBEDTLS_MD_MD4: |  | ||||||
|             return( PSA_ALG_MD4 ); |  | ||||||
|         case MBEDTLS_MD_MD5: |  | ||||||
|             return( PSA_ALG_MD5 ); |  | ||||||
|         case MBEDTLS_MD_SHA1: |  | ||||||
|             return( PSA_ALG_SHA_1 ); |  | ||||||
|         case MBEDTLS_MD_SHA224: |  | ||||||
|             return( PSA_ALG_SHA_224 ); |  | ||||||
|         case MBEDTLS_MD_SHA256: |  | ||||||
|             return( PSA_ALG_SHA_256 ); |  | ||||||
|         case MBEDTLS_MD_SHA384: |  | ||||||
|             return( PSA_ALG_SHA_384 ); |  | ||||||
|         case MBEDTLS_MD_SHA512: |  | ||||||
|             return( PSA_ALG_SHA_512 ); |  | ||||||
|         case MBEDTLS_MD_RIPEMD160: |  | ||||||
|             return( PSA_ALG_RIPEMD160 ); |  | ||||||
|         default: |  | ||||||
|             return( 0 ); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| psa_status_t psa_hash_abort( psa_hash_operation_t *operation ) | psa_status_t psa_hash_abort( psa_hash_operation_t *operation ) | ||||||
| { | { | ||||||
|     switch( operation->alg ) |     switch( operation->alg ) | ||||||
| @ -1081,7 +1050,7 @@ static int psa_hmac_start( psa_mac_operation_t *operation, | |||||||
|                            key_slot_t *slot, |                            key_slot_t *slot, | ||||||
|                            psa_algorithm_t alg ) |                            psa_algorithm_t alg ) | ||||||
| { | { | ||||||
|     unsigned char ipad[PSA_CRYPTO_MD_BLOCK_SIZE]; |     unsigned char ipad[PSA_HMAC_MAX_HASH_BLOCK_SIZE]; | ||||||
|     unsigned char *opad = operation->ctx.hmac.opad; |     unsigned char *opad = operation->ctx.hmac.opad; | ||||||
|     size_t i; |     size_t i; | ||||||
|     size_t block_size = |     size_t block_size = | ||||||
|  | |||||||
| @ -1,7 +1,6 @@ | |||||||
| /* BEGIN_HEADER */ | /* BEGIN_HEADER */ | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include "psa/crypto.h" | #include "psa/crypto.h" | ||||||
| #include "mbedtls/md.h" |  | ||||||
| 
 | 
 | ||||||
| #if(UINT32_MAX > SIZE_MAX) | #if(UINT32_MAX > SIZE_MAX) | ||||||
| #define PSA_CRYPTO_TEST_SIZE_T_RANGE( x ) ( ( x ) <= SIZE_MAX ) | #define PSA_CRYPTO_TEST_SIZE_T_RANGE( x ) ( ( x ) <= SIZE_MAX ) | ||||||
| @ -212,7 +211,7 @@ exit: | |||||||
| void hash_finish( int alg_arg, data_t *input, data_t *expected_hash ) | void hash_finish( int alg_arg, data_t *input, data_t *expected_hash ) | ||||||
| { | { | ||||||
|     psa_algorithm_t alg = alg_arg; |     psa_algorithm_t alg = alg_arg; | ||||||
|     unsigned char actual_hash[MBEDTLS_MD_MAX_SIZE]; |     unsigned char actual_hash[PSA_HASH_MAX_SIZE]; | ||||||
|     size_t actual_hash_length; |     size_t actual_hash_length; | ||||||
|     psa_hash_operation_t operation; |     psa_hash_operation_t operation; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gilles Peskine
						Gilles Peskine