EDHOC Error Codes

This page documents the EDHOC error-code enumeration and the runtime error-getter API used to retrieve EDHOC-level information after a message processing or composition failure.

All public functions return EDHOC_SUCCESS (0) on success or a negative C error code. After a failure, call edhoc_error_get_code() to retrieve the EDHOC error code carried in (or to be carried in) the on-the-wire error message defined in RFC 9528, Section 6.

Header file: include/edhoc_values.h

Error code enumeration

group EDHOC error codes

Defines

EDHOC_SUCCESS

The action was completed successfully.

EDHOC_ERROR_GENERIC_ERROR

An error occurred that does not correspond to any defined failure cause.

EDHOC_ERROR_NOT_SUPPORTED

The requested operation or a parameter is not supported by this implementation.

EDHOC_ERROR_NOT_PERMITTED

The requested action is denied by the EDHOC specification.

EDHOC_ERROR_BUFFER_TOO_SMALL

An output buffer is too small.

EDHOC_ERROR_BAD_STATE

The requested action cannot be performed in the current state.

EDHOC_ERROR_INVALID_ARGUMENT

The parameters passed to the function are invalid.

EDHOC_ERROR_NOT_ENOUGH_MEMORY

A memory allocation failed (heap or custom memory backend).

EDHOC_ERROR_CBOR_FAILURE

CBOR encoding or decoding failed.

EDHOC_ERROR_CRYPTO_FAILURE

A cryptographic operation failed.

EDHOC_ERROR_CREDENTIALS_FAILURE

Authentication credentials fetch or verify callback failed.

EDHOC_ERROR_EAD_COMPOSE_FAILURE

External authorization data compose failed.

EDHOC_ERROR_EAD_PROCESS_FAILURE

External authorization data process failed.

EDHOC_ERROR_MSG_1_PROCESS_FAILURE

EDHOC message 1 processing failed.

EDHOC_ERROR_MSG_2_PROCESS_FAILURE

EDHOC message 2 processing failed.

EDHOC_ERROR_MSG_3_PROCESS_FAILURE

EDHOC message 3 processing failed.

EDHOC_ERROR_MSG_4_PROCESS_FAILURE

EDHOC message 4 processing failed.

EDHOC_ERROR_EPHEMERAL_DIFFIE_HELLMAN_FAILURE

Ephemeral Diffie-Hellman key generation or agreement failed.

EDHOC_ERROR_TRANSCRIPT_HASH_FAILURE

Transcript hash computation failed.

EDHOC_ERROR_PSEUDORANDOM_KEY_FAILURE

Pseudorandom key derivation failed.

EDHOC_ERROR_INVALID_MAC_2

MAC_2 verification failed.

EDHOC_ERROR_INVALID_SIGN_OR_MAC_2

Signature_or_MAC_2 verification failed.

EDHOC_ERROR_INVALID_MAC_3

MAC_3 verification failed.

EDHOC_ERROR_INVALID_SIGN_OR_MAC_3

Signature_or_MAC_3 verification failed.

Runtime error API

group EDHOC errors API

Functions

int edhoc_error_get_code(const struct edhoc_context *edhoc_context, enum edhoc_error_code *error_code)

EDHOC error getter.

Parameters:
  • edhoc_context – EDHOC context.

  • error_code[out] EDHOC error code.

Return values:
  • EDHOC_SUCCESS – Success.

  • EDHOC_ERROR_INVALID_ARGUMENT – One or more input parameters are invalid.

  • EDHOC_ERROR_BAD_STATE – Internal context state is incorrect.

int edhoc_error_get_cipher_suites(const struct edhoc_context *edhoc_context, int32_t *cipher_suites, size_t cipher_suites_size, size_t *cipher_suites_length, int32_t *peer_cipher_suites, size_t peer_cipher_suites_size, size_t *peer_cipher_suites_length)

Retrieve own and peer cipher suites after EDHOC_ERROR_CODE_WRONG_SELECTED_CIPHER_SUITE.

Parameters:
  • edhoc_context – EDHOC context.

  • cipher_suites[out] Buffer where the own cipher suite values are written.

  • cipher_suites_size – Size of the cipher_suites buffer in entries.

  • cipher_suites_length[out] On success, the number of entries written to cipher_suites.

  • peer_cipher_suites[out] Buffer where the peer cipher suite values are written.

  • peer_cipher_suites_size – Size of the peer_cipher_suites buffer in entries.

  • peer_cipher_suites_length[out] On success, the number of entries written to peer_cipher_suites.

Return values:
  • EDHOC_SUCCESS – Success.

  • EDHOC_ERROR_INVALID_ARGUMENT – One or more input parameters are invalid.

  • EDHOC_ERROR_BAD_STATE – Internal context state is incorrect.

  • EDHOC_ERROR_BUFFER_TOO_SMALL – Output buffer is too small.