Commit Graph

9257 Commits

Author SHA1 Message Date
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 4587a55486 core/crypto/sm3: API cleanup
- sm3.Sm3_Context -> sm3.Context
2023-11-17 19:32:09 +09:00
Yawning Angel 7640fb0483 core/crypto/shake: API cleanup
- shake.Shake_Context -> shake.Context
2023-11-17 19:31:51 +09:00
Yawning Angel b8f9deb3d8 core/crypto/sha3: API cleanup
- sha3.Sha3_Context -> sha3.Context
2023-11-17 19:31:51 +09:00
Yawning Angel 92aad90c6b core/crypto/sha2: API cleanup
- sha2.Sha256_Context -> sha2.Context_256
- sha2.Sha512_Context -> sha2.Context_512
2023-11-17 19:31:51 +09:00
Yawning Angel 506adfb105 core/crypto/sha1: API cleanup
-sha1.Sha1_Context -> Context
2023-11-17 19:31:51 +09:00
Yawning Angel e819eebc63 core/crypto/md5: API cleanup
- md5.Md5_Context -> md5.Context
2023-11-17 19:31:51 +09:00
Yawning Angel 841e73fcd5 core/crypto/keccak: API cleanup
- keccak.Keccak_Context -> keccak.Context
2023-11-17 19:31:51 +09:00
Yawning Angel aa821991b8 core/crypto/blake2: API cleanup and bug fixes
- blake2s.Blake2s_Context -> blake2s.Context
- blake2b.Blake2b_Context -> blake2b.Context
- Fix the BLAKE2s low level API (context type was incorrect)
- Support the configurable output size
2023-11-17 19:31:51 +09:00
Yawning Angel b71afdc3ee core/crypto/sha2: Refactor update/final
This is largely modeled off the SM3 versions of these routines, since
the relevant parts of the code are the same between SHA-256 and SM3,
and the alterations required to support SHA-512 are relatively simple.

The prior versions of update and the transform would leak memory, and
doing things this way also reduces the context buffer sizes by 1 block.
2023-11-17 19:31:51 +09:00
Yawning Angel bc139ba6c6 core/crypto/util: Remove, no longer needed 2023-11-17 19:31:51 +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 32b27c690d vendor/botan/skein512: Remove, use SHA-3 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
Yawning Angel 70ba4b5321 core/crypto: Add more assertions to the low level API
Assertions here are "fine" and it matches what the code that has the
checks in init/update/final already does.
2023-11-17 19:31:51 +09:00
Yawning Angel 71da3ef925 core/crypto/sha2: Fix overflow for large amounts of hashed data 2023-11-17 19:31:51 +09:00
Yawning Angel 582bd760b7 core/crypto/shake: Add a TODO comment (NFC) 2023-11-17 19:31:51 +09:00
Yawning Angel e86bb3a795 core/crypto: Change hash asserts to panics
Assertions can be disabled, but at the point where cryptographic
anything is involved, a single branch has an infinitesimally small
performance impact.

The correct thing to do is to punch the caller in the face if they do
something that is blatantly incorrect, especially in a security critical
setting.
2023-11-17 19:31:51 +09:00
Yawning Angel e3a836f93c core/crypto/sha2: Fix hash_stream_224 and hash_stream_256 2023-11-17 19:31:51 +09:00
Yawning Angel 31b42a53fc core/crypto/siphash: Fix the low-level API
The `update` and `final` routines were written with the assumption that
update will only be called once, and that the underlying data does not
change between the calls.
2023-11-17 19:31:51 +09:00
Yawning Angel b71d3c739a core/crypto/sm3: Cleanups
- Use `encoding/endian`
- Use `math/bits`
- Add `@(private)` annotations to internals
2023-11-17 19:31:50 +09:00
Yawning Angel a162b51588 core/crypto/siphash: Cleanups
- Use `encoding/endian`
- Use `math/bits`
- Add `@(private)` annotations to internals
- Minor optimization
2023-11-17 16:53:29 +09:00
Yawning Angel 7c1119f217 core/crypto/_sha3: Cleanups
- Use `math/bits`
2023-11-17 16:53:29 +09:00
Yawning Angel b0397581db core/crypto/sha2: Cleanups
- Use `encoding/endian`
- Use `math/bits`
- Add `@(private)` annotations to internals
2023-11-17 16:53:29 +09:00
Yawning Angel c7dc1220b3 core/crypto/sha1: Cleanups
- Use `encoding/endian`
- Use `math/bits`
- Add `@(private)` annotations to internals
2023-11-17 16:53:29 +09:00
Yawning Angel d16acdc89c core/crypto/md5: Cleanups
- Use `encoding/endian`
- Use `math/bits`
- Add `@(private)` annotations to internals
2023-11-17 16:53:29 +09:00
Yawning Angel 1279ebe948 core/crypto/poly1305: Cleanups
- Use `encoding/endian`
2023-11-17 16:53:29 +09:00
Yawning Angel aa5a95a4d1 core/crypto/chacha20poly1305: Cleanups
- Use `encoding/endian`
2023-11-17 16:53:29 +09:00
Yawning Angel fa1cb28c8f core/crypto/chacha20: Cleanups
- Use `encoding/endian`
- Use `math/bits`
2023-11-17 16:53:29 +09:00
Yawning Angel 3902273d68 core/crypto/_blake2: Cleanups
- Use `encoding/endian`
- Add `@(private)` annotations to internals
- Add some descriptive comments in the unrolled compression functions
2023-11-17 16:53:29 +09:00
Yawning Angel 811132ccbd core/crypto/sm3: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel 391b3090c9 core/crypto/siphash: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel d50380709d core/crypto/sha3: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel 14a46c6d5e core/crypto/sha2: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel b4e3da84c5 core/crypto/sha1: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel 9d627e453a core/crypto/md5: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel d6e0e5d3f6 core/crypto/blake2: odinfmt (NFC) 2023-11-17 16:53:29 +09:00
Yawning Angel 12b370ddc1 repo: Add more test binaries to .gitignore 2023-11-17 16:53:29 +09:00
Jeroen van Rijn 8028033513 Merge pull request #2957 from laytan/no-crt-and-compile-assembly-on-darwin
-no-crt on darwin_arm64 and assembly compilation on darwin
2023-11-15 18:46:35 +01:00
Laytan Laats 6b9202dfbf -no-crt and assembly compilation on darwin 2023-11-15 18:06:27 +01:00