OpenTTD Source 20241224-master-gee860a5c8e
network_crypto_internal.h File Reference

Internal bits to the crypto of the network handling. More...

#include "network_crypto.h"

Go to the source code of this file.

Data Structures

struct  X25519Key
 Container for a X25519 key that is automatically crypto-wiped when destructed. More...
 
struct  X25519PublicKey
 Container for a X25519 public key. More...
 
struct  X25519SecretKey
 Container for a X25519 secret key. More...
 
struct  X25519Nonce
 Container for a X25519 nonce that is automatically crypto-wiped when destructed. More...
 
class  X25519DerivedKeys
 Container for the keys that derived from the X25519 key exchange mechanism. More...
 
class  X25519AuthenticationHandler
 Base for handlers using a X25519 key exchange to perform authentication. More...
 
class  X25519KeyExchangeOnlyClientHandler
 Client side handler for using X25519 without actual authentication. More...
 
class  X25519KeyExchangeOnlyServerHandler
 Server side handler for using X25519 without actual authentication. More...
 
class  X25519PAKEClientHandler
 Client side handler for using X25519 with a password-authenticated key exchange. More...
 
class  X25519PAKEServerHandler
 Server side handler for using X25519 with a password-authenticated key exchange. More...
 
class  X25519AuthorizedKeyClientHandler
 Handler for clients using a X25519 key exchange to perform authentication via a set of authorized (public) keys of clients. More...
 
class  X25519AuthorizedKeyServerHandler
 Handler for servers using a X25519 key exchange to perform authentication via a set of authorized (public) keys of clients. More...
 
class  CombinedAuthenticationClientHandler
 Handler for combining a number of authentication handlers, where the failure of one of the handlers will retry with another handler. More...
 
class  CombinedAuthenticationServerHandler
 Handler for combining a number of authentication handlers, where the failure of one of the handlers will retry with another handler. More...
 

Typedefs

using X25519Mac = std::array< uint8_t, X25519_MAC_SIZE >
 Container for a X25519 message authentication code.
 
using X25519KeyExchangeMessage = std::array< uint8_t, X25519_KEY_EXCHANGE_MESSAGE_SIZE >
 Container for a X25519 key exchange message.
 

Enumerations

enum class  X25519KeyExchangeSide { CLIENT , SERVER }
 The side of the key exchange. More...
 

Variables

constexpr size_t X25519_KEY_SIZE = 32
 The number of bytes the public and secret keys are in X25519.
 
constexpr size_t X25519_NONCE_SIZE = 24
 The number of bytes the nonces are in X25519.
 
constexpr size_t X25519_MAC_SIZE = 16
 The number of bytes the message authentication codes are in X25519.
 
constexpr size_t X25519_KEY_EXCHANGE_MESSAGE_SIZE = 8
 The number of bytes the (random) payload of the authentication message has.
 

Detailed Description

Internal bits to the crypto of the network handling.

Definition in file network_crypto_internal.h.

Typedef Documentation

◆ X25519KeyExchangeMessage

Container for a X25519 key exchange message.

Definition at line 49 of file network_crypto_internal.h.

◆ X25519Mac

using X25519Mac = std::array<uint8_t, X25519_MAC_SIZE>

Container for a X25519 message authentication code.

Definition at line 46 of file network_crypto_internal.h.

Enumeration Type Documentation

◆ X25519KeyExchangeSide

enum class X25519KeyExchangeSide
strong

The side of the key exchange.

Enumerator
CLIENT 

We are the client.

SERVER 

We are the server.

Definition at line 52 of file network_crypto_internal.h.

Variable Documentation

◆ X25519_KEY_EXCHANGE_MESSAGE_SIZE

constexpr size_t X25519_KEY_EXCHANGE_MESSAGE_SIZE = 8
constexpr

The number of bytes the (random) payload of the authentication message has.

Definition at line 22 of file network_crypto_internal.h.

Referenced by X25519AuthenticationHandler::ReceiveResponse().

◆ X25519_KEY_SIZE

constexpr size_t X25519_KEY_SIZE = 32
constexpr

◆ X25519_MAC_SIZE

constexpr size_t X25519_MAC_SIZE = 16
constexpr

The number of bytes the message authentication codes are in X25519.

Definition at line 20 of file network_crypto_internal.h.

Referenced by X25519EncryptionHandler::MACSize(), and X25519AuthenticationHandler::ReceiveResponse().

◆ X25519_NONCE_SIZE

constexpr size_t X25519_NONCE_SIZE = 24
constexpr

The number of bytes the nonces are in X25519.

Definition at line 18 of file network_crypto_internal.h.

Referenced by X25519AuthenticationHandler::ReceiveRequest().