libssh: chacha20-poly1305-common.h Source File

libssh 0.11.1 The SSH library

Loading...
Searching...
No Matches
chacha20-poly1305-common.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2020 Red Hat, Inc.
5 *
6 * Author: Jakub Jelen <jjelen@redhat.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23/*
24 * chacha20-poly1305.h file
25 * This file includes definitions needed for Chacha20-poly1305 AEAD cipher
26 * using different crypto backends.
27 */
28
29#ifndef CHACHA20_POLY1305_H
30#define CHACHA20_POLY1305_H
31
32#define CHACHA20_BLOCKSIZE 64
33#define CHACHA20_KEYLEN 32
34
35#define POLY1305_TAGLEN 16
36/* size of the keys k1 and k2 as defined in specs */
37#define POLY1305_KEYLEN 32
38
39#ifdef _MSC_VER
40#pragma pack(push, 1)
41#endif
42struct ssh_packet_header {
43 uint32_t length;
44 uint8_t payload[];
45}
46#if defined(__GNUC__)
47__attribute__ ((packed))
48#endif
49#ifdef _MSC_VER
50#pragma pack(pop)
51#endif
52;
53
54#endif /* CHACHA20_POLY1305_H */