Skip to content

crypto: add SG2002 SM3 DMA with an OpenSSL compression patch - #516

Closed
dormancygrace wants to merge 2 commits into
codex/openssl-sm4from
codex/openssl-sm3
Closed

dormancygrace wants to merge 2 commits into
codex/openssl-sm4from
codex/openssl-sm3

Conversation

@dormancygrace

@dormancygrace dormancygrace commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Adds 0009-sm3-dma.patch on top of #514 and the matching SG2002 SM3 kernel extension. OpenSSL keeps its buffering, padding and length tracking; hardware absence or failed chunks resume software from the last committed state. The original RUN/INFO ioctl numbers and layouts stay unchanged, with a separate INFO2 for SM3 counters. No ENGINE or cryptodev is used.

Sophgo added the SM3 descriptor bit and result registers in 6ef521238996, superseding the older TRM reserved-bit description. The driver uses separate DMA output and retains bounded waits and the poison policy.

Validation: warning-free RISC-V OpenSSL 3.5.9 and Linux 7.3.0-r3 module builds; ASan/UBSan transport tests for all eight algorithms and negative control; 960 SM3 continuation cases with independent compression/KAT; descriptor/ABI/status tests with 4098 length cases; 288 independent host EVP reference cases.

Draft: the first physical SG2002 SM3 request timed out (status 0, result registers all zero). SM3 is disabled by default: it is absent from INFO capabilities and direct requests return EOPNOTSUPP. The experimental_sm3=1 load-time parameter is diagnostic only. The timeout poison policy worked; 288 SM3 and 864 SHA EVP cases passed through software afterward, and reboot restored the installed module without changing its file.

Hardware result order, completion and chaining still need investigation. CPU/RAM benefit and the 4 KiB threshold are not qualified. The included dma-verify.c checks raw hardware messages against software OpenSSL before integrated EVP qualification.

@github-actions

Copy link
Copy Markdown

Build outputs

Compared with the build of main at c93fb1a; codex/openssl-sm4 is at 560af7d, so outputs changed since then are listed too.

4 changed, 14 added, 0 removed of 584 outputs.

directory files
changed lib lib/modules/7.3.0-nanokvm-os-r3/extra/sg2002_aes_probe.ko
changed opensbi opensbi/build-manifest.json (records the hash of platform/build.sh)
changed server server/NanoKVM-Server
server/nkos-update
added tools 14 files
Hashes: outputs-sha256 artifact of this run.

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.

1 participant