4688 Commits
Author SHA1 Message Date
Frank Denis e6324db75c sodium_bin2ip: no need to copy an extra byte 2026-08-13 07:30:25 +02:00
Frank Denis b81ab0783e Update for zig-current
Keep compat with previous version for now

Fixes #1551
2026-07-31 17:23:45 +02:00
Frank Denis 7014b204b6 Interleave stream encryption and Poly1305 on cache-sized chunks 2026-07-12 19:49:37 +02:00
Frank Denis f17fa784e0 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Always use STORE32_LE for unaligned stores, even when it's a noop
2026-07-12 15:00:50 +02:00
Frank Denis 5e261847ce Add NEON implementations of salsa20 and chacha20 2026-07-12 15:00:34 +02:00
Frank Denis f5c49665fa Always use STORE32_LE for unaligned stores, even when it's a noop 2026-07-12 14:36:25 +02:00
Frank Denis 931db45728 Add AVX-512 implementations of salsa20 and chacha20 2026-07-12 13:53:53 +02:00
Frank Denis 984c9f3828 Include unistd.h unconditionally on !windows 2026-07-08 22:12:29 +02:00
Frank Denis 66360d57df wasmer syntax for volumes seems to have changed 2026-07-08 21:56:14 +02:00
Frank Denis d4c60aee3e x25519: no need to normalize g in the ladder's subtraction 2026-07-03 13:20:32 +02:00
Frank Denis 19368ed0c9 Avoid unneeded u128 conversion 2026-07-03 13:20:02 +02:00
Frank Denis 95a428090f Add a compile-time option to set the max webassembly memory 2026-06-23 18:22:40 +02:00
Frank Denis 8e3be8615b CI: trigger CodeQL properly
Reported by Nicolas IOOSS - Thanks!

Fixes #1539
2026-06-11 15:11:24 +02:00
Frank Denis 3591adef1c For translate-c, use .Debug optlevel 2026-05-31 18:49:33 +02:00
Frank Denis 33ec70b372 Replace softaes with a bitsliced implementation 2026-05-31 14:32:14 +02:00
Frank Denis 63b30034a6 Update for zig-current 2026-05-27 14:01:56 +02:00
Frank Denis cb20f6d9cd SipHash: help the compiler a little bit 2026-05-04 10:34:04 +02:00
Frank Denis 10f787b53f @cimport is no more 2026-05-02 14:20:50 +02:00
Frank Denis f1f5745f50 Improve Keccak performance 2026-05-02 13:06:13 +02:00
Frank Denis df8802b013 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 23:00:13 +02:00
Frank Denis 83edcb43b1 Sync ChangeLog 2026-04-09 23:56:17 +02:00
Frank Denis 15a405652a CI: add an extra persist-credentials: false 2026-04-09 23:01:10 +02:00
Frank Denis af7289f16a Update GitHub actions 2026-04-09 23:00:10 +02:00
Frank Denis d3d28edf45 Include <core.h> to get sodium_misuse 2026-04-09 22:18:01 +02:00
Frank Denis 286fb1205f Allow NULL pointers (with length=0) with shorthash 2026-04-09 22:17:57 +02:00
Frank Denis 35df98abf0 Reject impossible lengths in crypto_box 2026-04-09 22:17:50 +02:00
Frank Denis 51be825e1a Add some zeroing 2026-04-09 22:17:47 +02:00
Frank Denis 65957fb00f Add some message size guards in AEGIS, for consistency 2026-04-09 22:17:43 +02:00
Frank Denis e700428672 Update msys2 2026-04-09 22:17:39 +02:00
Frank Denis c902df07e3 Fix compilation on ARM with very old gcc versions 2026-04-09 00:08:56 +02:00
Frank Denis 266e731c46 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Pin
2026-04-09 00:00:17 +02:00
Frank Denis 09cb475ee0 Unify AES key expansion code on ARM 2026-04-08 23:59:53 +02:00
Frank Denis ad61cc6ace Remove trailing comma 2026-04-08 23:58:23 +02:00
Frank Denis 38395ff8b9 Pin 2026-04-08 23:00:33 +02:00
Frank Denis 0681744528 Call sodium_misuse on ridiculously high base64 input lengths 2026-04-08 21:42:08 +02:00
Frank Denis 45174d6570 Add version consistency check to CI 2026-04-08 21:42:04 +02:00
Frank Denis caeea3fc0a Do not strip debug builds 2026-04-08 12:06:28 +02:00
Frank Denis 3eafe0ac91 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Add conftest files to .gitignore
  Only build test-vectors on demand
2026-04-08 10:04:40 +02:00
Frank Denis 11cd77c5cd Avoid unaligned reads, even on x86_64 where they are safe 2026-04-08 12:03:28 +02:00
Frank Denis 4a6a7a010d Add test vectors from Rooterberg and Wycheproof test suites
Closes #1517
2026-04-08 12:00:28 +02:00
Frank Denis c5bd9080bc Add conftest files to .gitignore 2026-04-08 09:41:30 +02:00
Frank Denis b33f57b6ad Only build test-vectors on demand 2026-04-08 09:36:22 +02:00
Frank Denis 3e039f7c03 Add code comments about why variable-time is fine for public inputs 2026-04-08 07:54:27 +02:00
Frank Denis ad53cae4c3 ML-KEM: wipe ephemeral seeds and harden invalid-pk test 2026-04-08 00:55:41 +02:00
Frank Denis f54f20abbf sha3: make post-final misuse safe and deterministic 2026-04-08 00:16:01 +02:00
Frank Denis fd52fd61a2 C++ compat 2026-04-05 21:59:25 +02:00
Frank Denis a728a02c51 Revert "local-dynamic is enough"
This reverts commit 462e9a648b.
2026-04-05 21:27:01 +02:00
Frank Denis 9f181dfc25 Remove ctype usage 2026-04-05 21:26:55 +02:00
Frank Denis 1573e29bf3 Refactor IPv6 zone ID parsing and reject malformed zone identifiers 2026-04-05 21:26:49 +02:00
Frank Denis 6b726ca29c gcc on FreeBSD can produce bogus code for isspace 2026-04-05 21:26:41 +02:00