Tor  0.4.7.0-alpha-dev
x25519_sizes.h
Go to the documentation of this file.
1 /* Copyright (c) 2001, Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file x25519_sizes.h
9 
10  * \brief Definitions for sizes of x25519 keys and elements.
11  *
12  * Tor uses these definitions throughout its codebase, even in parts that
13  * don't actually do any x25519 calculations.
14  **/
15 
16 #ifndef TOR_X25519_SIZES_H
17 #define TOR_X25519_SIZES_H
18 
19 /** Length of a curve25519 public key when encoded. */
20 #define CURVE25519_PUBKEY_LEN 32
21 /** Length of a curve25519 secret key when encoded. */
22 #define CURVE25519_SECKEY_LEN 32
23 /** Length of the result of a curve25519 handshake. */
24 #define CURVE25519_OUTPUT_LEN 32
25 
26 /** Length of an Ed25519 public key */
27 #define ED25519_PUBKEY_LEN 32
28 /** Length of an Ed25519 secret key */
29 #define ED25519_SECKEY_LEN 64
30 /** Length of the seed that is ordinarily expanded to an Ed25519 secret
31  * key. */
32 #define ED25519_SECKEY_SEED_LEN 32
33 /** Length of an Ed25519 signature. */
34 #define ED25519_SIG_LEN 64
35 
36 /** Length of a Curve25519 key when encoded in base 64, with padding. */
37 #define CURVE25519_BASE64_PADDED_LEN 44
38 
39 /** Length of a Curve25519 key when encoded in base 64, without padding. */
40 #define CURVE25519_BASE64_LEN 43
41 
42 /** Length of a Ed25519 key when encoded in base 64, without padding. */
43 #define ED25519_BASE64_LEN 43
44 /** Length of a Ed25519 signature when encoded in base 64, without padding. */
45 #define ED25519_SIG_BASE64_LEN 86
46 
47 #endif /* !defined(TOR_X25519_SIZES_H) */