Skip to content

[crypto] ML-DSA-87: sec_a2b, sec_b2a, sec_add, sec_unmask (1/14)#29639

Open
andrea-caforio wants to merge 4 commits intolowRISC:masterfrom
andrea-caforio:mldsa87-sign-1
Open

[crypto] ML-DSA-87: sec_a2b, sec_b2a, sec_add, sec_unmask (1/14)#29639
andrea-caforio wants to merge 4 commits intolowRISC:masterfrom
andrea-caforio:mldsa87-sign-1

Conversation

@andrea-caforio
Copy link
Copy Markdown
Contributor

The first batch of secure gadgets.


This is a series of PRs that in their composition result in FIPS-204-compliant OTBN implementation of ML-DSA-87 sign.

Resources

Gadgets
  1. sec_a2b, sec_b2a, sec_add, sec_unmask
  2. sec_leq, sec_bound_check
  3. sec_decompose
Sampling
  1. sample_mask_poly, expand_mask
Encoding
  1. decode_t0
  2. decode_w1
  3. encode_z
Commitment
  1. decompose_w, compute_w
Signature
  1. compute_z, encode_sig
Norm
  1. check_infinity_norm_z
  2. compute_r0, unmask_r0, check_infinity_norm_r0
Hint
  1. make_hint, compute_carries
  2. check_hamming_weight, compress_hint
Epilogue
  1. app

@andrea-caforio andrea-caforio changed the title [crypto] ML-DSA-87: sec_a2b, sec_b2a, sec_add, sec_unmask [crypto] ML-DSA-87: sec_a2b, sec_b2a, sec_add, sec_unmask (1/14) Mar 31, 2026
@andrea-caforio andrea-caforio self-assigned this Mar 31, 2026
@andrea-caforio andrea-caforio added Type:Enhancement Feature requests, enhancements SW:cryptolib Crypto library labels Mar 31, 2026
@etterli etterli requested a review from thommythomaso March 31, 2026 15:28
Copy link
Copy Markdown
Contributor

@etterli etterli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff. I reviewed the gadgets, tests will follow tomorrow.

jal x1, _mai_poll

/* Read back the result. */
bn.wsrr w0, MAI_RES_S0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it save to overwrite x0_A with x0_B? It should because the conversion is performs also a re-masking?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is okay. There shouldn't be any leakage.

Signed-off-by: Andrea Caforio <andrea.caforio@lowrisc.org>
Signed-off-by: Andrea Caforio <andrea.caforio@lowrisc.org>
Copy link
Copy Markdown
Contributor

@etterli etterli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comment NITs, otherwise good :)

Signed-off-by: Andrea Caforio <andrea.caforio@lowrisc.org>
Signed-off-by: Andrea Caforio <andrea.caforio@lowrisc.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SW:cryptolib Crypto library Type:Enhancement Feature requests, enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants