|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Poly1305 one-time authenticator (D. J. Bernstein; RFC 8439 Section 2.5). More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | PC_POLY1305_KEY_LEN 32 |
| #define | PC_POLY1305_TAG_LEN 16 |
Functions | |
| void | pc_poly1305 (uint8_t tag[PC_POLY1305_TAG_LEN], const uint8_t *msg, size_t len, const uint8_t key[PC_POLY1305_KEY_LEN]) |
Compute the 16-byte Poly1305 tag over msg under the 32-byte one-time key. | |
Poly1305 one-time authenticator (D. J. Bernstein; RFC 8439 Section 2.5).
A one-time MAC over a message under a 32-byte key (r || s). Used by the chach.nosp@m.a20-.nosp@m.poly1.nosp@m.305@.nosp@m.opens.nosp@m.sh.c.nosp@m.om cipher, where the key is the first 32 bytes of the ChaCha20 block-0 keystream for the packet. 130-bit modular arithmetic in 5 x 26-bit limbs (poly1305-donna layout). Pure, no heap; the caller must use each key exactly once.
Definition in file poly1305.h.
| #define PC_POLY1305_KEY_LEN 32 |
Definition at line 23 of file poly1305.h.
| #define PC_POLY1305_TAG_LEN 16 |
Definition at line 24 of file poly1305.h.
| void pc_poly1305 | ( | uint8_t | tag[PC_POLY1305_TAG_LEN], |
| const uint8_t * | msg, | ||
| size_t | len, | ||
| const uint8_t | key[PC_POLY1305_KEY_LEN] | ||
| ) |
Compute the 16-byte Poly1305 tag over msg under the 32-byte one-time key.
Definition at line 97 of file poly1305.cpp.
References pc_span::buf, pc_span_ok(), and SecureBorrow::span().
Referenced by pc_chachapoly_decrypt(), and pc_chachapoly_encrypt().