52 return "Memory allocation failed";
54 return "Buffer too small";
56 return "Buffer overflow";
58 return "Null pointer";
60 return "Invalid length";
64 return "Cryptographic key generation failed";
66 return "Digital signature failed";
68 return "Signature verification failed";
70 return "Encryption failed";
72 return "Decryption failed";
74 return "Hash operation failed";
76 return "Key derivation failed";
78 return "Authentication failed";
80 return "Invalid cryptographic key";
84 return "Cipher suite not supported";
86 return "Malformed message";
88 return "EDHOC method not supported";
90 return "Invalid connection identifier";
92 return "Wrong connection identifier";
94 return "Invalid credential";
96 return "Malformed credential identifier";
98 return "Message sequence error";
100 return "Message correlation error";
102 return "Critical EAD item cannot be processed";
106 return "Key not found";
108 return "Key storage full";
110 return "Credential not found";
112 return "Storage initialization failed";
114 return "Duplicate key";
118 return "Network timeout";
120 return "Network connection error";
124 return "Message too large";
128 return "CBOR encoding failed";
130 return "CBOR decoding failed";
132 return "Invalid CBOR type";
134 return "Malformed CBOR data";
138 return "Invalid state";
140 return "Context not initialized";
142 return "Already initialized";
144 return "Identity not allowed";
148 return "Invalid parameter";
150 return "Not implemented";
152 return "Internal error";
154 return "Unknown error";
157 return "Unrecognized error code";
163 int line,
const char *function,
166 last_error_context.code = code;
167 last_error_context.file = file;
168 last_error_context.line = line;
169 last_error_context.function = function;
170 last_error_context.message = message;
178 if(last_error_context.code == EDHOC_SUCCESS) {
181 return &last_error_context;
edhoc_error_t edhoc_set_error_context(edhoc_error_t code, const char *file, int line, const char *function, const char *message)
Set error context for debugging (internal use).
const char * edhoc_error_string(edhoc_error_t error)
Get a human-readable error message for an error code.
const edhoc_error_context_t * edhoc_get_last_error_context(void)
Get the last error context (for debugging).
Error handling module header for EDHOC.
edhoc_error_t
Unified error type for EDHOC operations.
@ EDHOC_ERR_CBOR_ENCODING
CBOR encoding failed.
@ EDHOC_ERR_CRYPTO_DECRYPT
Decryption operation failed.
@ EDHOC_ERR_CREDENTIAL_INVALID
Invalid credential.
@ EDHOC_ERR_CREDENTIAL_NOT_FOUND
Credential not found.
@ EDHOC_ERR_ALREADY_INITIALIZED
Already initialized.
@ EDHOC_ERR_CRYPTO_VERIFY
Signature verification failed.
@ EDHOC_ERR_STORAGE_INIT_FAILED
Storage initialization failed.
@ EDHOC_ERR_NETWORK_TIMEOUT
Network operation timeout.
@ EDHOC_ERR_NULL_POINTER
Null pointer provided.
@ EDHOC_ERR_CRYPTO_HASH
Hash operation failed.
@ EDHOC_ERR_NETWORK_CONNECTION
Network connection error.
@ EDHOC_ERR_MESSAGE_TOO_LARGE
Message too large for transport.
@ EDHOC_ERR_ID_CRED_MALFORMED
Malformed credential identifier.
@ EDHOC_ERR_CRITICAL_EAD_UNSUPPORTED
Critical EAD item cannot be processed (RFC 9528 Section 6).
@ EDHOC_ERR_CRYPTO_ENCRYPT
Encryption operation failed.
@ EDHOC_ERR_INTERNAL_ERROR
Internal implementation error.
@ EDHOC_ERR_CRYPTO_INVALID_KEY
Invalid cryptographic key.
@ EDHOC_ERR_WRONG_CID
Wrong connection identifier.
@ EDHOC_ERR_CRYPTO_AUTHENTICATION
Authentication failed.
@ EDHOC_ERR_INVALID_STATE
Invalid context state.
@ EDHOC_ERR_KEY_NOT_FOUND
Key not found in storage.
@ EDHOC_ERR_DUPLICATE_KEY
Duplicate key in storage.
@ EDHOC_ERR_CRYPTO_KDF
Key derivation failed.
@ EDHOC_ERR_NOT_IMPLEMENTED
Feature not implemented.
@ EDHOC_ERR_BUFFER_OVERFLOW
Buffer overflow detected.
@ EDHOC_ERR_SUITE_NOT_SUPPORTED
Cipher suite not supported.
@ EDHOC_ERR_MSG_MALFORMED
Malformed message received.
@ EDHOC_ERR_COAP_ERROR
CoAP protocol error.
@ EDHOC_ERR_CORRELATION
Message correlation error.
@ EDHOC_ERR_KEY_STORAGE_FULL
Key storage is full.
@ EDHOC_ERR_INVALID_LENGTH
Invalid length parameter.
@ EDHOC_ERR_UNKNOWN
Unknown error condition.
@ EDHOC_ERR_CID_INVALID
Invalid connection identifier.
@ EDHOC_ERR_NOT_ALLOWED_IDENTITY
Identity not allowed.
@ EDHOC_ERR_BUFFER_TOO_SMALL
Provided buffer is too small.
@ EDHOC_ERR_CRYPTO_KEYGEN
Key generation failed.
@ EDHOC_ERR_CBOR_MALFORMED
Malformed CBOR data.
@ EDHOC_ERR_CRYPTO_SIGN
Digital signature failed.
@ EDHOC_ERR_CONTEXT_NOT_INITIALIZED
Context not initialized.
@ EDHOC_ERR_METHOD_NOT_SUPPORTED
EDHOC method not supported.
@ EDHOC_ERR_CBOR_DECODING
CBOR decoding failed.
@ EDHOC_ERR_CBOR_INVALID_TYPE
Invalid CBOR data type.
@ EDHOC_ERR_INVALID_PARAMETER
Invalid parameter provided.
@ EDHOC_ERR_MEMORY_ALLOCATION
Memory allocation failed.
@ EDHOC_ERR_SEQUENCE_ERROR
Message sequence error.
Error context structure for debugging.