Skip to documentation
SLOP

tiny.quic.crypto.initial

Reference tiny.quic crypto initial

Defined in crypto.

API (3)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

No direct callersNo direct callscryptoinitial
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallstest sourcelib.quic.src.crypto.test.test_RFC_9000_sectio...3 reject authenticated reserved bitstest sourcelib.quic.src.crypto.test.test_RFC_9001_Append...1 Initial secrets and packet keystest sourcelib.quic.src.crypto.test.test_RFC_9001_Append...2 client Initial packet protectiontest sourcelib.quic.src.crypto.test.test_RFC_9001_Append...3 server Initial packet protectiontest sourcelib.quic.src.crypto.test.test_RFC_9001_section_52 the draft salt yields a different c...+2 moreprivate sourcelib.quic.src.crypto.initialextractedcrypto.initialsecrets
Static calls · unresolved targets: 0 · external targets: 1.

Source: lib/quic/src/crypto/initial.zig

zig
const std = @import("std");const quic = @import("../root.zig");const Hkdf = std.crypto.kdf.hkdf.HkdfSha256;const Secret = quic.crypto.Secret;const tls = std.crypto.tls;/// The 20-byte Initial salt RFC 9001 section 5.2 fixes for QUIC version 1 serves a caller deriving/// Initial keys by hand so both endpoints use the same salt. This value acts as the salt of the/// extraction that turns a client's destination connection ID into the Initial secret, from which/// the client and server traffic secrets follow. A version other than 1 uses a different salt, so/// this value belongs to version 1 alone.pub const v1_salt = [_]u8{    0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17,    0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a,};pub const Secrets = struct {    client: Secret,    server: Secret,};fn extracted(dcid: []const u8) Secret {    return Hkdf.extract(&v1_salt, dcid);}pub fn secrets(dcid: []const u8) Secrets {    const initial_secret = extracted(dcid);    return .{        .client = tls.hkdfExpandLabel(            Hkdf,            initial_secret,            "client in",            "",            quic.crypto.secret_bytes,        ),        .server = tls.hkdfExpandLabel(            Hkdf,            initial_secret,            "server in",            "",            quic.crypto.secret_bytes,        ),    };}fn hex(comptime text: []const u8) [text.len / 2]u8 {    var result: [text.len / 2]u8 = undefined;    _ = std.fmt.hexToBytes(&result, text) catch unreachable;    return result;}test "RFC 9001 Appendix A.1 version 1 initial secret" {    const dcid = hex("8394c8f03e515708");    const expected = hex(        "7db5df06e7a69e432496adedb0085192" ++            "3595221596ae2ae9fb8115c1e9ed0a44",    );    try std.testing.expectEqual(expected, extracted(&dcid));}

Source: lib/quic/src/crypto/root.zig:18

zig
pub const initial = @import("initial.zig");

Complete caller list for crypto.initial.secrets

7 direct callers.

Audit

Definitions4
Public names4
Members2
Version26.7.0
Revisiondaab053ee433