mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	Renamed hmac_ctx to opad and removed null check.
this array is now part of the struct and not dynamically allocated so it can't be null.
This commit is contained in:
		
							parent
							
								
									caec7f0c49
								
							
						
					
					
						commit
						5ca6547b77
					
				@ -88,7 +88,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 hmac_ctx[PSA_CRYPTO_MD_BLOCK_SIZE];
 | 
					        uint8_t opad[PSA_CRYPTO_MD_BLOCK_SIZE];
 | 
				
			||||||
} psa_hmac_internal_data;
 | 
					} psa_hmac_internal_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1018,12 +1018,9 @@ psa_status_t psa_mac_abort( psa_mac_operation_t *operation )
 | 
				
			|||||||
                    return( PSA_ERROR_NOT_SUPPORTED );
 | 
					                    return( PSA_ERROR_NOT_SUPPORTED );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                psa_hash_abort( &operation->ctx.hmac.hash_ctx );
 | 
					                psa_hash_abort( &operation->ctx.hmac.hash_ctx );
 | 
				
			||||||
                if ( operation->ctx.hmac.hmac_ctx != NULL )
 | 
					                mbedtls_zeroize( operation->ctx.hmac.opad,
 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    mbedtls_zeroize( operation->ctx.hmac.hmac_ctx,
 | 
					 | 
				
			||||||
                                     block_size);
 | 
					                                     block_size);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
#endif /* MBEDTLS_MD_C */
 | 
					#endif /* MBEDTLS_MD_C */
 | 
				
			||||||
                return( PSA_ERROR_NOT_SUPPORTED );
 | 
					                return( PSA_ERROR_NOT_SUPPORTED );
 | 
				
			||||||
@ -1065,7 +1062,7 @@ static int psa_hmac_start( psa_mac_operation_t *operation,
 | 
				
			|||||||
                           psa_algorithm_t alg )
 | 
					                           psa_algorithm_t alg )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    unsigned char ipad[PSA_CRYPTO_MD_BLOCK_SIZE];
 | 
					    unsigned char ipad[PSA_CRYPTO_MD_BLOCK_SIZE];
 | 
				
			||||||
    unsigned char *opad = operation->ctx.hmac.hmac_ctx;
 | 
					    unsigned char *opad = operation->ctx.hmac.opad;
 | 
				
			||||||
    size_t i;
 | 
					    size_t i;
 | 
				
			||||||
    size_t block_size =
 | 
					    size_t block_size =
 | 
				
			||||||
        PSA_HASH_BLOCK_SIZE( ( PSA_ALG_HMAC_HASH( alg ) ) );
 | 
					        PSA_HASH_BLOCK_SIZE( ( PSA_ALG_HMAC_HASH( alg ) ) );
 | 
				
			||||||
@ -1282,7 +1279,7 @@ static psa_status_t psa_mac_finish_internal( psa_mac_operation_t *operation,
 | 
				
			|||||||
            if( PSA_ALG_IS_HMAC( operation->alg ) )
 | 
					            if( PSA_ALG_IS_HMAC( operation->alg ) )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                unsigned char tmp[MBEDTLS_MD_MAX_SIZE];
 | 
					                unsigned char tmp[MBEDTLS_MD_MAX_SIZE];
 | 
				
			||||||
                unsigned char *opad = operation->ctx.hmac.hmac_ctx;
 | 
					                unsigned char *opad = operation->ctx.hmac.opad;
 | 
				
			||||||
                size_t hash_size = 0;
 | 
					                size_t hash_size = 0;
 | 
				
			||||||
                unsigned int block_size =
 | 
					                unsigned int block_size =
 | 
				
			||||||
                PSA_HASH_BLOCK_SIZE( ( PSA_ALG_HMAC_HASH( operation->alg ) ) );
 | 
					                PSA_HASH_BLOCK_SIZE( ( PSA_ALG_HMAC_HASH( operation->alg ) ) );
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user