commit c387f1340f645fe322010a80e44c9dbfeae1a7eb (tree)
parent 9ca9819488db580241a93ded7b93a054de2db8af
Author: Frank Denis <github@pureftpd.org>
Date: Sun, 1 Nov 2020 16:21:58 +0100
std/crypto: make Hkdf functions public
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/std/crypto/hkdf.zig b/lib/std/crypto/hkdf.zig
@@ -20,14 +20,14 @@ pub const HkdfSha512 = Hkdf(hmac.sha2.HmacSha512);
pub fn Hkdf(comptime Hmac: type) type {
return struct {
/// Return a master key from a salt and initial keying material.
- fn extract(salt: []const u8, ikm: []const u8) [Hmac.mac_length]u8 {
+ pub fn extract(salt: []const u8, ikm: []const u8) [Hmac.mac_length]u8 {
var prk: [Hmac.mac_length]u8 = undefined;
Hmac.create(&prk, ikm, salt);
return prk;
}
/// Derive a subkey from a master key `prk` and a subkey description `ctx`.
- fn expand(out: []u8, ctx: []const u8, prk: [Hmac.mac_length]u8) void {
+ pub fn expand(out: []u8, ctx: []const u8, prk: [Hmac.mac_length]u8) void {
assert(out.len < Hmac.mac_length * 255); // output size is too large for the Hkdf construction
var i: usize = 0;
var counter = [1]u8{1};