From c387f1340f645fe322010a80e44c9dbfeae1a7eb Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 1 Nov 2020 16:21:58 +0100 Subject: [PATCH] std/crypto: make Hkdf functions public --- lib/std/crypto/hkdf.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/crypto/hkdf.zig b/lib/std/crypto/hkdf.zig index c62583a932..b1c6f58acd 100644 --- 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};