Commit Graph
4404 Commits
Author SHA1 Message Date
Frank Denis e1eba14528 Regen autoconf 2026-08-27 19:47:47 +02:00
Frank Denis 97386a6a21 Add evex flags for old LLVM versions, for chacha and salsa
Fixes #1553
2026-08-27 19:24:25 +02:00
Frank Denis bb586db614 Add AVX-512 implementations of salsa20 and chacha20 2026-08-27 19:24:19 +02:00
Frank Denis 1899e2061a Add a build option to remove the freestanding libc 2026-08-27 10:22:25 +02:00
Frank Denis a67f8c346e Regen autoconf 2026-08-26 23:55:46 +02:00
Frank Denis bb1770a08f Add support for wasm32-freestanding 2026-08-26 23:54:24 +02:00
Frank Denis 00a57ecc0a Github CI: use ZIg 0.16.0 2026-08-26 20:19:19 +02:00
Frank Denis 3c88a7424c Update MSYS3 2026-08-26 20:14:47 +02:00
Frank Denis 795fe30267 Visual Studio 2019 craps out with aarch64, restore need for 2022+ 2026-08-26 20:11:08 +02:00
Frank Denis eb9519711c Use installBinFile() to copy test exp files 2026-08-26 20:02:49 +02:00
Frank Denis 6315c82fec Fix azure-pipelines CI
VS2026 isn't included in windows-latest there.

Also explicitly install the VS2019 ARM64 tools.
2026-08-26 19:52:25 +02:00
Frank Denis 0dbbfd7af8 buildbase.bat: Use vswhere to discover Visual Studio 2026-08-26 19:51:34 +02:00
Frank Denis 9958dc5191 Fix version.h copying for Zig 0.17+ 2026-08-26 19:22:43 +02:00
Frank Denis ec3769f4ed dotnet-core workflow: switch to VS2026
On the current Windows images, it looks like VS2026 is in
Microsoft Visual Studio\18

Also, for ARM64, use the documented amd64_arm64 environment
2026-08-26 18:54:30 +02:00
Frank Denis 2d59e49ca0 CI: Use the windows-2022 image for VS2022 2026-08-26 18:44:57 +02:00
Frank Denis 9450a9c28a Temporary hack for zig 0.16/zig 0.17 compat 2026-08-26 17:44:14 +02:00
Frank Denis 26e4471dfd emscriptenb: HEAPU8 is globally defined 2026-08-26 15:36:41 +02:00
Frank Denis 8b629e88f5 emscripten: add -sEXPORTED_RUNTIME_METHODS 2026-08-26 15:36:09 +02:00
Frank Denis e8a6dd8b43 JavaScript: faster randomness generation
Fill entire buffers directly.
2026-08-26 15:29:47 +02:00
Frank Denis 2c61b499e7 sodium_bin2ip: no need to copy an extra byte 2026-08-13 07:30:50 +02:00
Frank Denis 701aa826b9 Update for zig-current
Keep compat with previous version for now

Fixes #1551
2026-07-31 17:25:40 +02:00
Frank Denis 2ce4d906a6 Always use STORE32_LE for unaligned stores, even when it's a noop 2026-07-12 14:37:05 +02:00
Frank Denis 77a422c85a Regen 2026-07-08 22:16:49 +02:00
Frank Denis a0b565b81b Include unistd.h unconditionally on !windows 2026-07-08 22:13:25 +02:00
Frank Denis 962bda2168 wasmer syntax for volumes seems to have changed 2026-07-08 22:13:15 +02:00
Frank Denis 83ee4408b7 Add a compile-time option to set the max webassembly memory 2026-06-23 18:23:10 +02:00
Frank Denis 8dd5c75499 Update for zig-current 2026-06-11 15:50:06 +02:00
Frank Denis a0859f2a6c CI: trigger CodeQL properly
Reported by Nicolas IOOSS - Thanks!

Fixes #1539
2026-06-11 15:28:27 +02:00
Frank Denis b934a541f7 Replace softaes with a bitsliced implementation 2026-06-11 15:28:22 +02:00
Frank Denis 7c1ea609f4 SipHash: help the compiler a little bit 2026-06-11 15:27:51 +02:00
Frank Denis 6871630041 Improve Keccak performance 2026-06-11 15:27:39 +02:00
Frank Denis 33cc75ab15 Fix: sodium_misuse() callback runs under global lock and can deadlock
SUMMARY
`src/libsodium/sodium/core.c` invokes the process-global misuse callback from `sodium_misuse()` while still holding the library-wide critical section. If the application-installed callback re-enters any API path that acquires the same lock, including `sodium_set_misuse_handler()`, execution deadlocks before `abort()` is reached. This breaks the intended fail-stop behavior of misuse handling.

