
|
My Project
|
Functions | |
| int | wc_Poly1305SetKey (Poly1305 *poly1305, const byte *key, word32 kySz) |
| This function sets the key for a Poly1305 context structure, initializing it for hashing. Note: A new key should be set after generating a message hash with wc_Poly1305Final to ensure security. More... | |
| int | wc_Poly1305Update (Poly1305 *poly1305, const byte *m, word32 bytes) |
| This function updates the message to hash with the Poly1305 structure. More... | |
| int | wc_Poly1305Final (Poly1305 *poly1305, byte *tag) |
| This function calculates the hash of the input messages and stores the result in mac. After this is called, the key should be reset. More... | |
| int | wc_Poly1305_MAC (Poly1305 *ctx, byte *additional, word32 addSz, byte *input, word32 sz, byte *tag, word32 tagSz) |
| Takes in an initialized Poly1305 struct that has a key loaded and creates a MAC (tag) using recent TLS AEAD padding scheme. More... | |
| int wc_Poly1305_MAC | ( | Poly1305 * | ctx, |
| byte * | additional, | ||
| word32 | addSz, | ||
| byte * | input, | ||
| word32 | sz, | ||
| byte * | tag, | ||
| word32 | tagSz | ||
| ) |
Takes in an initialized Poly1305 struct that has a key loaded and creates a MAC (tag) using recent TLS AEAD padding scheme.
| ctx | Initialized Poly1305 struct to use |
| additional | Additional data to use |
| addSz | Size of additional buffer |
| input | Input buffer to create tag from |
| sz | Size of input buffer |
| tag | Buffer to hold created tag |
| tagSz | Size of input tag buffer (must be at least WC_POLY1305_MAC_SZ(16)) |
Example
| int wc_Poly1305Final | ( | Poly1305 * | poly1305, |
| byte * | tag | ||
| ) |
This function calculates the hash of the input messages and stores the result in mac. After this is called, the key should be reset.
| ctx | pointer to a Poly1305 structure with which to generate the MAC |
| mac | pointer to the buffer in which to store the MAC. Should be POLY1305_DIGEST_SIZE (16 bytes) wide |
Example
| int wc_Poly1305SetKey | ( | Poly1305 * | poly1305, |
| const byte * | key, | ||
| word32 | kySz | ||
| ) |
This function sets the key for a Poly1305 context structure, initializing it for hashing. Note: A new key should be set after generating a message hash with wc_Poly1305Final to ensure security.
| ctx | pointer to a Poly1305 structure to initialize |
| key | pointer to the buffer containing the key to use for hashing |
| keySz | size of the key in the buffer. Should be 32 bytes |
Example
| int wc_Poly1305Update | ( | Poly1305 * | poly1305, |
| const byte * | m, | ||
| word32 | bytes | ||
| ) |
This function updates the message to hash with the Poly1305 structure.
| ctx | pointer to a Poly1305 structure for which to update the message to hash |
| m | pointer to the buffer containing the message which should be added to the hash |
| bytes | size of the message to hash |
Example