Commit Graph
1876 Commits
Author SHA1 Message Date
Frank Denis 61674c6c87 Use ANDROID_CPU_ARM64_FEATURE_AES for AES detection on Android/aarch64 2023-09-13 08:59:50 +02:00
Frank Denis a589d64b42 Handle SIGPROT, CHERI's in-address space security exception 2023-09-12 21:04:06 +02:00
Frank Denis b6bcb3dc22 Forgotten attribute pop 2023-09-12 16:03:13 +02:00
Frank Denis e2935b6943 aarch64: try harder when checking for the crypto extensions 2023-09-12 15:59:05 +02:00
Frank Denis 652c081535 Don't hardcode type sizes 2023-09-12 12:52:08 +02:00
Frank Denis dcf78d77be Inline 2023-09-12 12:38:52 +02:00
Frank Denis 6d5cf12fca define randombytes_set_implementation argument to be const (#1068) 2023-09-12 12:30:19 +02:00
martingd b335abd946 Error from argon2_hash() during verify propagated. (#1039) 2023-09-12 12:13:49 +02:00
Frank Denis ed9e3e18f1 Indent 2023-09-12 12:09:39 +02:00
Frank Denis 18727ac58f Nits 2023-09-12 12:08:23 +02:00
Frank Denis 2800307b05 Nits 2023-09-12 12:07:32 +02:00
Frank Denis 6e0c80f169 Remove unused variables 2023-09-11 15:05:43 +02:00
Frank Denis 709fb29e79 Visual Studio: define __ARM_NEON on Windows/ARM 2023-09-11 00:59:59 +02:00
Frank Denis 9a55460523 Define additional capabilities when using Visual Studio 2023-09-11 00:59:51 +02:00
Frank Denis 6c35bcaabf Downgrade ax_valgrind_check 2023-09-10 22:26:31 +02:00
Frank Denis 7793ba6bc4 Move sodium implementations out of their dedicated directory 2023-09-09 17:33:02 +02:00
Frank Denis 21223ba7a1 Add ge25519_clear_cofactor() 2023-09-09 13:25:09 +02:00
Frank Denis 5e4affe9d8 Support gcc-like and C11-like memory fences 2023-09-09 09:01:51 +02:00
Frank Denis e95d437f84 Add memory fences where supported 2023-09-09 09:01:44 +02:00
Frank Denis 3a6a6025cc Backport aarch64 support for aes256-gcm 2023-09-09 01:04:48 +02:00
Frank Denis 2a72d4501b Simplify how non-deterministic ed25519 nonces are computed 2023-09-08 23:37:55 +02:00
Frank Denis a77269a21b Regen 2023-09-08 22:03:03 +02:00
Scr3amer 375a01d722 Add missing undef in _mm_roti_epi64 definition for blake2b-ssse3 (#1306) 2023-09-02 22:16:26 +02:00
Scr3amer 4322f15012 Do not redefine _mm_roti_epi64 if xop target feature is enabled. (#1305)
Undefine compiler macro if present and XOP not enable to avoid preprocessor warnings due to macro redefinition
2023-09-02 15:26:00 +02:00
Scr3amer 52b90532f6 Define TLS as _Thread_local if the compiler supports C11 (#1304) 2023-09-01 23:47:12 +02:00
Frank Denis 6256e097c9 scrypt_nosse: Remove the 64-bit version of blkxor()
It broke strict aliasing.

Also remove ARCH_BITS that is not required any longer.

Fixes #1301
2023-08-31 23:27:46 +02:00
Frank Denis 9e42094343 scrypt_integerify_sse: be consistent with the no_sse version 2023-08-31 23:25:52 +02:00
Frank Denis 1913882616 scrypt_nosse: no need to use void * in integerify() 2023-08-31 23:25:47 +02:00
Frank Denis 4388ef37db Require/enable AVX for AES256-GCM 2023-08-05 09:39:11 +02:00
Frank Denis 4f099fc593 Add proper CET support (followup to #1290) (#1291) 2023-07-19 18:31:55 +02:00
Frank Denis f3bd149feb Revert "Build correctly with IBT and Shadow Stack (#1289)"
This reverts commit 5fe02c89a7.
2023-07-19 15:10:52 +02:00
Siddhesh Poyarekar 5fe02c89a7 Build correctly with IBT and Shadow Stack (#1289)
Add .gnu.property notes to indicate support for IBT and shadow stacks
when libsodium is built with it.  There's no stack switching code in
here, so this should not need any other codegen changes.
2023-07-18 17:56:45 +02:00
Frank Denis ebcc2a6636 pwhash: fill output buffer with junk prior to running the actual KDF
These functions are a little bit special, because unlike everything
else, they do dynamic memory allocations, and are more likely to fail.

Applications are expected to check the return code, and these functions
are tagged with ((warn_unused_result)) but applications may still
ignore these.

This is also an issue with JavaScript, when total memory hasn't been
properly configured.

To be safe, fill the buffer with non-deterministic bytes, that are
unlikely to ever verify later.
2023-02-16 18:22:19 +01:00
Frank Denis 4acf8befe0 Mention that mlock() failing is not a hard error for sodium_malloc() 2022-12-19 12:12:29 +01:00
Frank Denis a5ea347381 Sync the AESNI aes_gcm_decrypt_generic() impl with the ARM one 2022-12-11 23:48:30 +01:00
Frank Denis dab102d404 On stable, on failed decryption, fill buffer with 0x00
Not with 0xd0, to keep the previous behavior. NSec expicitly checked
for that value.
2022-12-11 21:07:42 +01:00
Frank Denis 1cfba584db Support memset_explicit() if available
NetBSD has explicit_memset(), but C23 decided to implement the
same thing but call it memset_explicit() instead. Go figure.
2022-11-21 15:29:25 +01:00
Frank Denis d0c73fcefc Backport the new AES-GCM implementation to -stable 2022-11-17 23:07:10 +01:00
Frank Denis 12023defc8 salsa20: initialize partial block
A compiler trying to be too smart could notice that we are shifting
ununitialized data (even though we then discard it), and apply
unwanted optimizations.
2022-11-16 13:43:43 +01:00
Frank Denis fd5cbe9e69 Indent 2022-10-21 17:54:59 +02:00
Frank Denis 69821eba93 Win32: SecureZeroMemory may not be available 2022-10-20 14:41:59 +02:00
Frank Denis 2a2fe56189 scalarmult(): don't use the output as a temporary buffer
So that application can use the same pointer for the public key
and the shared secret.
2022-10-11 14:04:50 +02:00
Steve Thomas d69a2342bc Clear decrypted block from stack (#1190) 2022-06-18 20:32:53 +02:00
Frank Denis 3f3d350387 sodium_compare(): cast operands to unsigned int
This matches the Zig implementation and
fixes #1184
2022-06-05 14:31:35 +02:00
Frank Denis fd4b6edc0f Simplify scrypt blkcpy()/blkxor() 2022-05-11 18:12:45 +02:00
Frank Denis 7389bf7f29 libtool update 2022-04-03 00:03:17 +02:00
Frank Denis 0e88616f87 edwards25519: faster recovery of the X coordinate 2022-02-15 14:13:36 +01:00
Jørgen P. TjernøandFrank Denis 100ccb452d Portability improvements (#1105)
* Move `raise` code to be behind an autoconf check

This moves the call to `raise` behind a `HAVE_RAISE` autoconf check,
in addition to `__wasm__`. This is intended to help porting to
other platforms that don't support `raise` (e.g. modern game consoles).

* Add autoconf check for `sysconf`

Only try to invoke `sysconf` if the target platform supports it, and
don't warn about unknown page size if `PAGE_SIZE` was defined. Add an
include for `sys/param.h` to increase likelihood of finding `PAGE_SIZE`.
This is intended to help porting to other platforms that don't support
`sysconf` (e.g. modern game consoles) that have a fixed hardware page
size.

* Don't try to use raise & sysconf in a WASI environment

Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
2021-10-09 18:39:02 +02:00
infinitydev 7d300e4c19 Fix build on z/OS using XLC (#1089)
Handle the Sun and the IBM compilers separately
2021-07-09 15:48:34 +02:00
Frank Denis 95673e5b51 Use assignement + case instead of memcpy() 2021-06-17 20:56:54 +02:00