21 Commits

Author SHA1 Message Date
Andrew Kelley
d29871977f remove redundant license headers from zig standard library
We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.

Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
2021-08-24 12:25:09 -07:00
Veikka Tuominen
fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
Frank Denis
10f2d62789
std/crypto: use finer-grained error sets in function signatures (#8558)
std/crypto: use finer-grained error sets in function signatures

Returning the `crypto.Error` error set for all crypto operations
was very convenient to ensure that errors were used consistently,
and to avoid having multiple error names for the same thing.

The flipside is that callers were forced to always handle all
possible errors, even those that could never be returned by a
function.

This PR makes all functions return union sets of the actual errors
they can return.

The error sets themselves are all limited to a single error.

Larger sets are useful for platform-specific APIs, but we don't have
any of these in `std/crypto`, and I couldn't find any meaningful way
to build larger sets.
2021-04-20 19:57:27 +02:00
Frank Denis
6d9b3e7b19 pbkdf2: use std.math.divCeil() 2021-03-17 10:11:47 +01:00
Frank Denis
f609c4ddb3 crypto/pbkdf2: use snake_case for variables like everywhere else 2021-03-16 19:08:38 +01:00
Frank Denis
d1b1e542a0 crypto/pbkdf2: simplify the check for the max number of iterations 2021-03-16 18:55:58 +01:00
Frank Denis
b98d7747fa Use a unified error set for std/crypto/*
This ensures that errors are used consistently across all operations.
2021-03-14 20:51:31 +01:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Rocknest
c35703825f Add an error set 2020-09-16 01:58:48 +03:00
Rocknest
988fc6f9d1 flip condition 2020-09-14 02:27:09 +03:00
Rocknest
73863cf72b fix build 2020-09-13 23:59:36 +03:00
Rocknest
b6385870d0 Convert asserts to errors, make sure nothing overflows 2020-09-13 22:39:54 +03:00
Rob Napier
85366771ea pbkdf2 offset into dk should be usize, not u64. 2020-09-13 12:36:32 -04:00
Rob Napier
2f9c9662ba Use comptime to expose public method to doc system 2020-09-13 11:17:58 -04:00
Rob Napier
8a1a40276f Extract kdf.zig to provide namespace documentation 2020-09-13 11:08:06 -04:00
Rob Napier
257c5b5348 Explicitly reference std.crypto.kdf in test case 2020-09-13 10:50:46 -04:00
Rob Napier
0f85b85acb Improve doc text 2020-09-13 09:59:36 -04:00
Rob Napier
17156e1775 pbkdf2 "very large dklen test" should just check for crashes 2020-09-12 18:33:53 -04:00
Rob Napier
3f450b7e93 Replace Hash function with Prf. Correct offset bit-width. 2020-09-12 18:17:04 -04:00
Rob Napier
37db93e426 Review comments from pbkdf2.zig
Move block definitions inside while loop.
Use usize for offset. (This still crashes on overflow)
Remove unneeded slice syntax.
Add slow test for Very large dkLen
2020-09-12 15:03:42 -04:00
Rob Napier
c2b02d01d5 Add crypto.kdf.pbkdf2 2020-09-11 17:10:27 -04:00