TrustCore SDK NanoCrypto API reference  version 7.0
poly1305.h File Reference

Header file for the NanoCrypto Poly1305 APIs. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS Poly1305_completeDigest (MOC_HASH(hwAccelDescr hwAccelCtx) ubyte mac[16], const ubyte *m, ubyte4 bytes, const ubyte key[32])
 One shot API that will compute a poly1305 mac context free. More...
 
MOC_EXTERN MSTATUS Poly1305Final (MOC_HASH(hwAccelDescr hwAccelCtx) Poly1305Ctx *ctx, ubyte mac[16])
 Finalizes a Poly1305Ctx and computes the resulting mac. More...
 
MOC_EXTERN MSTATUS Poly1305Init (MOC_HASH(hwAccelDescr hwAccelCtx) Poly1305Ctx *ctx, const ubyte key[32])
 Initializes a Poly1305Ctx with a 32 byte (256 bit) key. More...
 
MOC_EXTERN MSTATUS Poly1305Update (MOC_HASH(hwAccelDescr hwAccelCtx) Poly1305Ctx *ctx, const ubyte *m, ubyte4 bytes)
 Updates a Poly1305Ctx with message data. More...
 

Detailed Description

This file contains the NanoCrypto Poly1305 API methods.

To enable this file's methods define the following flag:

  • __ENABLE_MOCANA_POLY1305__

poly1305.h

Function Documentation

◆ Poly1305_completeDigest()

MOC_EXTERN MSTATUS Poly1305_completeDigest ( MOC_HASH(hwAccelDescr hwAccelCtx) ubyte  mac[16],
const ubyte *  m,
ubyte4  bytes,
const ubyte  key[32] 
)

One shot API that will compute a poly1305 mac context free.

To enable this file's methods define the following flag:

  • __ENABLE_MOCANA_POLY1305__
Parameters
macA 16 element byte array that will hold the resulting mac.
mA pointer to the entire input message.
bytesThe number of bytes in the input message.
keyThe 32 byte key consisting of the 16 byte r followed by the 16 byte s.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

poly1305.h

◆ Poly1305Final()

MOC_EXTERN MSTATUS Poly1305Final ( MOC_HASH(hwAccelDescr hwAccelCtx) Poly1305Ctx *  ctx,
ubyte  mac[16] 
)

Finalizes a Poly1305Ctx and writes the resulting 16 byte message authentication code (mac) to a buffer.

To enable this file's methods define the following flag:

  • __ENABLE_MOCANA_POLY1305__
Parameters
ctxPointer to a Poly1305Ctx context previously initialized and updated.
macA 16 element byte array that will hold the resulting mac.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

poly1305.h

◆ Poly1305Init()

MOC_EXTERN MSTATUS Poly1305Init ( MOC_HASH(hwAccelDescr hwAccelCtx) Poly1305Ctx *  ctx,
const ubyte  key[32] 
)

Initializes a Poly1305Ctx with a 32 byte (256 bit) key consisting of a 16 byte r followed by a 16 byte s.

To enable this file's methods define the following flag:

  • __ENABLE_MOCANA_POLY1305__
Parameters
ctxA pointer to the context to be initialized.
keyThe 32 byte key consisting of the 16 byte r followed by the 16 byte s.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

poly1305.h

◆ Poly1305Update()

MOC_EXTERN MSTATUS Poly1305Update ( MOC_HASH(hwAccelDescr hwAccelCtx) Poly1305Ctx *  ctx,
const ubyte *  m,
ubyte4  bytes 
)

Updates a Poly1305Ctx with message data. This may be the entire message, or Poly1305Update may be called multiple times each with a portion of the message.

To enable this file's methods define the following flag:

  • __ENABLE_MOCANA_POLY1305__
Parameters
ctxPointer to a Poly1305Ctx context previously initialized.
mA pointer to the message or portion of the message to be input.
bytesThe number of bytes in the message or portion of the message input.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

poly1305.h