|
ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
|
chach.nosp@m.a20-.nosp@m.poly1.nosp@m.305@.nosp@m.opens.nosp@m.sh.c.nosp@m.om - implementation. See pc_chachapoly.h. More...
#include "crypto/aead/chachapoly.h"#include "crypto/cipher/chacha20.h"#include "crypto/crypto_opt.h"#include "crypto/crypto_scratch.h"#include "crypto/mac/poly1305.h"#include "server/mmgr/secure.h"#include <string.h>Go to the source code of this file.
Classes | |
| struct | PC_CRYPTO_HOT::ChachapolyWork |
Namespaces | |
| namespace | PC_CRYPTO_HOT |
Functions | |
| void | PC_CRYPTO_HOT::seq_nonce (uint32_t seqnr, uint8_t iv[8]) |
| uint32_t | pc_chachapoly_get_length (const uint8_t key[PC_CHACHAPOLY_KEY_LEN], uint32_t seqnr, const uint8_t enc_len[PC_CHACHAPOLY_AAD_LEN]) |
| Decrypt just the 4-byte length field to learn the packet length before reading the body. | |
| void | pc_chachapoly_encrypt (const uint8_t key[PC_CHACHAPOLY_KEY_LEN], uint32_t seqnr, uint8_t *dest, const uint8_t *src, uint32_t payload_len) |
| Encrypt+authenticate one packet. | |
| bool | pc_chachapoly_decrypt (const uint8_t key[PC_CHACHAPOLY_KEY_LEN], uint32_t seqnr, uint8_t *dest, const uint8_t *src, uint32_t payload_len) |
| Verify+decrypt one packet. | |
chach.nosp@m.a20-.nosp@m.poly1.nosp@m.305@.nosp@m.opens.nosp@m.sh.c.nosp@m.om - implementation. See pc_chachapoly.h.
Definition in file chachapoly.cpp.
| uint32_t pc_chachapoly_get_length | ( | const uint8_t | key[PC_CHACHAPOLY_KEY_LEN], |
| uint32_t | seqnr, | ||
| const uint8_t | enc_len[PC_CHACHAPOLY_AAD_LEN] | ||
| ) |
Decrypt just the 4-byte length field to learn the packet length before reading the body.
Definition at line 51 of file chachapoly.cpp.
References pc_span::buf, pc_chacha20_xor(), pc_span_ok(), and SecureBorrow::span().
| void pc_chachapoly_encrypt | ( | const uint8_t | key[PC_CHACHAPOLY_KEY_LEN], |
| uint32_t | seqnr, | ||
| uint8_t * | dest, | ||
| const uint8_t * | src, | ||
| uint32_t | payload_len | ||
| ) |
Encrypt+authenticate one packet.
| src | plaintext: 4-byte packet length (big-endian) || payload_len payload bytes. |
| dest | output: encrypted length (4) || encrypted payload (payload_len) || tag (16). May alias src. dest must hold 4 + payload_len + 16 bytes. |
Definition at line 67 of file chachapoly.cpp.
References pc_span::buf, pc_chacha20_xor(), pc_poly1305(), pc_span_ok(), and SecureBorrow::span().
Referenced by ssh_pkt_send().
| bool pc_chachapoly_decrypt | ( | const uint8_t | key[PC_CHACHAPOLY_KEY_LEN], |
| uint32_t | seqnr, | ||
| uint8_t * | dest, | ||
| const uint8_t * | src, | ||
| uint32_t | payload_len | ||
| ) |
Verify+decrypt one packet.
| src | ciphertext: encrypted length (4) || encrypted payload (payload_len) || tag (16). |
| dest | output: plaintext length (4) || plaintext payload (payload_len). May alias src. |
Definition at line 84 of file chachapoly.cpp.
References pc_span::buf, pc_chacha20_xor(), pc_poly1305(), pc_span_ok(), and SecureBorrow::span().