Yawning Angel
87ab3f5dc8
tests/core/crypto: Use the tests/common boilerplate
2024-03-04 18:20:56 +09:00
Yawning Angel
b818ebc02f
core/crypto/kmac: Initial import
2024-03-04 17:50:45 +09:00
Yawning Angel
c04a53e453
core/crypto/tuplehash: Initial import
2024-03-04 17:50:43 +09:00
Yawning Angel
15287a771f
core/crypto/shake: Support cSHAKE
2024-03-04 17:50:24 +09:00
Yawning Angel
550e798c1b
core/crypto/hkdf: Initial import
2024-03-04 14:51:38 +09:00
Yawning Angel
290168f862
core/crypto/pbkdf2: Initial import
2024-03-04 14:51:38 +09:00
Yawning Angel
44758f2a60
core/crypto: Stop using context.temp_allocator
...
The max digest size for the foreseeable future will be 512 bits, and the
max block size is currently 1152 bits (SHA3-224). If people add more
exotic hash algorithms without bumping the constants when required,
tests will fail.
The stream buffer will currently be 576 bytes, which is "fine" to just
stick on the stack, and is a sensible multiple of the more common block
size of 64 bytes.
2024-02-07 02:33:53 +09:00
Yawning Angel
1cc639bc93
core/crypto/hmac: Initial import
2024-02-07 00:42:01 +09:00
Yawning Angel
2357293e05
core/crypto/hash: Make the low level interface allocator-less
...
Just (ab)using reflect to victory is probably fine.
2024-02-07 00:37:18 +09:00
Yawning Angel
bc160d2eb7
tests/core/crypto: Reorganize
...
All of our crypto is modern now unless exiled to the legacy sub-package,
so move the test cases for the currently un-unified algorithms into the
main test driver file, and rename the benchmark driver to reflect
reality.
2024-02-07 00:37:18 +09:00
Yawning Angel
b02b85d242
core/crypto/shake: SHAKE is an XOF, not a hash
2024-02-07 00:37:18 +09:00
Yawning Angel
1d151c4c92
tests/core/crypto: Cleanup/modernize a bit
2024-02-07 00:37:18 +09:00
Yawning Angel
00ab3beed9
core:crypto/hash: Add a generic higher level hash interface
...
There is a lot of code duplicated in convenience methods in each hash
implementation, and having a generic hash type makes implementing
higher-level constructs such as HMAC significantly easier down the road.
2024-02-07 00:37:18 +09:00
Yawning Angel
59950bcad6
core/crypto: Exile keccak, md5 and sha1 to legacy
...
In an perfect world these would just be removed, but the world is
imperfect, and people are forced to interact/interface with things
that are broken.
2023-11-17 19:32:11 +09:00
Yawning Angel
8af6da5de1
core/crypto/whirlpool: Remove, historical/exotic
2023-11-17 19:31:51 +09:00
Yawning Angel
0b86038482
core/crypto/tiger: Remove, historical/exotic
2023-11-17 19:31:51 +09:00
Yawning Angel
8d943f5902
core/crypto/streebog: Remove, exotic
2023-11-17 19:31:51 +09:00
Yawning Angel
3494a6dcd8
core/crypto/ripemd: Remove, historical/exotic
2023-11-17 19:31:51 +09:00
Yawning Angel
235fec23af
core/crypto/md4: Remove, badly broken
2023-11-17 19:31:51 +09:00
Yawning Angel
97b066f112
core/crypto/md2: Remove, badly broken
2023-11-17 19:31:51 +09:00
Yawning Angel
a99c0b3e4a
core/crypto/jh: Remove, use SHA-3
2023-11-17 19:31:51 +09:00
Yawning Angel
2a6fb3a387
core/crypto/haval: Remove, badly broken
2023-11-17 19:31:51 +09:00
Yawning Angel
65204f13a8
core/crypto/groestl: Remove, use SHA-3
2023-11-17 19:31:51 +09:00
Yawning Angel
8438d66e6b
core/crypto/gost: Remove, exotic
2023-11-17 19:31:51 +09:00
Yawning Angel
44c8da7bf2
core/crypto/blake: Remove, use BLAKE2b/BLAKE2s
2023-11-17 19:31:51 +09:00
Yawning Angel
41fdcfeecf
core/crypto/sha2: Add SHA-512/256
2023-11-17 19:31:51 +09:00
gingerBill
8b825b23b1
Add missing comma
2023-05-29 15:18:38 +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
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
6d7217f37a
[varint] Add LEB128 decoding + tests
...
Also make tests in general less spammy: Don't print [PASS] for each successful test, only report failures and progress.
2022-03-08 15:40:00 +01:00
Jeroen van Rijn
6d9f84ba03
[tests] Make test runners exit with errorlevel 1 if a test fails.
2022-03-03 15:16:16 +01:00
zhibog
e7be9493ba
Added SipHash + tests and fixed remaining semicolons in vendor/botan
2022-02-22 19:56:07 +01:00
gingerBill
6223f48c3f
Update tests
2022-01-20 20:08:24 +00: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
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
zhibog
c24454ae70
Removed context switching system from the crypto library to simplify the code
2021-11-09 16:50:13 +01:00
zhibog
8876328e4d
Move botan.dll to correct directory
2021-10-14 23:03:55 +02:00
zhibog
f4ff11a7ff
Added botan.dll for tests
2021-10-14 22:58:20 +02:00
zhibog
77be7144c3
Add crypto library. Additional information is included in the README.md
2021-10-14 22:20:55 +02:00