PROVENANCE
Verified from the provided finding, reproduced locally from the committed control flow, and documented for Swival Security Scanner (https://swival.dev).

PRECONDITIONS
- A caller installs a misuse handler via `sodium_set_misuse_handler()`.
- The handler re-enters an API path that takes the same global critical section, including `sodium_set_misuse_handler()`.

PROOF
1. `sodium_set_misuse_handler()` writes the global `_misuse_handler` under `sodium_crit_enter()` / `sodium_crit_leave()` in `src/libsodium/sodium/core.c:170` and `src/libsodium/sodium/core.c:174`.
2. `sodium_misuse()` acquires that same critical section, copies `_misuse_handler`, and invokes `handler()` before releasing the lock in `src/libsodium/sodium/core.c:155` and `src/libsodium/sodium/core.c:160`.
3. The pthread-backed critical section in this file is non-recursive (`src/libsodium/sodium/core.c:89`), so a callback that calls `sodium_set_misuse_handler()` blocks in `sodium_crit_enter()` waiting on the lock already held by `sodium_misuse()`.
4. Because `sodium_misuse()` is waiting for the callback to return, it never reaches `abort()`, converting a fail-stop misuse path into a hang.
5. Reproduction confirmed this with a minimal pthread harness: the handler printed `handler: before reentry` and then hung until terminated by `timeout`.

WHY THIS IS A REAL BUG
The callback target is application-controlled through an exported setter, and `sodium_misuse()` calls it on a misuse path without enforcing any non-reentrancy contract. On pthread targets, a handler that performs a supported API call can permanently block process termination. That is a reachable behavioral failure, not a theoretical lock-order concern.

FIX REQUIREMENT
Load `_misuse_handler` while holding the lock, release the critical section, and only then invoke the callback. This removes lock-dependent behavior from arbitrary user code while preserving synchronized access to the global handler pointer.
2026-04-16 16:51:18 +02:00
Frank Denis 77e1ce5d6d Add code comments about why variable-time is fine for public inputs 1.0.22-RELEASE 1.0.22 2026-04-09 23:00:06 +02:00
Frank Denis d57f757b52 Update ChangeLog 2026-04-09 23:00:06 +02:00
Frank Denis c213b0808b Regen emscripten symbols 2026-04-09 23:00:05 +02:00
Frank Denis d022f2d637 State wipe 2026-04-09 23:00:05 +02:00
Frank Denis 758bb4a4de ML-KEM: wipe ephemeral seeds and harden invalid-pk test 2026-04-09 23:00:05 +02:00
Frank Denis bf8cf449ea sha3: make post-final misuse safe and deterministic 2026-04-09 23:00:05 +02:00
Frank Denis 3ab195644f Add .swival/ and tmp/ to .gitignore 2026-04-09 23:00:05 +02:00
Frank Denis 57c6200865 Regen 2026-04-09 23:00:05 +02:00
Frank Denis 9a16e6b79a Add SHA-3 and KEM symbols to emscripten exports 2026-04-09 23:00:05 +02:00
Frank Denis 30a18ae407 Add a high-level crypto_kem API mapping to xwing 2026-04-09 23:00:05 +02:00
Frank Denis 3fa3eac209 Add X-Wing 2026-04-09 23:00:05 +02:00
Frank Denis bca64e0982 Add ML-KEM768 2026-04-09 23:00:05 +02:00
Frank Denis 350313ec20 Add support for SHA3 2026-04-09 23:00:05 +02:00
Frank Denis 2f8a60ae82 Update ChangeLog 2026-04-09 23:00:05 +02:00
Frank Denis a09f7ed21a Add some coverage exclusions 2026-04-09 23:00:05 +02:00
Frank Denis 8490eeb0d5 Add a couple more tests 2026-04-09 23:00:04 +02:00
Frank Denis b0d658a856 Add a couple more tests 2026-04-09 23:00:04 +02:00
Frank Denis dc213c8e8e Add some additional tests for HKDF and Salsa20/12 2026-04-09 23:00:04 +02:00