SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration

Detailed Description

SHA1 cryptographic hash.

Data Structures

struct  SharkSslSha1Ctx
 SHA1. More...
 

Typedefs

typedef struct SharkSslSha1Ctx SharkSslSha1Ctx
 SHA1. More...
 

Functions

SHARKSSL_API int SharkSslSha1Ctx_constructor (SharkSslSha1Ctx *ctx)
 Initialize. More...
 
SHARKSSL_API int SharkSslSha1Ctx_append (SharkSslSha1Ctx *ctx, const U8 *data, U32 len)
 append More...
 
SHARKSSL_API int SharkSslSha1Ctx_finish (SharkSslSha1Ctx *ctx, U8 digest[SHARKSSL_SHA1_HASH_LEN])
 finish More...
 
SHARKSSL_API int sharkssl_sha1 (const U8 *, U32, U8 *)
 sha1 More...
 

Typedef Documentation

◆ SharkSslSha1Ctx

SHA1.

Function Documentation

◆ sharkssl_sha1()

int sharkssl_sha1 ( const U8 *  data,
U32  len,
U8 *  digest 
)

sha1

Parameters
dataconst U8 *; bytes to hash, borrowed for this call. May be NULL when len is zero.
lenU32; input length in bytes.
digestU8 *; required caller-owned output buffer of at least 20 bytes.
Returns
int: 0 on success; -1 on temporary allocation failure in a heap-based native build, or on argument/provider failure in the PSA consumer. Discard the digest on failure.

◆ SharkSslSha1Ctx_append()

int SharkSslSha1Ctx_append ( SharkSslSha1Ctx *  ctx,
const U8 *  data,
U32  len 
)

append

Parameters
ctxSharkSslSha1Ctx *; required initialized, unfinished context; updated in place.
dataconst U8 *; input bytes, borrowed for this call. Supply a valid buffer when len is nonzero.
lenU32; input length in bytes, including zero.
Returns
int: 0 on success. The native implementation returns 0 for valid inputs; the PSA consumer returns -1 for invalid state/arguments or a provider failure.

◆ SharkSslSha1Ctx_constructor()

int SharkSslSha1Ctx_constructor ( SharkSslSha1Ctx *  ctx)

Initialize.

Use caller-owned, correctly aligned context storage.

Parameters
ctxUninitialized data of size sizeof(SharkSslSha1Ctx).

Finish or abort an active PSA hash before reinitializing that storage.

Returns
int: 0 on success. The native implementation returns 0 for valid inputs; the PSA consumer returns -1 for invalid state/arguments or a provider failure.

◆ SharkSslSha1Ctx_finish()

int SharkSslSha1Ctx_finish ( SharkSslSha1Ctx *  ctx,
U8  digest[SHARKSSL_SHA1_HASH_LEN] 
)

finish

Parameters
ctxSharkSslSha1Ctx *; required initialized context; finalized by this call. Reinitialize before hashing another message.
digestU8 *; required caller-owned output buffer of at least 20 bytes.
Returns
int: 0 on success. The native implementation returns 0 for valid inputs; the PSA consumer returns -1 for invalid state/arguments or a provider failure.