Skip to content

ML-DSA AVX512: Add new assembly - #11032

Open
SparkiDev wants to merge 1 commit into
wolfSSL:masterfrom
SparkiDev:mldsa_avx512
Open

ML-DSA AVX512: Add new assembly#11032
SparkiDev wants to merge 1 commit into
wolfSSL:masterfrom
SparkiDev:mldsa_avx512

Conversation

@SparkiDev

Copy link
Copy Markdown
Contributor

Description

Add implementation of assembly code for AVX512F/BW and AVX512F/BW/VBMI.
Improvements to AVX2 assembly.
Check AVX512BW CPU id flag for base AVX512 assembly for ML-KEM.

Testing

Regression tested ML-DSA.

@SparkiDev SparkiDev self-assigned this Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #11032

Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 1

Medium (1)

mlkem_rej_uniform*_ins dispatch on AVX512F alone, not AVX512F+BW

File: wolfcrypt/src/wc_mlkem_poly.c:2327
Function: mlkem_rej_uniform_n_ins
Category: Logic errors

mlkem_rej_uniform_n_ins/mlkem_rej_uniform_ins gate the base AVX512 path with IS_INTEL_AVX512(cpuid_flags) instead of the USE_INTEL_AVX512 (F+BW) macro this PR introduced for exactly this purpose. The fallback mlkem_rej_uniform_n_avx512/mlkem_rej_uniform_avx512 routines execute vpshufb zmm..., an AVX512BW-only instruction, causing SIGILL on AVX512F-without-BW hardware. Every sibling dispatcher in this same file (mlkem_cbd_eta2_ins, mlkem_compress_10, etc.) correctly uses USE_INTEL_AVX512.

Recommendation: Change both if (IS_INTEL_AVX512(cpuid_flags)) guards to if (USE_INTEL_AVX512(cpuid_flags)) to match the rest of the file.

Referenced code: wolfcrypt/src/wc_mlkem_poly.c:2327-2331 (5 lines)


This review was generated automatically by Fenrir. Findings are non-blocking.

Add implementation of assembly code for AVX512F/BW and AVX512F/BW/VBMI.
Improvements to AVX2 assembly.
Check AVX512BW CPU id flag for base AVX512 assembly for ML-KEM.
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