Noise-C
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Macros
constants.h File Reference

Constants for algorithm identifiers, limit values, etc. More...

Go to the source code of this file.

Macros

#define NOISE_ACTION_COMPLETE   NOISE_ID('A', 5)
 The HandshakeState has flagged that the handshake is over and and that noise_handshake_split() has been called to begin data session communications. More...
 
#define NOISE_ACTION_FAILED   NOISE_ID('A', 3)
 The HandshakeState has flagged that the handshake has failed due to some kind of error. More...
 
#define NOISE_ACTION_NONE   0
 No action is required of the application yet because the handshake has not started. More...
 
#define NOISE_ACTION_READ_MESSAGE   NOISE_ID('A', 2)
 The HandshakeState expects the application to read the next message payload from the handshake. More...
 
#define NOISE_ACTION_SPLIT   NOISE_ID('A', 4)
 The HandshakeState has flagged that the handshake is over and that the application is expected to call noise_handshake_split() and begin data session communications. More...
 
#define NOISE_ACTION_WRITE_MESSAGE   NOISE_ID('A', 1)
 The HandshakeState expects the application to write the next message payload for the handshake. More...
 
#define NOISE_CIPHER_AESGCM   NOISE_ID('C', 2)
 Cipher identifier for "AESGCM". More...
 
#define NOISE_CIPHER_CATEGORY   NOISE_ID('C', 0)
 Category for cipher algorithms. More...
 
#define NOISE_CIPHER_CHACHAPOLY   NOISE_ID('C', 1)
 Cipher identifier for "ChaChaPoly". More...
 
#define NOISE_CIPHER_NONE   0
 Cipher identifier that indicates "no cipher". More...
 
#define NOISE_DH_CATEGORY   NOISE_ID('D', 0)
 Category for Diffie-Hellman algorithms. More...
 
#define NOISE_DH_CURVE25519   NOISE_ID('D', 1)
 Diffie-Hellman identifier for "25519". More...
 
#define NOISE_DH_CURVE448   NOISE_ID('D', 2)
 Diffie-Hellman identifier for "448". More...
 
#define NOISE_DH_NEWHOPE   NOISE_ID('D', 3)
 Diffie-Hellman identifier for "NewHope" (post-quantum, ephemeral key exchanges only). More...
 
#define NOISE_DH_NONE   0
 Diffie-Hellman identifier that indicates "no DH". More...
 
#define NOISE_ERROR_INVALID_FORMAT   NOISE_ID('E', 16)
 Invalid format for packet or key file. More...
 
#define NOISE_ERROR_INVALID_LENGTH   NOISE_ID('E', 10)
 Invalid length specified for a key, packet, etc. More...
 
#define NOISE_ERROR_INVALID_NONCE   NOISE_ID('E', 13)
 Invalid nonce value. More...
 
#define NOISE_ERROR_INVALID_PARAM   NOISE_ID('E', 11)
 Invalid parameter to function; e.g. a NULL value. More...
 
#define NOISE_ERROR_INVALID_PRIVATE_KEY   NOISE_ID('E', 14)
 Invalid private key value. More...
 
#define NOISE_ERROR_INVALID_PUBLIC_KEY   NOISE_ID('E', 15)
 Invalid public key value. More...
 
#define NOISE_ERROR_INVALID_SIGNATURE   NOISE_ID('E', 17)
 Invalid digital signature; does not verify. More...
 
#define NOISE_ERROR_INVALID_STATE   NOISE_ID('E', 12)
 Operation cannot be performed in the current state. More...
 
#define NOISE_ERROR_LOCAL_KEY_REQUIRED   NOISE_ID('E', 8)
 A local keypair is required for the selected protocol, but one was not supplied. More...
 
#define NOISE_ERROR_MAC_FAILURE   NOISE_ID('E', 4)
 MAC check failed on an incoming packet. More...
 
#define NOISE_ERROR_NO_MEMORY   NOISE_ID('E', 1)
 Insufficient memory to complete the operation. More...
 
#define NOISE_ERROR_NONE   0
 Success, no error. More...
 
#define NOISE_ERROR_NOT_APPLICABLE   NOISE_ID('E', 5)
 An option was supplied that was not applicable to the selected protocol. More...
 
#define NOISE_ERROR_PSK_REQUIRED   NOISE_ID('E', 9)
 A pre shared key is required for the selected protocol, but one was not supplied. More...
 
#define NOISE_ERROR_REMOTE_KEY_REQUIRED   NOISE_ID('E', 7)
 A remote static public key is required for the selected protocol, but one was not supplied. More...
 
#define NOISE_ERROR_SYSTEM   NOISE_ID('E', 6)
 System error, with more information in errno. More...
 
#define NOISE_ERROR_UNKNOWN_ID   NOISE_ID('E', 2)
 Algorithm identifier is unknown. More...
 
#define NOISE_ERROR_UNKNOWN_NAME   NOISE_ID('E', 3)
 Algorithm name is unknown. More...
 
#define NOISE_FINGERPRINT_BASIC   NOISE_ID('F', 1)
 Fingerprint format is the hexadecimal encoding of the first 16 bytes of the SHA256 hash of the public key. More...
 
#define NOISE_FINGERPRINT_FULL   NOISE_ID('F', 2)
 Fingerprint format is the hexadecimal encoding of the entire 32 bytes of the SHA256 hash of the public key. More...
 
#define NOISE_HASH_BLAKE2b   NOISE_ID('H', 2)
 Hash identifier for "BLAKE2b". More...
 
#define NOISE_HASH_BLAKE2s   NOISE_ID('H', 1)
 Hash identifier for "BLAKE2s". More...
 
#define NOISE_HASH_CATEGORY   NOISE_ID('H', 0)
 Category for hash algorithms. More...
 
#define NOISE_HASH_NONE   0
 Hash identifier that indicates "no hash". More...
 
#define NOISE_HASH_SHA256   NOISE_ID('H', 3)
 Hash identifier for "SHA256". More...
 
#define NOISE_HASH_SHA512   NOISE_ID('H', 4)
 Hash identifier for "SHA512". More...
 
#define NOISE_ID(ch, num)   ((((int)(ch)) << 8) | ((int)(num)))
 Builds an algorithm identifier for the library. More...
 
#define NOISE_MAX_FINGERPRINT_LEN   256
 Recommended maximum size for buffers to be passed to noise_format_fingerprint(), noise_dhstate_format_fingerprint(), etc. More...
 
#define NOISE_MAX_PAYLOAD_LEN   65535
 Maximum payload length for Noise packets. More...
 
#define NOISE_MAX_PROTOCOL_NAME   128
 Maximum length of a protocol name string. More...
 
#define NOISE_PADDING_RANDOM   NOISE_ID('G', 2)
 Pads messages with random bytes. More...
 
#define NOISE_PADDING_ZERO   NOISE_ID('G', 1)
 Pads messages with zero bytes. More...
 
#define NOISE_PATTERN_CATEGORY   NOISE_ID('P', 0)
 Category for handshake patterns. More...
 
#define NOISE_PATTERN_IK   NOISE_ID('P', 14)
 Handshake pattern identifier for "IK". More...
 
#define NOISE_PATTERN_IK_HFS   NOISE_ID('P', 58)
 
#define NOISE_PATTERN_IK_NOIDH   NOISE_ID('P', 36)
 Handshake pattern identifier for "IKnoidh". More...
 
#define NOISE_PATTERN_IK_NOIDH_HFS   NOISE_ID('P', 83)
 
#define NOISE_PATTERN_IN   NOISE_ID('P', 13)
 Handshake pattern identifier for "IN". More...
 
#define NOISE_PATTERN_IN_HFS   NOISE_ID('P', 57)
 
#define NOISE_PATTERN_IX   NOISE_ID('P', 15)
 Handshake pattern identifier for "IX". More...
 
#define NOISE_PATTERN_IX_HFS   NOISE_ID('P', 59)
 
#define NOISE_PATTERN_IX_NOIDH   NOISE_ID('P', 37)
 Handshake pattern identifier for "IXnoidh". More...
 
