# `./fio-stl/152 sha2z hkdf.h`

5 public symbols.

### Macros

#### `FIO_HKDF_SHA256_HASH_LEN`

```c
#define FIO_HKDF_SHA256_HASH_LEN 32
```

SHA-256 hash length (32 bytes).

_Symbol type:_ `macro`

#### `FIO_HKDF_SHA384_HASH_LEN`

```c
#define FIO_HKDF_SHA384_HASH_LEN 48
```

SHA-384 hash length (48 bytes).

_Symbol type:_ `macro`

### Functions

#### `fio_hkdf_extract`

```c
void fio_hkdf_extract(void *restrict prk, const void *restrict salt, size_t salt_len, const void *restrict ikm, size_t ikm_len, int use_sha384)
```

HKDF-Extract: PRK = HMAC-Hash(salt, IKM)

Extracts a pseudorandom key (PRK) from input keying material (IKM).

**Parameters:**
- `prk` - Output buffer (32 bytes for SHA-256, 48 for SHA-384)
- `salt` - Optional salt (if NULL, uses zeros of hash length)
- `salt_len` - Salt length in bytes
- `ikm` - Input keying material
- `ikm_len` - IKM length in bytes
- `use_sha384` - If non-zero, use SHA-384; otherwise SHA-256

_Symbol type:_ `function`

#### `fio_hkdf_expand`

```c
void fio_hkdf_expand(void *restrict okm, size_t okm_len, const void *restrict prk, size_t prk_len, const void *restrict info, size_t info_len, int use_sha384)
```

HKDF-Expand: OKM = HKDF-Expand(PRK, info, L)

Expands a pseudorandom key (PRK) into output keying material (OKM).

**Parameters:**
- `okm` - Output keying material buffer
- `okm_len` - Desired output length (max 255 * hash_len)
- `prk` - Pseudorandom key from Extract (32 or 48 bytes)
- `prk_len` - PRK length (32 for SHA-256, 48 for SHA-384)
- `info` - Optional context/application info
- `info_len` - Info length in bytes
- `use_sha384` - If non-zero, use SHA-384; otherwise SHA-256

_Symbol type:_ `function`

#### `fio_hkdf`

```c
void fio_hkdf(void *restrict okm, size_t okm_len, const void *restrict salt, size_t salt_len, const void *restrict ikm, size_t ikm_len, const void *restrict info, size_t info_len, int use_sha384)
```

Combined HKDF (Extract + Expand) - RFC 5869 Section 2.

Derives keying material from input keying material using HKDF.

**Parameters:**
- `okm` - Output keying material buffer
- `okm_len` - Desired output length (max 255 * hash_len)
- `salt` - Optional salt (if NULL, uses zeros of hash length)
- `salt_len` - Salt length in bytes
- `ikm` - Input keying material
- `ikm_len` - IKM length in bytes
- `info` - Optional context/application info
- `info_len` - Info length in bytes
- `use_sha384` - If non-zero, use SHA-384; otherwise SHA-256

_Symbol type:_ `function`

-----------------------------------------------------
