Skip to content

CodeQL: Add mldsa/ declaration visibility check#1052

Open
hanno-becker wants to merge 1 commit into
mainfrom
ql
Open

CodeQL: Add mldsa/ declaration visibility check#1052
hanno-becker wants to merge 1 commit into
mainfrom
ql

Conversation

@hanno-becker

Copy link
Copy Markdown
Contributor

CodeQL is GitHub's semantic code analysis engine: it builds a typed AST database from a build trace, then answers queries written in QL (a Datalog-flavoured language) against it.

This commit adds a custom query that flags any externally-linked declaration under mldsa/ lacking the appropriate visibility annotation (MLD_INTERNAL_API, MLD_EXTERNAL_API, MLD_API_QUALIFIER for functions; MLD_INTERNAL_DATA_DECLARATION / MLD_INTERNAL_DATA_DEFINITION for variables), catching new cross-TU symbols that miss the macro required for single-CU builds. Assembly symbols (asm) and empty-CU placeholders (*empty_cu) are excluded.

A scripts/ql driver wraps the CLI: it manages the CodeQL database (auto-rebuilding when sources change), dispatches queries, and runs query-specific post-processors that add colored output and pass/fail logic. The mldsa-declarations post-processor is registered for the visibility check; other queries get plain table output.

A codeql.yml workflow invoked from all.yml runs the check in CI.

The new query flagged two missing annotations:
mld_polyeta_unpack in poly_kl.c and mld_prepare_domain_separation_prefix in sign.c lacked MLD_INTERNAL_API / MLD_EXTERNAL_API, respectively. Both are fixed in this commit, too.

Licensing: CodeQL uses a GitHub-specific license and is marked 'unfree' in nixpkgs. It is free for open-source analysis and GitHub code scanning, covering our use case. The nix flake does not globally allowlist the package; developers opt in via
NIXPKGS_ALLOW_UNFREE=1 nix develop --impure .#codeql
to avoid silent acceptance of the non-OSS license.

@hanno-becker hanno-becker force-pushed the ql branch 2 times, most recently from c6a2786 to 084de54 Compare April 22, 2026 12:45
CodeQL is GitHub's semantic code analysis engine: it builds a typed AST
database from a build trace, then answers queries written in QL (a
Datalog-flavoured language) against it.

This commit adds a custom query that flags any externally-linked
declaration under mldsa/ lacking the appropriate visibility annotation
(MLD_INTERNAL_API, MLD_EXTERNAL_API, MLD_API_QUALIFIER for functions;
MLD_INTERNAL_DATA_DECLARATION / MLD_INTERNAL_DATA_DEFINITION for
variables), catching new cross-TU symbols that miss the macro required
for single-CU builds. Assembly symbols (*_asm) and empty-CU placeholders
(*empty_cu_*) are excluded.

A scripts/ql driver wraps the CLI: it manages the CodeQL database
(auto-rebuilding when sources change), dispatches queries, and runs
query-specific post-processors that add colored output and pass/fail
logic. The mldsa-declarations post-processor is registered for the
visibility check; other queries get plain table output.

A codeql.yml workflow invoked from all.yml runs the check in CI.

The new query flagged two missing annotations:
mld_polyeta_unpack in poly_kl.c and mld_prepare_domain_separation_prefix
in sign.c lacked MLD_INTERNAL_API / MLD_EXTERNAL_API, respectively.
Both are fixed in this commit, too.

Licensing: CodeQL uses a GitHub-specific license and is marked 'unfree'
in nixpkgs. It is free for open-source analysis and GitHub code
scanning, covering our use case. The nix flake does not globally
allowlist the package; developers opt in via
    NIXPKGS_ALLOW_UNFREE=1 nix develop --impure .#codeql
to avoid silent acceptance of the non-OSS license.

Signed-off-by: Hanno Becker <[email protected]>
@hanno-becker hanno-becker marked this pull request as ready for review April 22, 2026 12:57
@hanno-becker hanno-becker requested a review from a team as a code owner April 22, 2026 12:57
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-shell
with:
nix-shell: codeql

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.

what's the benefit of installing codeql via nix in CI? Wouldn't github/codeql-action/init be the easier and less intrusive path?

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.

Or do we expect this to be very version sensitive? That's the only reason I can think of.

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 felt it's in keeping with our existing setup, and yes, more robust towards version changes. But I am OK either way.

@mkannwischer mkannwischer left a comment

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.

Thanks @hanno-becker. Thanks for looking into this and finding the two places where we were missing the markers.