#define NOISE_PATTERN_IX_NOIDH_HFS   NOISE_ID('P', 84)
 
#define NOISE_PATTERN_K   NOISE_ID('P', 3)
 Handshake pattern identifier for "K". More...
 
#define NOISE_PATTERN_KK   NOISE_ID('P', 11)
 Handshake pattern identifier for "KK". More...
 
#define NOISE_PATTERN_KK_HFS   NOISE_ID('P', 55)
 
#define NOISE_PATTERN_KN   NOISE_ID('P', 10)
 Handshake pattern identifier for "KN". More...
 
#define NOISE_PATTERN_KN_HFS   NOISE_ID('P', 54)
 
#define NOISE_PATTERN_KX   NOISE_ID('P', 12)
 Handshake pattern identifier for "KX". More...
 
#define NOISE_PATTERN_KX_HFS   NOISE_ID('P', 56)
 
#define NOISE_PATTERN_KX_NOIDH   NOISE_ID('P', 35)
 Handshake pattern identifier for "KXnoidh". More...
 
#define NOISE_PATTERN_KX_NOIDH_HFS   NOISE_ID('P', 82)
 
#define NOISE_PATTERN_N   NOISE_ID('P', 1)
 Handshake pattern identifier for "N". More...
 
#define NOISE_PATTERN_NK   NOISE_ID('P', 5)
 Handshake pattern identifier for "NK". More...
 
#define NOISE_PATTERN_NK_HFS   NOISE_ID('P', 49)
 
#define NOISE_PATTERN_NN   NOISE_ID('P', 4)
 Handshake pattern identifier for "NN". More...
 
#define NOISE_PATTERN_NN_HFS   NOISE_ID('P', 48)
 
#define NOISE_PATTERN_NONE   0
 Handshake pattern identifier that indicates "no pattern". More...
 
#define NOISE_PATTERN_NX   NOISE_ID('P', 6)
 Handshake pattern identifier for "NX". More...
 
#define NOISE_PATTERN_NX_HFS   NOISE_ID('P', 50)
 
#define NOISE_PATTERN_NX_NOIDH   NOISE_ID('P', 33)
 Handshake pattern identifier for "NXnoidh". More...
 
#define NOISE_PATTERN_NX_NOIDH_HFS   NOISE_ID('P', 80)
 
#define NOISE_PATTERN_X   NOISE_ID('P', 2)
 Handshake pattern identifier for "X". More...
 
#define NOISE_PATTERN_X_NOIDH   NOISE_ID('P', 32)
 Handshake pattern identifier for "Xnoidh". More...
 
#define NOISE_PATTERN_XK   NOISE_ID('P', 8)
 Handshake pattern identifier for "XK". More...
 
#define NOISE_PATTERN_XK_HFS   NOISE_ID('P', 52)
 
#define NOISE_PATTERN_XN   NOISE_ID('P', 7)
 Handshake pattern identifier for "XN". More...
 
#define NOISE_PATTERN_XN_HFS   NOISE_ID('P', 51)
 
#define NOISE_PATTERN_XX   NOISE_ID('P', 9)
 Handshake pattern identifier for "XX". More...
 
#define NOISE_PATTERN_XX_FALLBACK   NOISE_ID('P', 16)
 Handshake pattern identifier for "XXfallback". More...
 
#define NOISE_PATTERN_XX_FALLBACK_HFS   NOISE_ID('P', 60)
 
#define NOISE_PATTERN_XX_HFS   NOISE_ID('P', 53)
 
#define NOISE_PATTERN_XX_NOIDH   NOISE_ID('P', 34)
 Handshake pattern identifier for "XXnoidh". More...
 
#define NOISE_PATTERN_XX_NOIDH_HFS   NOISE_ID('P', 81)
 
#define NOISE_PREFIX_CATEGORY   NOISE_ID('N', 0)
 Category for protocol prefixes. More...
 
#define NOISE_PREFIX_NONE   0
 Protocol prefix identifier that indicates "no prefix". More...
 
#define NOISE_PREFIX_PSK   NOISE_ID('N', 2)
 Protocol prefix identifier for "NoisePSK". More...
 
