Lines Matching refs:params
83 static unsigned short lmots_checksum_calculate(const mbedtls_lmots_parameters_t *params, in lmots_checksum_calculate() argument
89 for (idx = 0; idx < MBEDTLS_LMOTS_N_HASH_LEN(params->type); idx++) { in lmots_checksum_calculate()
119 static int create_digit_array_with_checksum(const mbedtls_lmots_parameters_t *params, in create_digit_array_with_checksum() argument
135 status = psa_hash_update(&op, params->I_key_identifier, in create_digit_array_with_checksum()
141 status = psa_hash_update(&op, params->q_leaf_identifier, in create_digit_array_with_checksum()
153 MBEDTLS_LMOTS_C_RANDOM_VALUE_LEN(params->type)); in create_digit_array_with_checksum()
164 MBEDTLS_LMOTS_N_HASH_LEN(params->type), in create_digit_array_with_checksum()
170 checksum = lmots_checksum_calculate(params, out); in create_digit_array_with_checksum()
171 MBEDTLS_PUT_UINT16_BE(checksum, out, MBEDTLS_LMOTS_N_HASH_LEN(params->type)); in create_digit_array_with_checksum()
208 static int hash_digit_array(const mbedtls_lmots_parameters_t *params, in hash_digit_array() argument
226 i_digit_idx < MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(params->type); in hash_digit_array()
230 &x_digit_array[i_digit_idx * MBEDTLS_LMOTS_N_HASH_LEN(params->type)], in hash_digit_array()
231 MBEDTLS_LMOTS_N_HASH_LEN(params->type)); in hash_digit_array()
247 params->I_key_identifier, in hash_digit_array()
254 params->q_leaf_identifier, in hash_digit_array()
273 MBEDTLS_LMOTS_N_HASH_LEN(params->type)); in hash_digit_array()
287 memcpy(&output[i_digit_idx * MBEDTLS_LMOTS_N_HASH_LEN(params->type)], in hash_digit_array()
288 tmp_hash, MBEDTLS_LMOTS_N_HASH_LEN(params->type)); in hash_digit_array()
313 static int public_key_from_hashed_digit_array(const mbedtls_lmots_parameters_t *params, in public_key_from_hashed_digit_array() argument
327 params->I_key_identifier, in public_key_from_hashed_digit_array()
333 status = psa_hash_update(&op, params->q_leaf_identifier, in public_key_from_hashed_digit_array()
345 MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(params->type) * in public_key_from_hashed_digit_array()
346 MBEDTLS_LMOTS_N_HASH_LEN(params->type)); in public_key_from_hashed_digit_array()
352 MBEDTLS_LMOTS_N_HASH_LEN(params->type), in public_key_from_hashed_digit_array()
400 ctx->params.type = (mbedtls_lmots_algorithm_type_t) in mbedtls_lmots_import_public_key()
403 if (key_len != MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lmots_import_public_key()
407 memcpy(ctx->params.I_key_identifier, in mbedtls_lmots_import_public_key()
411 memcpy(ctx->params.q_leaf_identifier, in mbedtls_lmots_import_public_key()
417 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_import_public_key()
428 if (key_size < MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lmots_export_public_key()
436 MBEDTLS_PUT_UINT32_BE(ctx->params.type, key, MBEDTLS_LMOTS_SIG_TYPE_OFFSET); in mbedtls_lmots_export_public_key()
439 ctx->params.I_key_identifier, in mbedtls_lmots_export_public_key()
443 ctx->params.q_leaf_identifier, in mbedtls_lmots_export_public_key()
447 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_export_public_key()
450 *key_len = MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type); in mbedtls_lmots_export_public_key()
456 int mbedtls_lmots_calculate_public_key_candidate(const mbedtls_lmots_parameters_t *params, in mbedtls_lmots_calculate_public_key_candidate() argument
473 if (sig_size != MBEDTLS_LMOTS_SIG_LEN(params->type) || in mbedtls_lmots_calculate_public_key_candidate()
474 out_size < MBEDTLS_LMOTS_N_HASH_LEN(params->type)) { in mbedtls_lmots_calculate_public_key_candidate()
478 ret = create_digit_array_with_checksum(params, msg, msg_size, in mbedtls_lmots_calculate_public_key_candidate()
485 ret = hash_digit_array(params, in mbedtls_lmots_calculate_public_key_candidate()
486 sig + MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(params->type), in mbedtls_lmots_calculate_public_key_candidate()
492 ret = public_key_from_hashed_digit_array(params, in mbedtls_lmots_calculate_public_key_candidate()
500 *out_len = MBEDTLS_LMOTS_N_HASH_LEN(params->type); in mbedtls_lmots_calculate_public_key_candidate()
521 if (ctx->params.type != MBEDTLS_LMOTS_SHA256_N32_W8) { in mbedtls_lmots_verify()
533 ret = mbedtls_lmots_calculate_public_key_candidate(&ctx->params, in mbedtls_lmots_verify()
536 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type), in mbedtls_lmots_verify()
585 ctx->params.type = type; in mbedtls_lmots_generate_private_key()
587 memcpy(ctx->params.I_key_identifier, in mbedtls_lmots_generate_private_key()
589 sizeof(ctx->params.I_key_identifier)); in mbedtls_lmots_generate_private_key()
591 MBEDTLS_PUT_UINT32_BE(q_leaf_identifier, ctx->params.q_leaf_identifier, 0); in mbedtls_lmots_generate_private_key()
594 i_digit_idx < MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(ctx->params.type); in mbedtls_lmots_generate_private_key()
602 ctx->params.I_key_identifier, in mbedtls_lmots_generate_private_key()
603 sizeof(ctx->params.I_key_identifier)); in mbedtls_lmots_generate_private_key()
609 ctx->params.q_leaf_identifier, in mbedtls_lmots_generate_private_key()
633 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type), in mbedtls_lmots_generate_private_key()
661 ret = hash_digit_array(&priv_ctx->params, in mbedtls_lmots_calculate_public_key()
668 ret = public_key_from_hashed_digit_array(&priv_ctx->params, in mbedtls_lmots_calculate_public_key()
675 memcpy(&ctx->params, &priv_ctx->params, in mbedtls_lmots_calculate_public_key()
676 sizeof(ctx->params)); in mbedtls_lmots_calculate_public_key()
707 if (sig_size < MBEDTLS_LMOTS_SIG_LEN(ctx->params.type)) { in mbedtls_lmots_sign()
717 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_sign()
722 ret = create_digit_array_with_checksum(&ctx->params, in mbedtls_lmots_sign()
730 ret = hash_digit_array(&ctx->params, (unsigned char *) ctx->private_key, in mbedtls_lmots_sign()
736 MBEDTLS_PUT_UINT32_BE(ctx->params.type, sig, MBEDTLS_LMOTS_SIG_TYPE_OFFSET); in mbedtls_lmots_sign()
758 MBEDTLS_LMOTS_C_RANDOM_VALUE_LEN(ctx->params.type)); in mbedtls_lmots_sign()
760 memcpy(sig + MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(ctx->params.type), tmp_sig, in mbedtls_lmots_sign()
761 MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(ctx->params.type) in mbedtls_lmots_sign()
762 * MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_sign()
765 *sig_len = MBEDTLS_LMOTS_SIG_LEN(ctx->params.type); in mbedtls_lmots_sign()