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

Detailed Description

POLY1305.

Data Structures

struct  SharkSslPoly1305Ctx
 POLY1305. More...
 

Typedefs

typedef struct SharkSslPoly1305Ctx SharkSslPoly1305Ctx
 POLY1305. More...
 

Functions

SHARKSSL_API void SharkSslPoly1305Ctx_constructor (SharkSslPoly1305Ctx *ctx, const U8 key[32])
 Initialize. More...
 
SHARKSSL_API void SharkSslPoly1305Ctx_append (SharkSslPoly1305Ctx *ctx, const U8 *in, U32 len)
 append More...
 
SHARKSSL_API void SharkSslPoly1305Ctx_finish (SharkSslPoly1305Ctx *ctx, U8 digest[SHARKSSL_POLY1305_HASH_LEN])
 finish More...
 
SHARKSSL_API int sharkssl_poly1305 (const U8 *data, U32 len, U8 *digest, const U8 key[32])
 poly1305 More...
 

Typedef Documentation

◆ SharkSslPoly1305Ctx

POLY1305.

Function Documentation

◆ sharkssl_poly1305()

int sharkssl_poly1305 ( const U8 *  data,
U32  len,
U8 *  digest,
const U8  key[32] 
)

poly1305

Parameters
dataconst U8 *; required message buffer.
lenU32; message length in bytes; the native one-shot API asserts that it is nonzero.
digestU8 *; required output buffer of at least 16 bytes.
keyconst U8[32]; required one-time Poly1305 key. Do not reuse it for a different message.
Returns
int: 0 on success; -1 when the native heap-based build cannot allocate its temporary context.

◆ SharkSslPoly1305Ctx_append()

void SharkSslPoly1305Ctx_append ( SharkSslPoly1305Ctx *  ctx,
const U8 *  in,
U32  len 
)

append

Parameters
ctxSharkSslPoly1305Ctx *; required initialized context, updated in place.
inconst U8 *; message bytes, required when len is nonzero.
lenU32; input length in bytes.

◆ SharkSslPoly1305Ctx_constructor()

SHARKSSL_API void SharkSslPoly1305Ctx_constructor ( SharkSslPoly1305Ctx *  ctx,
const U8  key[32] 
)

Initialize.

Parameters
ctxUninitialized data of size sizeof(SharkSslPoly1305Ctx).
key16-byte key + 16-byte nonce

◆ SharkSslPoly1305Ctx_finish()

void SharkSslPoly1305Ctx_finish ( SharkSslPoly1305Ctx *  ctx,
U8  digest[SHARKSSL_POLY1305_HASH_LEN] 
)

finish

Parameters
ctxSharkSslPoly1305Ctx *; required active context. Finalizes this message; clear the context after use.
digestU8[16]; required caller-owned output tag.