Commit Graph

42 Commits

Author SHA1 Message Date
gingerBill
eb261f5b28 Merge branch 'master' into new-sys-unix 2023-10-31 12:16:25 +00:00
Damian Tarnawski
49da19e013 Replace Math.random with crypto.getRandomValues for _system_number 2023-10-27 12:06:35 +02:00
flysand7
4d65b1ab9c Implement new sys/unix package 2023-10-27 10:51:21 +11:00
Damian Tarnawski
11a2b2a942 Add system_random and random_bytes for js target 2023-10-27 00:05:38 +02:00
gingerBill
4c22982732 Rename files to not start with _ 2023-09-26 13:15:21 +01:00
gingerBill
9ee4b76cd9 Just make the io.Reader etc aliases 2023-06-08 16:38:57 +01:00
gingerBill
3f6775e29b Update to new io interface 2023-06-08 16:35:24 +01:00
Yawning Angel
7fc2081543 core/crypto: Add private attributes for internals
These constants and internal routines are not intended for use outside
the actual implementations themselves.
2023-04-08 10:15:00 +09:00
Yawning Angel
b8c2b0105b core/crypto: Disable optimization for the ct byte compare
Hedge against the possibility of a compiler getting clever enough to
optimize this pattern as well.
2023-04-08 10:11:04 +09:00
Yawning Angel
d72db2698b core/crypto/_fiat: Hedge against LLVM cleverness
Recent LLVM is getting smart to the point where the optimizer can change
a traditional constant-time conditional swap into a pointer swap.

Ensure that this does not happen by force-disabling optimization.
Additionally, disable inlining the relevant routines such that manual
inspection in optimized builds is still reasonably easy to do.
2023-04-08 09:57:47 +09:00
Lucas Perlind
c59ad24856 Make tests scripts error if a test fails
Additionally fixes tests that were found broken because
of this.
2023-04-03 16:49:14 +10:00
Colin Davidson
edd78ae129 cleanup of os/linux 2023-02-28 01:17:43 -08:00
cui fliter
dc8b7a0eb8 fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-08-05 20:10:20 +08:00
zhibog
0e91e63043 Fix issue 1761. Added the test vector to the core and vendor tests 2022-05-04 22:13:50 +02:00
Jeroen van Rijn
63331ef731 Revert "Merge pull request #1702 from Kelimion/filename_generation"
This reverts commit a40a53b104, reversing
changes made to 5422a3b17e.
2022-04-24 19:53:36 +02:00
Jeroen van Rijn
3d2856db31 Update tests to use new filename generation code. 2022-04-24 14:19:25 +02:00
Jeroen van Rijn
26ffec845b [crypto] Remove unused mem import for siphash. 2022-03-08 19:38:36 +01:00
zhibog
3b4199a669 Added rand_bytes for Windows in core:crypto 2022-03-02 21:22:56 +01:00
Sébastien Marie
5676c9e7eb initial OpenBSD support 2022-02-25 08:49:25 +00:00
zhibog
b6dc253d8b Add generic procedure for default SipHash 2-4 2022-02-22 20:02:34 +01:00
zhibog
e7be9493ba Added SipHash + tests and fixed remaining semicolons in vendor/botan 2022-02-22 19:56:07 +01:00
gingerBill
f5697dd7f2 Merge branch 'master' into odin-global-constants-as-enums 2022-02-15 15:47:24 +00:00
gingerBill
1bf8328606 Strip unneeded semicolons 2022-01-25 16:40:25 +00:00
gingerBill
3d7d347192 Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings 2022-01-20 19:56:05 +00:00
gingerBill
f0529535e0 ODIN_ENDIAN changed to an enum constant; ODIN_ENUM_STRING is the new string version of the old constant 2022-01-15 17:53:18 +00:00
gingerBill
29ebe0c3c9 Rename architecture 386 to i386 2022-01-15 17:40:00 +00:00
zhibog
42033ea808 Extended crypto API by variants that write the result into a destination buffer, instead of returning it 2021-12-31 13:16:11 +01:00
Yawning Angel
6bafa21bee crypto: Add rand_bytes
This adds `rand_bytes(dst: []byte)` which fills the destination buffer
with entropy from the cryptographic random number generator.  This takes
the "simple is best" approach and just directly returns the OS CSPRNG
output instead of doing anything fancy (a la OpenBSD's arc4random).
2021-11-17 14:00:00 +00:00
Yawning Angel
6c4c9aef61 core/crypto: Add chacha20poly1305
This package implements the chacha20poly1305 AEAD construct as specified
in RFC 8439.
2021-11-17 13:59:53 +00:00
Yawning Angel
7bed317636 core/crypto: Add chacha20
This package implements the ChaCha20 stream cipher as specified in
RFC 8439, and the somewhat non-standard XChaCha20 variant that supports
a 192-bit nonce.

While an IETF draft for XChaCha20 standardization exists,
implementations that pre-date the draft use a 64-bit counter, instead of
the IETF-style 32-bit one.  This implementation opts for the latter as
compatibility with libsodium is more important than compatibility with
an expired IETF draft.
2021-11-17 13:59:53 +00:00
Yawning Angel
4647081f49 core/crypto/poly1305: Triple performance on amd64 with -o:speed 2021-11-17 13:59:53 +00:00
Yawning Angel
64db286582 core/crypto: Add poly1305
This package implements the Poly1305 MAC algorithm as specified in RFC
8439, using routines taked from fiat-crypto and poly1305-donna.
2021-11-17 13:59:53 +00:00
Yawning Angel
1a7a6a9116 core/crypto: Add x25519
This package implements the X25519 key agreement scheme as specified in
RFC 7748, using routines taken from fiat-crypto and Monocypher.
2021-11-17 13:59:53 +00:00
Yawning Angel
d1e76ee4f2 core/crypto: Add constant-time memory comparison routines
Using a constant-time comparison is required when comparing things like
MACs, password digests, and etc to avoid exposing sensitive data via
trivial timing attacks.

These routines could also live under core:mem, but they are somewhat
specialized, and are likely only useful for cryptographic applications.
2021-11-17 13:59:53 +00:00
zhibog
c24454ae70 Removed context switching system from the crypto library to simplify the code 2021-11-09 16:50:13 +01:00
zhibog
483afe462b Fix order of operations to make it correct and work with -o:speed flaf 2021-11-07 18:53:30 +01:00
zhibog
7fa05238b8 Added note due address thread safety 2021-10-16 19:37:23 +02:00
zhibog
dd7449b8b5 Fixed some typos in proc names 2021-10-16 19:20:43 +02:00
zhibog
b7a0627d09 Remove the read_entire_file from the crypto utils and now use the one within core:os 2021-10-16 18:46:18 +02:00
zhibog
f48ee00c2f Improved API. hash_file procs now just take a file handle instead of a path 2021-10-15 20:29:25 +02:00
zhibog
ced0ea515c Added note for the botan.dll to README.md 2021-10-14 23:08:21 +02:00
zhibog
77be7144c3 Add crypto library. Additional information is included in the README.md 2021-10-14 22:20:55 +02:00