#define NOISE_PREFIX_STANDARD   NOISE_ID('N', 1)
 Protocol prefix identifier for "Noise". More...
 
#define NOISE_ROLE_INITIATOR   NOISE_ID('R', 1)
 This end of the communications is the initiator. More...
 
#define NOISE_ROLE_RESPONDER   NOISE_ID('R', 2)
 This end of the communications is the responder. More...
 
#define NOISE_SIGN_CATEGORY   NOISE_ID('S', 0)
 Category for signature algorithms. More...
 
#define NOISE_SIGN_ED25519   NOISE_ID('S', 1)
 Signature algorithm identifier for "Ed25519". More...
 
#define NOISE_SIGN_NONE   0
 Signature algorithm identifier that indicates "no algorithm". More...
 

Detailed Description

Constants for algorithm identifiers, limit values, etc.

Definition in file constants.h.

Macro Definition Documentation

#define NOISE_ID (   ch,
  num 
)    ((((int)(ch)) << 8) | ((int)(num)))

Builds an algorithm identifier for the library.

Parameters
chASCII character that names the algorithm category; e.g. 'C' for ciphers, 'P' for handshake patterns, 'E' for errors, etc.
numCode for the specific identifier, 0 to 255. The value 0 is reserved for category values.
Returns
16-bit integer value for the algorithm identifier.

This macro was deliberately designed to output a 16-bit identifier so that identifiers would fit in an "int" on 8-bit and 16-bit embedded systems.

#define NOISE_MAX_PAYLOAD_LEN   65535

Maximum payload length for Noise packets.

Note
Specific protocol instantiations may enforce a smaller limit.
#define NOISE_MAX_PROTOCOL_NAME   128

Maximum length of a protocol name string.

#define NOISE_PATTERN_IK_HFS   NOISE_ID('P', 58)

Definition at line 90 of file constants.h.

#define NOISE_PATTERN_IK_NOIDH_HFS   NOISE_ID('P', 83)

Definition at line 96 of file constants.h.

#define NOISE_PATTERN_IN_HFS   NOISE_ID('P', 57)

Definition at line 89 of file constants.h.

#define NOISE_PATTERN_IX_HFS   NOISE_ID('P', 59)

Definition at line 91 of file constants.h.

#define NOISE_PATTERN_IX_NOIDH_HFS   NOISE_ID('P', 84)

Definition at line 97 of file constants.h.

#define NOISE_PATTERN_KK_HFS   NOISE_ID('P', 55)

Definition at line 87 of file constants.h.

#define NOISE_PATTERN_KN_HFS   NOISE_ID('P', 54)

Definition at line 86 of file constants.h.

#define NOISE_PATTERN_KX_HFS   NOISE_ID('P', 56)

Definition at line 88 of file constants.h.

#define NOISE_PATTERN_KX_NOIDH_HFS   NOISE_ID('P', 82)

Definition at line 95 of file constants.h.

#define NOISE_PATTERN_NK_HFS   NOISE_ID('P', 49)

Definition at line 81 of file constants.h.

#define NOISE_PATTERN_NN_HFS   NOISE_ID('P', 48)

Definition at line 80 of file constants.h.

#define NOISE_PATTERN_NX_HFS   NOISE_ID('P', 50)

Definition at line 82 of file constants.h.

#define NOISE_PATTERN_NX_NOIDH_HFS   NOISE_ID('P', 80)

Definition at line 93 of file constants.h.

#define NOISE_PATTERN_XK_HFS   NOISE_ID('P', 52)

Definition at line 84 of file constants.h.

#define NOISE_PATTERN_XN_HFS   NOISE_ID('P', 51)

Definition at line 83 of file constants.h.

#define NOISE_PATTERN_XX_FALLBACK_HFS   NOISE_ID('P', 60)

Definition at line 92 of file constants.h.

#define NOISE_PATTERN_XX_HFS   NOISE_ID('P', 53)

Definition at line 85 of file constants.h.

#define NOISE_PATTERN_XX_NOIDH_HFS   NOISE_ID('P', 81)

Definition at line 94 of file constants.h.