I have some questions. If we plan to scale this, I think it makes sense to try to simplify this as much as possible.

Comment thread scripts/ql

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.

I'm not sure I see the value of this 640-line Python script.
What's the benefit over just changing the rules to actually throw errors and the workflow to

  - uses: github/codeql-action/init@x                                                                                                                                                                     
    with:                                                                                                            
      languages: cpp
      queries: ./test/codeql/mldsa-declarations.ql

One could still keep the ql script for local testing, but that sounds more like 10 line bash script rather than a 640 line Python script.

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.

Can you elaborate? What are you suggesting?

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.

I'll give it a try.

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.

Thanks! If we can directly trigger an error from the .ql that may be easier indeed.

Comment thread flake.nix
devShells.cbmc = util.mkShell {
packages = builtins.attrValues { inherit (config.packages) cbmc toolchains_native; } ++ [ pkgs.gh ];
};
devShells.codeql = util.mkShell {

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.

The following diff would allow us to install it unconditionally:

diff --git a/flake.nix b/flake.nix
index 3231ee183..83c7721d1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -50,6 +50,8 @@
         {
           _module.args.pkgs = import inputs.nixpkgs {
             inherit system;
+            config.allowUnfreePredicate = pkg:
+              builtins.elem (inputs.nixpkgs.lib.getName pkg) [ "codeql" ];
             overlays = [
               (_:_: {
                 clang_22 = pkgs-unstable.clang_22;

With an appropriate comment explaining the license, I believe that may be preferable?

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.

If we expect the developer to run this, this should be included in the default shell.

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 would like the non-free license to be explicit, so the lack of convenience in the current PR is by design.

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.

If we consider this non-free, then I prefer to not use it at all.
There seem to be free alternatives. Let me try that.

@hanno-becker hanno-becker Apr 22, 2026

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.

If we consider this non-free, then I prefer to not use it at all.

No need to be undifferentiated here. The license terms cover our use case. But I don't want to expose a nix shell which hides from the user the fact that not all use cases are covered. For that reason I also don't want it in the default shell, which I want to continue to work as-is.

Comment thread test/codeql/qlpack.yml
Comment on lines +7 to +8
# Pinned to the version shipped with the CodeQL CLI currently packaged in
# nixpkgs (2.23.3). Bump together with the CLI.

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.

What happens if we forget to bump this? I would prefer leaving out this comment as this is guaranteed to be outdated soon.

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.

Ok!

@oqs-bot

oqs-bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

CBMC Results (ML-DSA-44)

Full Results (185 proofs)
Proof Status Current Previous Change
**TOTAL** 1869s 1689s +10.7%
sign_verify_internal 241s 220s +10%
rej_uniform_native 136s 116s +17%
polyvecl_pointwise_acc_montgomery_c 126s 100s +26%
poly_pointwise_montgomery_c 122s 102s +20%
mld_invntt_layer 102s 89s +15%
mld_ct_memcmp 91s 75s +21%
mld_attempt_signature_generation 48s 48s +0%
mld_ntt_layer 46s 41s +12%
polyvec_matrix_expand_eager 33s 31s +6%
fqmul 31s 27s +15%
sign_keypair_internal 26s 23s +13%
keccakf1600x4_permute_native 24s 24s +0%
rej_uniform 24s 21s +14%
sign_signature_internal 24s 22s +9%
poly_chknorm_c 21s 17s +24%
polyt0_unpack 20s 21s -5%
sign_pk_from_sk 19s 18s +6%
mld_ntt_butterfly_block 17s 15s +13%
rej_uniform_c 17s 14s +21%
polyveck_decompose 14s 13s +8%
poly_uniform_eta_4x 13s 14s -7%
poly_invntt_tomont_c 12s 8s +50%
poly_uniform_4x 12s 11s +9%
keccak_absorb_once_x4 11s 9s +22%
poly_add 11s 11s +0%
polyz_unpack_c 11s 12s -8%
mld_check_pct 10s 9s +11%
polyvec_matrix_expand_eager_serial 10s 10s +0%
polyveck_chknorm 10s 7s +43%
mld_compute_pack_z 8s 7s +14%
polyeta_unpack 8s 5s +60%
polyveck_add 8s 4s +100%
keccak_absorb 7s 7s +0%
keccakf1600_permute 7s 8s -12%
pointwise_acc_native_x86_64 7s 6s +17%
poly_power2round 7s 8s -12%
polyvec_matrix_pointwise_montgomery_eager 7s 7s +0%
polyveck_reduce 7s 5s +40%
polyvecl_unpack_eta 7s 3s +133%
sign_signature_pre_hash_internal 7s 5s +40%
unpack_sk 7s 5s +40%
keccakf1600_permute_native 6s 7s -14%
pointwise_acc_native_aarch64 6s 6s +0%
poly_caddq_c 6s 5s +20%
poly_chknorm_native_aarch64 6s 3s +100%
poly_decompose 6s 2s +200%
poly_uniform_eta 6s 3s +100%
poly_uniform_gamma1_4x 6s 6s +0%
polyt1_unpack 6s 3s +100%
polyveck_power2round 6s 6s +0%
polyveck_sub 6s 4s +50%
polyvecl_ntt 6s 4s +50%
rej_eta_native 6s 5s +20%
sign_verify_pre_hash_shake256 6s 6s +0%
keccak_squeezeblocks_x4 5s 3s +67%
keccakf1600_xor_bytes 5s 3s +67%
mld_ct_cmask_nonzero_u8 5s 3s +67%
mld_sample_s1_s2 5s 6s -17%
mld_sample_s1_s2_serial 5s 3s +67%
poly_caddq_native_aarch64 5s 4s +25%
poly_challenge 5s 7s -29%
poly_shiftl 5s 6s -17%
poly_uniform 5s 4s +25%
poly_uniform_gamma1 5s 3s +67%
poly_use_hint 5s 3s +67%
rej_eta 5s 3s +67%
shake256_absorb 5s 3s +67%
sign_signature_extmu 5s 4s +25%
sign_verify 5s 4s +25%
sign_verify_pre_hash_internal 5s 4s +25%
unpack_hints 5s 4s +25%
unpack_sig 5s 4s +25%
decompose 4s 4s +0%
intt_native_x86_64 4s 2s +100%
keccak_f1600_x4_native_aarch64_v8a_scalar_hybrid 4s 3s +33%
keccak_f1600_x4_native_aarch64_v8a_v84a_scalar_hybrid 4s 4s +0%
keccakf1600_extract_bytes (big endian) 4s 2s +100%
mld_ct_cmask_neg_i32 4s 1s +300%
mld_h 4s 4s +0%
mld_prepare_domain_separation_prefix 4s 2s +100%
mld_value_barrier_u8 4s 2s +100%
ntt_native_aarch64 4s 3s +33%
ntt_native_x86_64 4s 4s +0%
pack_pk 4s 3s +33%
pack_sig_h_poly 4s 1s +300%
pack_sk_s1 4s 2s +100%
pointwise_native_x86_64 4s 4s +0%
poly_decompose_c 4s 5s -20%
poly_decompose_native 4s 3s +33%
poly_make_hint 4s 3s +33%
poly_reduce 4s 3s +33%
poly_sub 4s 3s +33%
poly_use_hint_c 4s 5s -20%
polyt1_pack 4s 2s +100%
polyveck_caddq 4s 5s -20%
polyveck_invntt_tomont 4s 4s +0%
polyveck_ntt 4s 3s +33%
polyveck_pointwise_poly_montgomery 4s 5s -20%
polyveck_shiftl 4s 5s -20%
polyveck_unpack_eta 4s 2s +100%
polyveck_use_hint 4s 5s -20%
polyvecl_pack_eta 4s 5s -20%
polyvecl_uniform_gamma1 4s 4s +0%
polyvecl_uniform_gamma1_serial 4s 5s -20%
polyw1_pack 4s 5s -20%
polyz_unpack_native 4s 3s +33%
power2round 4s 4s +0%
shake256x4_squeezeblocks 4s 2s +100%
sign 4s 5s -20%
sign_open 4s 5s -20%
sign_verify_extmu 4s 7s -43%
use_hint 4s 2s +100%
fqscale 3s 3s +0%
keccak_init 3s 2s +50%
keccakf1600x4_extract_bytes 3s 2s +50%
make_hint 3s 2s +50%
mld_ct_get_optblocker_u8 3s 2s +50%
mld_ct_sel_int32 3s 3s +0%
montgomery_reduce 3s 1s +200%
pack_sig_c 3s 4s -25%
pack_sk_rho_key_tr_s2_t0 3s 3s +0%
pointwise_native_aarch64 3s 4s -25%
poly_caddq 3s 2s +50%
poly_caddq_native 3s 4s -25%
poly_chknorm 3s 2s +50%
poly_invntt_tomont 3s 3s +0%
poly_invntt_tomont_native 3s 3s +0%
poly_ntt_c 3s 3s +0%
poly_permute_bitrev_to_custom_optional 3s 2s +50%
poly_permute_bitrev_to_custom_optional_native 3s 5s -40%
poly_pointwise_montgomery 3s 5s -40%
polyt0_pack 3s 5s -40%
polyveck_pack_eta 3s 4s -25%
polyveck_pack_t0 3s 3s +0%
polyveck_pack_w1 3s 5s -40%
polyvecl_chknorm 3s 3s +0%
polyvecl_pointwise_acc_montgomery_native 3s 6s -50%
polyz_pack 3s 3s +0%
polyz_unpack 3s 3s +0%
rej_eta_c 3s 4s -25%
shake128_squeeze 3s 4s -25%
shake128x4_squeezeblocks 3s 5s -40%
shake256 3s 3s +0%
shake256_release 3s 2s +50%
shake256_squeeze 3s 3s +0%
shake256x4_absorb_once 3s 3s +0%
sign_keypair 3s 3s +0%
sign_signature 3s 3s +0%
sign_signature_pre_hash_shake256 3s 6s -50%
sys_check_capability 3s 2s +50%
caddq 2s 4s -50%
keccak_f1600_x1_native_aarch64_v84a 2s 2s +0%
keccak_finalize 2s 2s +0%
keccak_squeeze 2s 4s -50%
keccakf1600x4_xor_bytes 2s 2s +0%
mld_ct_abs_i32 2s 2s +0%
mld_ct_cmask_nonzero_u32 2s 2s +0%
mld_ct_get_optblocker_i64 2s 2s +0%
mld_keccakf1600_extract_bytes 2s 3s -33%
mld_value_barrier_u32 2s 1s +100%
pack_sig_z 2s 2s +0%
poly_chknorm_native 2s 3s -33%
poly_ntt_native 2s 3s -33%
poly_pointwise_montgomery_native 2s 1s +100%
poly_use_hint_native 2s 2s +0%
polyveck_unpack_t0 2s 3s -33%
polyvecl_pointwise_acc_montgomery 2s 4s -50%
polyvecl_unpack_z 2s 2s +0%
reduce32 2s 3s -33%
shake128_init 2s 2s +0%
shake128x4_absorb_once 2s 3s -33%
shake256_init 2s 2s +0%
unpack_pk 2s 4s -50%
keccak_f1600_x1_native_aarch64 1s 3s -67%
keccak_f1600_x4_native_aarch64_v84a 1s 2s -50%
keccakf1600_xor_bytes (big endian) 1s 3s -67%
keccakf1600x4_permute 1s 4s -75%
mld_ct_get_optblocker_u32 1s 4s -75%
mld_value_barrier_i64 1s 4s -75%
poly_ntt 1s 1s +0%
polyeta_pack 1s 5s -80%
shake128_absorb 1s 2s -50%
shake128_finalize 1s 3s -67%
shake128_release 1s 4s -75%
shake256_finalize 1s 1s +0%

@oqs-bot

oqs-bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

CBMC Results (ML-DSA-65)

Full Results (185 proofs)
Proof Status Current Previous Change
**TOTAL** 2320s 2008s +15.5%
polyvecl_pointwise_acc_montgomery_c 294s 220s +34%
sign_verify_internal 256s 219s +17%
polyvec_matrix_expand_eager 193s 168s +15%
rej_uniform_native 139s 117s +19%
poly_pointwise_montgomery_c 132s 99s +33%
mld_invntt_layer 106s 94s +13%
mld_ct_memcmp 92s 74s +24%
mld_attempt_signature_generation 55s 49s +12%
mld_ntt_layer 49s 41s +20%
fqmul 32s 28s +14%
sign_keypair_internal 29s 28s +4%
sign_signature_internal 29s 26s +12%
keccakf1600x4_permute_native 27s 24s +12%
polyvec_matrix_expand_eager_serial 27s 27s +0%
polyt0_unpack 23s 17s +35%
rej_uniform 23s 20s +15%
sign_pk_from_sk 22s 19s +16%
poly_chknorm_c 20s 17s +18%
polyveck_pointwise_poly_montgomery 19s 15s +27%
mld_ntt_butterfly_block 18s 19s -5%
rej_uniform_c 17s 13s +31%
polyveck_decompose 16s 15s +7%
polyveck_power2round 15s 14s +7%
poly_uniform_eta_4x 14s 12s +17%
polyveck_add 14s 12s +17%
poly_add 13s 12s +8%
poly_uniform_4x 12s 11s +9%
keccak_absorb_once_x4 11s 10s +10%
mld_check_pct 10s 10s +0%
poly_invntt_tomont_c 10s 8s +25%
polyvec_matrix_pointwise_montgomery_eager 10s 9s +11%
polyz_unpack_c 10s 11s -9%
keccakf1600_permute_native 9s 8s +12%
polyvecl_ntt 9s 8s +12%
keccak_absorb 8s 7s +14%
polyveck_ntt 8s 7s +14%
polyveck_shiftl 8s 7s +14%
polyveck_sub 8s 6s +33%
keccakf1600_permute 7s 8s -12%
ntt_native_x86_64 7s 3s +133%
pointwise_acc_native_aarch64 7s 5s +40%
pointwise_acc_native_x86_64 7s 4s +75%
polyveck_caddq 7s 7s +0%
polyveck_chknorm 7s 6s +17%
polyveck_invntt_tomont 7s 6s +17%
polyveck_use_hint 7s 8s -12%
sign 7s 7s +0%
sign_signature 7s 3s +133%
sign_verify 7s 5s +40%
poly_ntt 6s 2s +200%
poly_shiftl 6s 4s +50%
polyveck_reduce 6s 8s -25%
polyvecl_chknorm 6s 3s +100%
polyvecl_pointwise_acc_montgomery 6s 3s +100%
sign_signature_pre_hash_shake256 6s 4s +50%
sign_verify_pre_hash_shake256 6s 3s +100%
unpack_hints 6s 6s +0%
unpack_sk 6s 4s +50%
mld_compute_pack_z 5s 4s +25%
mld_sample_s1_s2 5s 8s -38%
pack_sk_rho_key_tr_s2_t0 5s 2s +150%
pack_sk_s1 5s 3s +67%
poly_caddq_c 5s 3s +67%
poly_caddq_native 5s 3s +67%
poly_chknorm 5s 2s +150%
poly_chknorm_native 5s 4s +25%
poly_decompose_c 5s 4s +25%
poly_power2round 5s 5s +0%
poly_uniform 5s 8s -38%
poly_uniform_eta 5s 3s +67%
poly_uniform_gamma1_4x 5s 1s +400%
polyveck_pack_t0 5s 2s +150%
rej_eta_native 5s 3s +67%
shake256 5s 3s +67%
shake256_init 5s 4s +25%
shake256_release 5s 2s +150%
sign_open 5s 4s +25%
sign_signature_pre_hash_internal 5s 8s -38%
intt_native_x86_64 4s 2s +100%
keccak_f1600_x1_native_aarch64 4s 5s -20%
keccak_f1600_x1_native_aarch64_v84a 4s 2s +100%
keccak_f1600_x4_native_aarch64_v8a_scalar_hybrid 4s 1s +300%
keccak_f1600_x4_native_aarch64_v8a_v84a_scalar_hybrid 4s 4s +0%
keccak_squeezeblocks_x4 4s 6s -33%
mld_h 4s 2s +100%
mld_prepare_domain_separation_prefix 4s 5s -20%
mld_sample_s1_s2_serial 4s 5s -20%
pointwise_native_x86_64 4s 4s +0%
poly_chknorm_native_aarch64 4s 2s +100%
poly_decompose 4s 3s +33%
poly_decompose_native 4s 5s -20%
poly_permute_bitrev_to_custom_optional 4s 3s +33%
poly_permute_bitrev_to_custom_optional_native 4s 2s +100%
poly_pointwise_montgomery_native 4s 2s +100%
poly_reduce 4s 3s +33%
poly_use_hint 4s 2s +100%
poly_use_hint_c 4s 4s +0%
polyeta_unpack 4s 4s +0%
polyveck_pack_w1 4s 2s +100%
polyveck_unpack_t0 4s 5s -20%
polyvecl_pointwise_acc_montgomery_native 4s 6s -33%
polyvecl_unpack_eta 4s 2s +100%
polyz_unpack 4s 4s +0%
power2round 4s 5s -20%
shake128_finalize 4s 3s +33%
sign_signature_extmu 4s 7s -43%
sign_verify_extmu 4s 5s -20%
caddq 3s 4s -25%
fqscale 3s 3s +0%
keccak_f1600_x4_native_aarch64_v84a 3s 3s +0%
keccak_finalize 3s 5s -40%
keccakf1600_extract_bytes (big endian) 3s 3s +0%
keccakf1600_xor_bytes 3s 1s +200%
keccakf1600x4_extract_bytes 3s 1s +200%
mld_ct_cmask_neg_i32 3s 2s +50%
mld_ct_get_optblocker_u8 3s 3s +0%
mld_ct_sel_int32 3s 3s +0%
mld_value_barrier_u8 3s 2s +50%
montgomery_reduce 3s 3s +0%
ntt_native_aarch64 3s 2s +50%
pack_sig_c 3s 3s +0%
pack_sig_z 3s 4s -25%
pointwise_native_aarch64 3s 4s -25%
poly_caddq 3s 6s -50%
poly_caddq_native_aarch64 3s 3s +0%
poly_challenge 3s 3s +0%
poly_ntt_c 3s 3s +0%
poly_sub 3s 2s +50%
poly_uniform_gamma1 3s 3s +0%
polyeta_pack 3s 3s +0%
polyt0_pack 3s 4s -25%
polyveck_unpack_eta 3s 2s +50%
polyvecl_pack_eta 3s 3s +0%
polyvecl_uniform_gamma1_serial 3s 4s -25%
polyz_pack 3s 2s +50%
rej_eta 3s 2s +50%
shake128_squeeze 3s 2s +50%
shake128x4_absorb_once 3s 1s +200%
shake256_finalize 3s 3s +0%
sign_keypair 3s 3s +0%
sys_check_capability 3s 1s +200%
unpack_pk 3s 4s -25%
use_hint 3s 4s -25%
keccak_squeeze 2s 2s +0%
keccakf1600_xor_bytes (big endian) 2s 3s -33%
keccakf1600x4_permute 2s 3s -33%
make_hint 2s 3s -33%
mld_ct_abs_i32 2s 4s -50%
mld_ct_cmask_nonzero_u32 2s 4s -50%
mld_ct_get_optblocker_i64 2s 3s -33%
mld_ct_get_optblocker_u32 2s 2s +0%
mld_keccakf1600_extract_bytes 2s 3s -33%
mld_value_barrier_u32 2s 4s -50%
pack_pk 2s 6s -67%
pack_sig_h_poly 2s 2s +0%
poly_invntt_tomont 2s 2s +0%
poly_invntt_tomont_native 2s 4s -50%
poly_make_hint 2s 3s -33%
poly_ntt_native 2s 4s -50%
poly_pointwise_montgomery 2s 2s +0%
poly_use_hint_native 2s 1s +100%
polyt1_pack 2s 2s +0%
polyt1_unpack 2s 1s +100%
polyveck_pack_eta 2s 4s -50%
polyvecl_uniform_gamma1 2s 5s -60%
polyvecl_unpack_z 2s 6s -67%
polyw1_pack 2s 2s +0%
polyz_unpack_native 2s 2s +0%
reduce32 2s 2s +0%
rej_eta_c 2s 2s +0%
shake128_absorb 2s 2s +0%
shake128_init 2s 4s -50%
shake128_release 2s 3s -33%
shake128x4_squeezeblocks 2s 2s +0%
shake256_absorb 2s 2s +0%
shake256x4_absorb_once 2s 5s -60%
shake256x4_squeezeblocks 2s 2s +0%
sign_verify_pre_hash_internal 2s 6s -67%
unpack_sig 2s 4s -50%
decompose 1s 1s +0%
keccak_init 1s 3s -67%
keccakf1600x4_xor_bytes 1s 2s -50%
mld_ct_cmask_nonzero_u8 1s 2s -50%
mld_value_barrier_i64 1s 2s -50%
shake256_squeeze 1s 2s -50%

@oqs-bot

oqs-bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

CBMC Results (ML-DSA-87)

Full Results (185 proofs)
Proof Status Current Previous Change
**TOTAL** 2465s 2253s +9.4%
polyvecl_pointwise_acc_montgomery_c 351s 267s +31%
sign_verify_internal 297s 282s +5%
polyvec_matrix_expand_eager 150s 146s +3%
rej_uniform_native 133s 126s +6%
poly_pointwise_montgomery_c 129s 106s +22%
mld_invntt_layer 104s 98s +6%
mld_ct_memcmp 90s 80s +12%
mld_attempt_signature_generation 87s 84s +4%
polyvec_matrix_expand_eager_serial 64s 63s +2%
sign_keypair_internal 50s 50s +0%
mld_ntt_layer 46s 42s +10%
fqmul 31s 29s +7%
sign_pk_from_sk 28s 27s +4%
sign_signature_internal 28s 24s +17%
keccakf1600x4_permute_native 23s 24s -4%
polyt0_unpack 22s 17s +29%
rej_uniform 22s 24s -8%
poly_chknorm_c 20s 18s +11%
mld_ntt_butterfly_block 18s 16s +12%
polyveck_decompose 18s 17s +6%
rej_uniform_c 16s 14s +14%
polyveck_chknorm 15s 13s +15%
polyveck_sub 15s 19s -21%
polyveck_add 13s 14s -7%
poly_add 12s 12s +0%
poly_uniform_eta_4x 12s 14s -14%
polyvec_matrix_pointwise_montgomery_eager 12s 13s -8%
keccak_absorb_once_x4 11s 9s +22%
poly_uniform_4x 11s 12s -8%
pointwise_acc_native_x86_64 10s 8s +25%
poly_decompose_c 10s 7s +43%
polyveck_pointwise_poly_montgomery 10s 10s +0%
mld_compute_pack_z 9s 10s -10%
poly_invntt_tomont_c 9s 9s +0%
poly_power2round 9s 7s +29%
polyeta_unpack 9s 9s +0%
polyveck_invntt_tomont 9s 11s -18%
polyvecl_ntt 9s 10s -10%
keccakf1600_permute 8s 8s +0%
keccakf1600_permute_native 8s 8s +0%
polyveck_power2round 8s 11s -27%
rej_eta_native 8s 4s +100%
sign 8s 8s +0%
keccak_absorb 7s 7s +0%
mld_check_pct 7s 9s -22%
mld_sample_s1_s2 7s 7s +0%
pointwise_acc_native_aarch64 7s 7s +0%
poly_use_hint_c 7s 3s +133%
polyveck_ntt 7s 6s +17%
keccak_finalize 6s 2s +200%
mld_prepare_domain_separation_prefix 6s 4s +50%
poly_caddq_native_aarch64 6s 3s +100%
polyveck_caddq 6s 5s +20%
polyveck_reduce 6s 7s -14%
polyveck_shiftl 6s 3s +100%
polyveck_unpack_eta 6s 2s +200%
polyveck_use_hint 6s 7s -14%
polyvecl_chknorm 6s 3s +100%
polyvecl_pointwise_acc_montgomery_native 6s 1s +500%
polyvecl_uniform_gamma1 6s 4s +50%
polyvecl_uniform_gamma1_serial 6s 7s -14%
polyz_unpack_c 6s 4s +50%
sign_verify 6s 6s +0%
unpack_hints 6s 6s +0%
unpack_sk 6s 7s -14%
mld_h 5s 3s +67%
pack_pk 5s 4s +25%
poly_caddq_native 5s 2s +150%
poly_ntt_c 5s 3s +67%
poly_shiftl 5s 4s +25%
polyeta_pack 5s 3s +67%
polyveck_pack_t0 5s 4s +25%
polyvecl_unpack_z 5s 3s +67%
shake256_release 5s 1s +400%
shake256_squeeze 5s 2s +150%
sign_signature 5s 4s +25%
sign_signature_pre_hash_shake256 5s 6s -17%
sign_verify_extmu 5s 5s +0%
caddq 4s 6s -33%
decompose 4s 2s +100%
fqscale 4s 3s +33%
intt_native_x86_64 4s 4s +0%
keccak_f1600_x1_native_aarch64 4s 2s +100%
keccak_squeezeblocks_x4 4s 5s -20%
mld_ct_cmask_nonzero_u32 4s 5s -20%
mld_sample_s1_s2_serial 4s 7s -43%
mld_value_barrier_i64 4s 1s +300%
ntt_native_aarch64 4s 4s +0%
pack_sig_c 4s 2s +100%
poly_caddq_c 4s 4s +0%
poly_challenge 4s 3s +33%
poly_chknorm_native 4s 5s -20%
poly_pointwise_montgomery_native 4s 4s +0%
poly_uniform 4s 4s +0%
poly_uniform_eta 4s 3s +33%
poly_uniform_gamma1_4x 4s 5s -20%
poly_use_hint_native 4s 4s +0%
polyveck_unpack_t0 4s 6s -33%
polyvecl_pack_eta 4s 3s +33%
polyvecl_pointwise_acc_montgomery 4s 3s +33%
polyvecl_unpack_eta 4s 5s -20%
polyz_unpack 4s 3s +33%
polyz_unpack_native 4s 3s +33%
power2round 4s 2s +100%
rej_eta_c 4s 5s -20%
shake256_init 4s 2s +100%
sign_open 4s 4s +0%
sign_verify_pre_hash_shake256 4s 4s +0%
unpack_pk 4s 4s +0%
keccak_f1600_x4_native_aarch64_v8a_scalar_hybrid 3s 4s -25%
keccak_init 3s 1s +200%
keccak_squeeze 3s 3s +0%
keccakf1600_extract_bytes (big endian) 3s 2s +50%
keccakf1600_xor_bytes 3s 2s +50%
keccakf1600_xor_bytes (big endian) 3s 2s +50%
mld_ct_abs_i32 3s 2s +50%
mld_ct_cmask_neg_i32 3s 2s +50%
mld_ct_get_optblocker_i64 3s 2s +50%
mld_ct_sel_int32 3s 2s +50%
mld_value_barrier_u32 3s 2s +50%
pack_sk_s1 3s 3s +0%
pointwise_native_aarch64 3s 3s +0%
poly_caddq 3s 3s +0%
poly_chknorm 3s 2s +50%
poly_chknorm_native_aarch64 3s 3s +0%
poly_decompose 3s 3s +0%
poly_invntt_tomont 3s 3s +0%
poly_make_hint 3s 4s -25%
poly_permute_bitrev_to_custom_optional 3s 2s +50%
poly_pointwise_montgomery 3s 3s +0%
poly_uniform_gamma1 3s 2s +50%
poly_use_hint 3s 4s -25%
polyt0_pack 3s 2s +50%
polyt1_pack 3s 1s +200%
polyt1_unpack 3s 1s +200%
polyveck_pack_eta 3s 3s +0%
polyveck_pack_w1 3s 3s +0%
polyw1_pack 3s 1s +200%
polyz_pack 3s 3s +0%
reduce32 3s 2s +50%
rej_eta 3s 3s +0%
shake128_finalize 3s 2s +50%
shake256_absorb 3s 2s +50%
shake256_finalize 3s 2s +50%
shake256x4_absorb_once 3s 4s -25%
sign_keypair 3s 2s +50%
sign_signature_extmu 3s 6s -50%
unpack_sig 3s 3s +0%
keccak_f1600_x1_native_aarch64_v84a 2s 2s +0%
keccak_f1600_x4_native_aarch64_v84a 2s 3s -33%
keccakf1600x4_extract_bytes 2s 3s -33%
keccakf1600x4_permute 2s 1s +100%
keccakf1600x4_xor_bytes 2s 3s -33%
make_hint 2s 2s +0%
mld_ct_cmask_nonzero_u8 2s 2s +0%
mld_ct_get_optblocker_u32 2s 2s +0%
mld_ct_get_optblocker_u8 2s 2s +0%
mld_value_barrier_u8 2s 3s -33%
montgomery_reduce 2s 3s -33%
ntt_native_x86_64 2s 4s -50%
pack_sig_h_poly 2s 5s -60%
pack_sig_z 2s 3s -33%
pack_sk_rho_key_tr_s2_t0 2s 4s -50%
pointwise_native_x86_64 2s 3s -33%
poly_decompose_native 2s 3s -33%
poly_invntt_tomont_native 2s 3s -33%
poly_ntt 2s 2s +0%
poly_ntt_native 2s 4s -50%
poly_reduce 2s 4s -50%
poly_sub 2s 2s +0%
shake128_init 2s 4s -50%
shake128_release 2s 3s -33%
shake128_squeeze 2s 1s +100%
shake128x4_absorb_once 2s 3s -33%
shake128x4_squeezeblocks 2s 2s +0%
shake256x4_squeezeblocks 2s 2s +0%
sign_signature_pre_hash_internal 2s 3s -33%
sign_verify_pre_hash_internal 2s 3s -33%
sys_check_capability 2s 3s -33%
use_hint 2s 2s +0%
keccak_f1600_x4_native_aarch64_v8a_v84a_scalar_hybrid 1s 2s -50%
mld_keccakf1600_extract_bytes 1s 3s -67%
poly_permute_bitrev_to_custom_optional_native 1s 4s -75%
shake128_absorb 1s 1s +0%
shake256 1s 4s -75%

@hanno-becker

Copy link
Copy Markdown
Contributor Author

Shelving for now, @mkannwischer is not convinced of the approach and will explore alternatives first. We can always come back to this.

@mkannwischer

Copy link
Copy Markdown
Contributor

Reopening so we don't forget this exists.

@mkannwischer mkannwischer reopened this Jul 14, 2026
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.

3 participants