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

Go to the source code of this file.

Functions

SHARKSSL_API int SharkSslPSAHash_compute (U8 *digest, U16 digestSize, U16 *digestLen, const U8 *data, U32 dataLen, psa_algorithm_t algorithm)
 One-shot SHA3-224/256/384/512 or fixed SHAKE256-512 through PSA. More...
 

Detailed Description

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

Function Documentation

◆ SharkSslPSAHash_compute()

int SharkSslPSAHash_compute ( U8 *  digest,
U16  digestSize,
U16 *  digestLen,
const U8 *  data,
U32  dataLen,
psa_algorithm_t  algorithm 
)

One-shot SHA3-224/256/384/512 or fixed SHAKE256-512 through PSA.

After output arguments pass validation, any later failure clears digestSize bytes.

Generic variable-length XOF is deliberately excluded. Returns zero on success; clears digest and returns -1 on failure.

SHAKE256_512 produces a fixed 64-byte result here.

Parameters
digestU8 *; required output buffer.
digestSizeU16; output capacity in bytes, at least the selected digest size.
digestLenU16 *; required result byte count; set to zero before validation.
dataconst U8 *; input bytes, or NULL with dataLen=0.
dataLenU32; input byte count.
algorithmpsa_algorithm_t; PSA_ALG_SHA3_224, PSA_ALG_SHA3_256, PSA_ALG_SHA3_384, PSA_ALG_SHA3_512, or PSA_ALG_SHAKE256_512.
Returns
int: 0 on success; -1 for invalid arguments, unsupported algorithms/policies, or provider failure.