SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SharkSslPSAConsumerSP800108.h File Reference
#include "SharkSSL.h"

Go to the source code of this file.

Functions

SHARKSSL_API int SharkSslPSASP800108_derive (U8 *output, U16 outputLen, psa_key_id_t key, psa_algorithm_t algorithm, const U8 *label, U16 labelLen, const U8 *context, U16 contextLen)
 Derive exactly outputLen bytes with SP800-108 counter HMAC or CMAC. More...
 

Detailed Description

See Choose a SharkSSL API for build scope and the owning API layer.

Function Documentation

◆ SharkSslPSASP800108_derive()

int SharkSslPSASP800108_derive ( U8 *  output,
U16  outputLen,
psa_key_id_t  key,
psa_algorithm_t  algorithm,
const U8 *  label,
U16  labelLen,
const U8 *  context,
U16  contextLen 
)

Derive exactly outputLen bytes with SP800-108 counter HMAC or CMAC.

Returns -1 when the provider headers do not declare the required SP 800-108 facilities; enabling the adapter does not supply provider support.

The caller owns a PSA key authorized for DERIVE and the selected algorithm. The label cannot contain NUL. The requested length fixes the KDF's L value. Returns zero on success; clears output and returns -1 on failure.

Parameters
outputU8 *; required output buffer; cleared on failure when its supplied length is nonzero.
outputLenU16; positive requested output length in bytes.
keypsa_key_id_t; borrowed non-null secret handle with the provider policy required for this derivation.
algorithmpsa_algorithm_t; a declared and supported SP 800-108 counter-mode HMAC or CMAC algorithm.
labelconst U8 *; label bytes without embedded zero bytes; NULL is allowed with labelLen=0.
labelLenU16; label length in bytes.
contextconst U8 *; context bytes; NULL is allowed with contextLen=0.
contextLenU16; context length in bytes.
Returns
int: 0 on success; -1 for invalid arguments, unsupported algorithms/policies, or provider failure.