DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
ssh_poly1305.h
Go to the documentation of this file.
1// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file ssh_poly1305.h
6 * @brief Poly1305 one-time authenticator (D. J. Bernstein; RFC 8439 Section 2.5).
7 *
8 * A one-time MAC over a message under a 32-byte key (r || s). Used by the
9 * chacha20-poly1305@openssh.com cipher, where the key is the first 32 bytes of the ChaCha20
10 * block-0 keystream for the packet. 130-bit modular arithmetic in 5 x 26-bit limbs (poly1305-donna
11 * layout). Pure, no heap; the caller must use each key exactly once.
12 *
13 * @author Douglas Quigg (dstroy0)
14 * @date 2026
15 */
16
17#ifndef DETERMINISTICESPASYNCWEBSERVER_SSH_POLY1305_H
18#define DETERMINISTICESPASYNCWEBSERVER_SSH_POLY1305_H
19
20#include <stddef.h>
21#include <stdint.h>
22
23#define SSH_POLY1305_KEY_LEN 32
24#define SSH_POLY1305_TAG_LEN 16
25
26/** @brief Compute the 16-byte Poly1305 tag over @p msg under the 32-byte one-time @p key. */
27void ssh_poly1305(uint8_t tag[SSH_POLY1305_TAG_LEN], const uint8_t *msg, size_t len,
28 const uint8_t key[SSH_POLY1305_KEY_LEN]);
29
30#endif // DETERMINISTICESPASYNCWEBSERVER_SSH_POLY1305_H
#define SSH_POLY1305_TAG_LEN
#define SSH_POLY1305_KEY_LEN
void ssh_poly1305(uint8_t tag[SSH_POLY1305_TAG_LEN], const uint8_t *msg, size_t len, const uint8_t key[SSH_POLY1305_KEY_LEN])
Compute the 16-byte Poly1305 tag over msg under the 32-byte one-time key.