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()
404 ctx->params.type = (mbedtls_lmots_algorithm_type_t) in mbedtls_lmots_import_public_key()
407 if (key_len != MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lmots_import_public_key()
411 memcpy(ctx->params.I_key_identifier, in mbedtls_lmots_import_public_key()
415 memcpy(ctx->params.q_leaf_identifier, in mbedtls_lmots_import_public_key()
421 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_import_public_key()
432 if (key_size < MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lmots_export_public_key()
440 MBEDTLS_PUT_UINT32_BE(ctx->params.type, key, MBEDTLS_LMOTS_SIG_TYPE_OFFSET); in mbedtls_lmots_export_public_key()
443 ctx->params.I_key_identifier, in mbedtls_lmots_export_public_key()
447 ctx->params.q_leaf_identifier, in mbedtls_lmots_export_public_key()
451 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_export_public_key()
454 *key_len = MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type); in mbedtls_lmots_export_public_key()
460 int mbedtls_lmots_calculate_public_key_candidate(const mbedtls_lmots_parameters_t *params, in mbedtls_lmots_calculate_public_key_candidate() argument
477 if (sig_size != MBEDTLS_LMOTS_SIG_LEN(params->type) || in mbedtls_lmots_calculate_public_key_candidate()
478 out_size < MBEDTLS_LMOTS_N_HASH_LEN(params->type)) { in mbedtls_lmots_calculate_public_key_candidate()
482 ret = create_digit_array_with_checksum(params, msg, msg_size, in mbedtls_lmots_calculate_public_key_candidate()
489 ret = hash_digit_array(params, in mbedtls_lmots_calculate_public_key_candidate()
490 sig + MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(params->type), in mbedtls_lmots_calculate_public_key_candidate()
496 ret = public_key_from_hashed_digit_array(params, in mbedtls_lmots_calculate_public_key_candidate()
504 *out_len = MBEDTLS_LMOTS_N_HASH_LEN(params->type); in mbedtls_lmots_calculate_public_key_candidate()
525 if (ctx->params.type != MBEDTLS_LMOTS_SHA256_N32_W8) { in mbedtls_lmots_verify()
537 ret = mbedtls_lmots_calculate_public_key_candidate(&ctx->params, in mbedtls_lmots_verify()
540 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type), in mbedtls_lmots_verify()
593 ctx->params.type = type; in mbedtls_lmots_generate_private_key()
595 memcpy(ctx->params.I_key_identifier, in mbedtls_lmots_generate_private_key()
597 sizeof(ctx->params.I_key_identifier)); in mbedtls_lmots_generate_private_key()
599 MBEDTLS_PUT_UINT32_BE(q_leaf_identifier, ctx->params.q_leaf_identifier, 0); in mbedtls_lmots_generate_private_key()
602 i_digit_idx < MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(ctx->params.type); in mbedtls_lmots_generate_private_key()
610 ctx->params.I_key_identifier, in mbedtls_lmots_generate_private_key()
611 sizeof(ctx->params.I_key_identifier)); in mbedtls_lmots_generate_private_key()
617 ctx->params.q_leaf_identifier, in mbedtls_lmots_generate_private_key()
641 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type), in mbedtls_lmots_generate_private_key()
669 ret = hash_digit_array(&priv_ctx->params, in mbedtls_lmots_calculate_public_key()
676 ret = public_key_from_hashed_digit_array(&priv_ctx->params, in mbedtls_lmots_calculate_public_key()
683 memcpy(&ctx->params, &priv_ctx->params, in mbedtls_lmots_calculate_public_key()
684 sizeof(ctx->params)); in mbedtls_lmots_calculate_public_key()
715 if (sig_size < MBEDTLS_LMOTS_SIG_LEN(ctx->params.type)) { in mbedtls_lmots_sign()
725 MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_sign()
730 ret = create_digit_array_with_checksum(&ctx->params, in mbedtls_lmots_sign()
738 ret = hash_digit_array(&ctx->params, (unsigned char *) ctx->private_key, in mbedtls_lmots_sign()
744 MBEDTLS_PUT_UINT32_BE(ctx->params.type, sig, MBEDTLS_LMOTS_SIG_TYPE_OFFSET); in mbedtls_lmots_sign()
766 MBEDTLS_LMOTS_C_RANDOM_VALUE_LEN(ctx->params.type)); in mbedtls_lmots_sign()
768 memcpy(sig + MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(ctx->params.type), tmp_sig, in mbedtls_lmots_sign()
769 MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(ctx->params.type) in mbedtls_lmots_sign()
770 * MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type)); in mbedtls_lmots_sign()
773 *sig_len = MBEDTLS_LMOTS_SIG_LEN(ctx->params.type); in mbedtls_lmots_sign()