Skip to content

Conversation

@willieyz
Copy link
Contributor

@willieyz willieyz commented Dec 5, 2025

willieyz and others added 14 commits December 3, 2025 17:39
This commit adds CBMC proofs for the native function `mld_ntt_native`,
called `poly_ntt_native`

The following changes are included:
  - Add `dummy_backend.h` as a mock backend for `poly_ntt_native`.
  - Apply the same harness file and construct function contract
    reference from `poly_ntt`.
  - Use the following function contracts:
    - `mld_ntt_native`
    - `mld_poly_ntt_c`
  - Introduce a new CBMC contract pattern `array_unchanged` in `cbmc.h`,
    which is used to verify the fallback behavior inside `mld_ntt_native`.

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for the native function `mld_intt_native`,
  called `poly_invntt_tomont_native`

- This following changes are include:
  - Apply the same harness file and construct function contract,
    reference from `poly_invntt_tomnot`.
  - Use the following function contracts:
    - `mld_intt_native`
    - `mld_poly_invntt_tomont_c`
  - Add MLD_INTT_BOUND in api.h
  - Add `MLD_USE_NATIVE_INTT` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for the native function `mld_rej_uniform_native`,
  called `rej_uniform_native`

- This following changes are include:
  - Apply the same harness file and construct function contract reference
    from `rej_uniform`.

  - Use the following function contracts:
    - `mld_rej_uniform_native`
    - `mld_rej_uniform_c`
  - Add `MLD_USE_NATIVE_REJ_UNIFORM` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for following the native function:
  `mld_rej_uniform_eta2_native` and `mld_rej_uniform_eta4_native`,
  called `rej_eta_native`.

- This following changes are include:
  - Apply the same harness file and construct function contract reference
    from rej_eta.

  - Use the following function contracts:
    - mld_rej_eta_c
    - mld_rej_uniform_eta2_native
    - mld_rej_uniform_eta4_native

  - Add `MLD_USE_NATIVE_REJ_UNIFORM_ETA2`,
        `MLD_USE_NATIVE_REJ_UNIFORM_ETA4` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for following the native function:
  `mld_poly_decompose_32_native`, `mld_poly_decompose_88_native`.
  called `poly_decompose_native`.

- This following changes are include:

  - Apply the same harness file and construct function contract reference
    from `poly_decompose`.

  - Use the following function contracts:
    - mld_poly_decompose_c
    - mld_poly_decompose_32_native
    - mld_poly_decompose_88_native

  - Add `MLD_USE_NATIVE_POLY_DECOMPOSE_32`,
    `MLD_USE_NATIVE_POLY_DECOMPOSE_88` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for the native function
  `mld_poly_caddq_native`, called `poly_caddq_native`

- This following changes are include:
  - Apply the same harness file and construct function contract
    reference from `poly_caddq`.
  - Use the following function contracts:
    - `mld_poly_caddq_c`
    - `mld_poly_caddq_native`
  - Add `MLD_USE_NATIVE_POLY_CADDQ` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for following the native function:
 `mld_poly_use_hint_32_native`, `mld_poly_use_hint_88_native`.
 called `poly_use_hint_native`.

- This following changes are include:

 - Apply the same harness file and construct function contract reference
  from `poly_use_hint`.

 - Use the following function contracts:
  - mld_poly_use_hint_c
  - mld_poly_use_hint_32_native
  - mld_poly_use_hint_88_native

 - Add `MLD_USE_NATIVE_POLY_USE_HINT_32`,
  `MLD_USE_NATIVE_POLY_USE_HINT_88` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for following the native function:
 `mld_poly_chknorm_native`, called `poly_chknorm_native`.

- This following changes are include:

 - Apply the same harness file and construct function contract reference
  from `poly_chknorm_native`.

 - Use the following function contracts:
  - `mld_poly_chknorm_c`
  - `mld_poly_chknorm_native`

 - Add `MLD_USE_NATIVE_POLY_CHKNORM` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for following the native function:
 `mld_polyz_unpack_17_native` and `mld_polyz_unpack_19_native`.
 called `polyz_unpack_native`.

- This following changes are include:

 - Apply the same harness file and construct function contract reference
  from `polyz_unpack`.

 - Use the following function contracts:
   - `mld_polyz_unpack_c`
   - `mld_polyz_unpack_17_native`
   - `mld_polyz_unpack_17_native`

 - Add `MLD_USE_NATIVE_POLYZ_UNPACK_17`,
  `MLD_USE_NATIVE_POLYZ_UNPACK_19` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
…omery_native)

- This commit adds CBMC proofs for the native function
  `mld_poly_pointwise_montgomery_native`,
  called `poly_pointwise_montgomery_native`

- This following changes are include:
  - Apply the same harness file and construct function contract,
    reference from `poly_pointwise_montgomery`.
  - Use the following function contracts:
    - `mld_poly_pointwise_montgomery_native`
    - `mld_poly_pointwise_montgomery_c`
  - Add `MLD_USE_NATIVE_POINTWISE_MONTGOMERY` in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
…ntgomery_native)

- This commit adds CBMC proofs for following the native function:
  `mld_polyvecl_pointwise_acc_montgomery_l4_native`,
  `mld_polyvecl_pointwise_acc_montgomery_l5_native` and
  `mld_polyvecl_pointwise_acc_montgomery_l7_native`
  called `polyvecl_pointwise_acc_montgomery_native`.

- This following changes are include:
  - Apply the same harness file and construct function contract reference
    from `polyvecl_pointwise_acc_montgomery`.
  - Use the following function contracts:
    - `mld_polyvecl_pointwise_acc_montgomery_l4_native`
    - `mld_polyvecl_pointwise_acc_montgomery_l5_native`
    - `mld_polyvecl_pointwise_acc_montgomery_l7_native`

- Add `MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L4`,
      `MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L5`,
      `MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L7`
    in dummy_backend.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
- This commit adds CBMC proofs for following the native function:
 `mld_keccak_f1600_x1_native`, called `keccakf1600_permute_native`.

- This following changes are include:

 - Apply the same harness file and construct function contract reference
  from `keccakf1600_permute`.

 - Use the following function contracts:
  - `mld_keccak_f1600_x1_native`

 - Add `MLD_USE_FIPS202_X1_NATIVE` in dummy_backend_fips202_x1.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
…tive)

- This commit adds CBMC proofs for following the native function:
 `mld_keccak_f1600_x4_native`, called `keccakf1600x4_permute_native`.

- This following changes are include:

 - Apply the same harness file and construct function contract reference
  from `keccakf1600x4_permute`.

 - Use the following function contracts:
  - `mld_keccak_f1600_x4_native`

 - Add `MLD_USE_FIPS202_X4_NATIVE` in dummy_backend_fips202_x4.h

Signed-off-by: willieyz <willie.zhao@chelpis.com>
…o_custom_native)

- This commit adds CBMC proofs for the native function `mld_poly_permute_bitrev_to_custom`,
  called `polymat_permute_bitrev_to_custom_native`

- This following changes are include:
  - Apply the same harness file and construct function contract,
    reference from `polymat_permute_bitrev_to_custom`.
  - Use the following function contracts:
    - `mld_poly_permute_bitrev_to_custom`
  - Add `MLD_USE_NATIVE_NTT_CUSTOM_ORDER` in dummy_backend.h

- Also, for makeing this CBMC proof work, this commit refactor
  `mld_polymat_permute_bitrev_to_custom` from double loop to single loop.

Co-authored-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
Signed-off-by: willieyz <willie.zhao@chelpis.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants