Jeroen van Rijn
655fab7227
Add core/hyperthread count for Windows and Linux ( #5216 )
...
Add core/hyperthread count to `core:sys/info` for Windows and Linux.
TODO: Linux RISCV, Linux ARM, Darwin, and the BSDs.
2025-05-25 19:43:10 +02:00
Yawning Angel
2f301e46dc
core/crypto: Switch to using ensure
2025-03-23 19:14:33 +09:00
Yawning Angel
93951ac72a
core/crypto/sha2: Clean up the portable code slightly
2025-03-23 19:14:33 +09:00
Yawning Angel
982ab11aa1
core/crypto/sha2: Use hardware SHA224/256 when available (AMD64)
2025-03-23 19:14:33 +09:00
Yawning Angel
bb395aeb41
core/crypto: Add rodata annotations (NFC)
2025-03-23 19:14:33 +09:00
Laytan Laats
288312a812
core: improve package doc comments for the documentation generator
2024-09-03 19:59:04 +02:00
Yawning Angel
7a8b1669b0
core/crypto: Expose the block sizes for every hash algorithm
...
While I just went and made this private, this information is required
for keying HMAC.
2024-02-07 00:37:18 +09:00
Yawning Angel
899fab64d9
core/crypto: Documentation cleanups
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
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
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
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
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
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
14a46c6d5e
core/crypto/sha2: odinfmt (NFC)
2023-11-17 16:53:29 +09: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
zhibog
0e91e63043
Fix issue 1761. Added the test vector to the core and vendor tests
2022-05-04 22:13:50 +02:00
gingerBill
1bf8328606
Strip unneeded semicolons
2022-01-25 16:40:25 +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
zhibog
c24454ae70
Removed context switching system from the crypto library to simplify the code
2021-11-09 16:50:13 +01: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
77be7144c3
Add crypto library. Additional information is included in the README.md
2021-10-14 22:20:55 +02:00