ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
poly1305.cpp File Reference

Poly1305 (RFC 8439) - implementation. See pc_poly1305.h. More...

#include "crypto/mac/poly1305.h"
#include "crypto/crypto_opt.h"
#include "server/mmgr/secure.h"
#include <string.h>

Go to the source code of this file.

Classes

struct  PC_CRYPTO_HOT::Poly1305Work
 

Namespaces

namespace  PC_CRYPTO_HOT
 

Functions

uint32_t PC_CRYPTO_HOT::rd_le32 (const uint8_t *p)
 
void PC_CRYPTO_HOT::wr_le32 (uint8_t *p, uint32_t v)
 
void PC_CRYPTO_HOT::poly_block (uint32_t h[5], const uint32_t r[5], const uint32_t sr[5], const uint8_t blk[16], uint32_t hibit)
 
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.
 

Detailed Description

Poly1305 (RFC 8439) - implementation. See pc_poly1305.h.

poly1305-donna 32-bit: the accumulator h and key part r are held as five 26-bit limbs; each 16-byte block adds the message limb (with the 2^128 high bit), multiplies by r, and reduces modulo 2^130 - 5. The final value is fully reduced, conditionally has p subtracted in constant time, and s is added modulo 2^128.

Definition in file poly1305.cpp.

Function Documentation

◆ pc_poly1305()

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().