• Home
  • Raw
  • Download

Lines Matching refs:hkdf

5036         mbedtls_free(operation->ctx.hkdf.info);  in psa_key_derivation_abort()
5037 status = psa_mac_abort(&operation->ctx.hkdf.hmac); in psa_key_derivation_abort()
5116 static psa_status_t psa_key_derivation_hkdf_read(psa_hkdf_key_derivation_t *hkdf, in psa_key_derivation_hkdf_read() argument
5131 if (hkdf->state < HKDF_STATE_KEYED || in psa_key_derivation_hkdf_read()
5132 (!hkdf->info_set in psa_key_derivation_hkdf_read()
5139 hkdf->state = HKDF_STATE_OUTPUT; in psa_key_derivation_hkdf_read()
5143 uint8_t n = hash_length - hkdf->offset_in_block; in psa_key_derivation_hkdf_read()
5147 memcpy(output, hkdf->output_block + hkdf->offset_in_block, n); in psa_key_derivation_hkdf_read()
5150 hkdf->offset_in_block += n; in psa_key_derivation_hkdf_read()
5159 if (hkdf->block_number == last_block) { in psa_key_derivation_hkdf_read()
5164 ++hkdf->block_number; in psa_key_derivation_hkdf_read()
5165 hkdf->offset_in_block = 0; in psa_key_derivation_hkdf_read()
5167 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5169 hkdf->prk, in psa_key_derivation_hkdf_read()
5175 if (hkdf->block_number != 1) { in psa_key_derivation_hkdf_read()
5176 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5177 hkdf->output_block, in psa_key_derivation_hkdf_read()
5183 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5184 hkdf->info, in psa_key_derivation_hkdf_read()
5185 hkdf->info_length); in psa_key_derivation_hkdf_read()
5189 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5190 &hkdf->block_number, 1); in psa_key_derivation_hkdf_read()
5194 status = psa_mac_sign_finish(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5195 hkdf->output_block, in psa_key_derivation_hkdf_read()
5196 sizeof(hkdf->output_block), in psa_key_derivation_hkdf_read()
5441 status = psa_key_derivation_hkdf_read(&operation->ctx.hkdf, kdf_alg, in psa_key_derivation_output_bytes()
6008 static psa_status_t psa_hkdf_input(psa_hkdf_key_derivation_t *hkdf, in psa_hkdf_input() argument
6023 if (hkdf->state != HKDF_STATE_INIT) { in psa_hkdf_input()
6026 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_hkdf_input()
6032 hkdf->state = HKDF_STATE_STARTED; in psa_hkdf_input()
6042 if (hkdf->state != HKDF_STATE_INIT) { in psa_hkdf_input()
6051 memcpy(hkdf->prk, data, data_length); in psa_hkdf_input()
6057 if (hkdf->state == HKDF_STATE_INIT) { in psa_hkdf_input()
6063 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_hkdf_input()
6069 hkdf->state = HKDF_STATE_STARTED; in psa_hkdf_input()
6071 if (hkdf->state != HKDF_STATE_STARTED) { in psa_hkdf_input()
6074 status = psa_mac_update(&hkdf->hmac, in psa_hkdf_input()
6079 status = psa_mac_sign_finish(&hkdf->hmac, in psa_hkdf_input()
6080 hkdf->prk, in psa_hkdf_input()
6081 sizeof(hkdf->prk), in psa_hkdf_input()
6088 hkdf->state = HKDF_STATE_KEYED; in psa_hkdf_input()
6089 hkdf->block_number = 0; in psa_hkdf_input()
6093 memcpy(hkdf->output_block, hkdf->prk, PSA_HASH_LENGTH(hash_alg)); in psa_hkdf_input()
6094 hkdf->offset_in_block = 0; in psa_hkdf_input()
6100 hkdf->offset_in_block = PSA_HASH_LENGTH(hash_alg); in psa_hkdf_input()
6112 hkdf->state == HKDF_STATE_INIT) { in psa_hkdf_input()
6116 if (hkdf->state == HKDF_STATE_OUTPUT) { in psa_hkdf_input()
6119 if (hkdf->info_set) { in psa_hkdf_input()
6122 hkdf->info_length = data_length; in psa_hkdf_input()
6124 hkdf->info = mbedtls_calloc(1, data_length); in psa_hkdf_input()
6125 if (hkdf->info == NULL) { in psa_hkdf_input()
6128 memcpy(hkdf->info, data, data_length); in psa_hkdf_input()
6130 hkdf->info_set = 1; in psa_hkdf_input()
6430 status = psa_hkdf_input(&operation->ctx.hkdf, kdf_alg, in psa_key_derivation_input_internal()