Commit Graph

19 Commits

Author SHA1 Message Date
Yawning Angel
e3504c94ad core/crypto: Get rid of set (only used by legacy) 2026-05-06 09:53:02 +09:00
Yawning Angel
0af538c70a core/crypto: Fix doc comment (No functional changes) 2026-04-20 15:16:46 +09:00
Jeroen van Rijn
27667ce36b iff -> if and only if (⟺) 2026-03-13 11:54:15 +01:00
Jeroen van Rijn
cde6dc1f20 Remove core:mem import from core:crypto. 2026-02-12 16:52:25 +01:00
Yawning Angel
5ce448a8d5 core/crypto: Start work on the NIST curves 2026-01-28 22:50:27 +09:00
Yawning Angel
6bbd060352 core/crypto/_subtle: Refactor out common helpers 2026-01-28 22:20:03 +09:00
Yawning Angel
e1ba69ea51 base/runtime: Add rand_bytes and HAS_RAND_BYTES
Having the OS/runtime provide a cryptographic entropy source is the
right thing to do, and we need it to initialize the default random
number generator.
2025-11-29 10:45:53 +09:00
Jeroen van Rijn
7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn
248b0fe9e1 More package lines 2025-10-09 16:11:33 +02:00
Yawning Angel
c9c0b9ea7b core/crypto: Fix/add some documentation (NFC) 2024-07-16 01:29:43 +09:00
Laytan Laats
2d8d0dd851 fix @(optimization_mode) usage in builtin collections 2024-07-08 21:07:53 +02:00
gingerBill
e41ad2bf16 to_random_generator -> random_generator 2024-06-15 16:24:01 +01:00
gingerBill
318d5e4a7e Add Reset mode 2024-06-15 15:17:23 +01:00
gingerBill
dc4ec8638c Add runtime.Random_Generator interface 2024-06-15 14:45:57 +01:00
Yawning Angel
a6eb64df6c core/crypto: Add a HAS_RAND_BYTES constant 2024-04-23 11:47:43 +09:00
Yawning Angel
b155fdf8c9 core/crypto: Add has_rand_bytes
This allows runtime detection as to if `rand_bytes` is supported or not,
and lets us enable the test-case on all of the supported targets.
2024-04-09 10:23:58 +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
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
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