mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	Add seed input for psa_tls12_prf_input
This commit is contained in:
		
							parent
							
								
									ef83f5e98e
								
							
						
					
					
						commit
						f08e2654ed
					
				@ -4771,19 +4771,37 @@ static psa_status_t psa_tls12_prf_input( psa_tls12_prf_key_derivation_t *prf,
 | 
				
			|||||||
    return( PSA_ERROR_INVALID_ARGUMENT );
 | 
					    return( PSA_ERROR_INVALID_ARGUMENT );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					static psa_status_t psa_tls12_prf_set_seed( psa_tls12_prf_key_derivation_t *prf,
 | 
				
			||||||
 | 
					                                            const uint8_t *data,
 | 
				
			||||||
 | 
					                                            size_t data_length )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if( prf->state != TLS12_PRF_STATE_INIT )
 | 
				
			||||||
 | 
					        return( PSA_ERROR_BAD_STATE );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    prf->seed = mbedtls_calloc( 1, data_length );
 | 
				
			||||||
 | 
					    if( prf->seed == NULL )
 | 
				
			||||||
 | 
					        return( PSA_ERROR_INSUFFICIENT_MEMORY );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    memcpy( prf->seed, data, data_length );
 | 
				
			||||||
 | 
					    prf->seed_length = data_length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    prf->state = TLS12_PRF_STATE_SEED_SET;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return( PSA_SUCCESS );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static psa_status_t psa_tls12_prf_input( psa_tls12_prf_key_derivation_t *prf,
 | 
					static psa_status_t psa_tls12_prf_input( psa_tls12_prf_key_derivation_t *prf,
 | 
				
			||||||
                                         psa_algorithm_t hash_alg,
 | 
					                                         psa_algorithm_t hash_alg,
 | 
				
			||||||
                                         psa_key_derivation_step_t step,
 | 
					                                         psa_key_derivation_step_t step,
 | 
				
			||||||
                                         const uint8_t *data,
 | 
					                                         const uint8_t *data,
 | 
				
			||||||
                                         size_t data_length )
 | 
					                                         size_t data_length )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    (void) prf;
 | 
					 | 
				
			||||||
    (void) hash_alg;
 | 
					    (void) hash_alg;
 | 
				
			||||||
    (void) data;
 | 
					 | 
				
			||||||
    (void) data_length;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch( step )
 | 
					    switch( step )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        case PSA_KEY_DERIVATION_INPUT_SEED:
 | 
				
			||||||
 | 
					            return( psa_tls12_prf_set_seed( prf, data, data_length ) );
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            return( PSA_ERROR_INVALID_ARGUMENT );
 | 
					            return( PSA_ERROR_INVALID_ARGUMENT );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user