SSP21-CPP
CryptoError.h
1 //
2 // _ _ ______ _ _ _ _ _ _ _
3 // | \ | | | ____| | (_) | (_) | | | |
4 // | \| | ___ | |__ __| |_| |_ _ _ __ __ _| | | |
5 // | . ` |/ _ \ | __| / _` | | __| | '_ \ / _` | | | |
6 // | |\ | (_) | | |___| (_| | | |_| | | | | (_| |_|_|_|
7 // |_| \_|\___/ |______\__,_|_|\__|_|_| |_|\__, (_|_|_)
8 // __/ |
9 // |___/
10 //
11 // This file is auto-generated. Do not edit manually
12 //
13 // Licensed under the terms of the BSDv3 license
14 //
15 
16 #ifndef SSP21_CRYPTOERROR_H
17 #define SSP21_CRYPTOERROR_H
18 
19 #include <cstdint>
20 #include "ser4cpp/util/Uncopyable.h"
21 #include "ssp21/util/ErrorCategory.h"
22 
23 namespace ssp21 {
24 
25 /**
26  Various errors in the cryptographic layer
27 */
28 enum class CryptoError : uint8_t
29 {
30  /// no error
31  ok = 0x0,
32  /// attempted operation with bad key type
33  bad_key_type = 0x1,
34  /// attempted operation with a buffer with the wrong length
35  bad_length = 0x2,
36  /// X25519 DH operation failed. Bad public key?
37  dh_x25519_fail = 0x3,
38  /// a procedure cannot be executed b/c of an undefined algorithm
39  undefined_algorithm = 0x4,
40  /// A calculated MAC did not match the specified MAC
41  mac_auth_fail = 0x5,
42  /// A calculated digital signature did not authenticate
43  signature_auth_fail = 0x6,
44  /// A buffer had an insufficient or incorrect size
45  bad_buffer_size = 0x7,
46  /// No validate session for authenticating user data
47  no_valid_session = 0x8,
48  /// The TTL on a message is expired
49  expired_ttl = 0x9,
50  /// The nonce on a received message has been replayed
51  nonce_replay = 0xA,
52  /// A nonce has reached a configured maximum value
53  max_nonce_exceeded = 0xB,
54  /// The session time has reached a configured maximum value
56  /// Received a session message with no user data
57  empty_user_data = 0xD,
58  /// A rollback of the monotonic clock was detected
59  clock_rollback = 0xE
60 };
61 
63 {
64  typedef CryptoError enum_type_t;
65 
66  static const char* name;
67 
68  static const char* to_string(CryptoError arg);
69 };
70 
72 
73 inline std::error_code make_error_code(CryptoError err)
74 {
75  return std::error_code(static_cast<int>(err), CryptoErrorCategory::get());
76 }
77 
78 }
79 
80 namespace std {
81 
82 template <>
83 struct is_error_code_enum<ssp21::CryptoError> : public true_type {};
84 
85 }
86 
87 #endif
SSP21-cpp main namespace.
Definition: BufferTypes.h:12
A buffer had an insufficient or incorrect size.
A calculated digital signature did not authenticate.
The TTL on a message is expired.
X25519 DH operation failed. Bad public key?
CryptoError
Definition: CryptoError.h:28
No validate session for authenticating user data.
A calculated MAC did not match the specified MAC.
A rollback of the monotonic clock was detected.
The nonce on a received message has been replayed.
Received a session message with no user data.
The session time has reached a configured maximum value.
A nonce has reached a configured maximum value.
a procedure cannot be executed b/c of an undefined algorithm
attempted operation with a buffer with the wrong length
attempted operation with bad key type