Contiki-NG
Loading...
Searching...
No Matches
Edhoc

Data Structures

struct  edhoc_client
 EDHOC client struct. More...
struct  edhoc_client_ad
 EDHOC client Application data struct. More...
struct  edhoc_data_event
 EDHOC data event struct. More...
struct  oscore_ctx
 OSCORE context struct. More...
struct  edhoc_server
 EDHOC Server Struct. More...
struct  edhoc_server_ad
 EDHOC server Application data struct. More...
struct  ecc_data_event
 EDHOC server data event struct. More...

Macros

#define SERVER_EP   "coap://[fd00::1]"
 The CoAP Server IP where run the EDHOC Responder.
#define CL_TIMEOUT_VAL   10000
 Time limit value to EDHOC protocol finished.
#define EDHOC_MAX_BUFFER   256
 The max size of the buffers.
#define EDHOC_MAX_CRED_LEN   128
 Optimized buffer sizes for credentials based on COSE standard analysis CRED_X: 84-120 bytes typical → 128 bytes (safe margin) ID_CRED_X: 4-7 bytes (KID mode) or 84-120 bytes (include mode).
#define EDHOC_SUITES_MAX_COUNT   10
 The max number of suites.
#define EDHOC_CID   0x1
 Set EDHOC connection identifier.
#define EDHOC_MAX_CID_LEN   8
 Maximum length of connection identifiers RFC 9528 allows variable-length CIDs including negative integers.
#define EDHOC_DEFAULT_CID_LEN   1
 Default CID length for backward compatibility.
#define EDHOC_MAX_KID_LEN   4
 Maximum length of Key Identifiers (KID) in credentials COSE Key IDs can be 1-4 bytes typically, but allowing larger for flexibility.
#define EDHOC_MAX_IDENTITY_LEN   32
 Maximum length of identity strings in credentials Used for human-readable credential identities (e.g., "example.edu").
#define EDHOC_ROLE   EDHOC_INITIATOR
 Set the EDHOC Protocol role.
#define EDHOC_METHOD   EDHOC_METHOD0
 Set the Authentication method.
#define EDHOC_MAC_OR_SIG_BUF_LEN   P256_SIGNATURE_LEN
 Buffer size for mac_or_sig.
#define INITIATOR_METHOD2   (EDHOC_METHOD == EDHOC_METHOD2 && EDHOC_ROLE == EDHOC_INITIATOR)
 Helper defines for method handling on msg.
#define EDHOC_AUTHENT_TYPE   EDHOC_CRED_KID
 Set the authentication credential type/usage.
#define P256_SIGNATURE_LEN   64
 Length of signatures.
#define EDHOC_SUPPORTED_SUITE_1   -1
 Set EDHOC cipher suite config.
#define EDHOC_CONF_ATTEMPTS   2
 The number of attempts to try to connect with the EDHOC server successfully.
#define EDHOC_MAX_PAYLOAD_LEN   256
 The max length of the EDHOC message.
#define EDHOC_MAX_AD_SZ   8
 The max length of the Application Data.
#define EDHOC_EAD_PROCESSING   1
 Enable/disable External Authorization Data (EAD) processing.
#define EDHOC_COAP_URI_PATH   ".well-known/edhoc"
 EDHOC resource CoAP URI path.
#define SERV_TIMEOUT_VAL   10000
 Time limit value for EDHOC protocol completion.

Typedefs

typedef struct edhoc_client edhoc_client_t
 EDHOC client struct.
typedef struct edhoc_client_ad edhoc_client_ad_t
 EDHOC client Application data struct.
typedef struct edhoc_data_event edhoc_data_event_t
 EDHOC data event struct.
typedef struct oscore_ctx oscore_ctx_t
 OSCORE context struct.
typedef struct edhoc_server edhoc_server_t
 EDHOC Server Struct.
typedef struct edhoc_server_ad edhoc_server_ad_t
 EDHOC server Application data struct.
typedef struct ecc_data_event ecc_data_event_t
 EDHOC server data event struct.

Functions

void edhoc_client_run (void)
 Run the EDHOC Initiator role.
int8_t edhoc_client_callback (process_event_t ev, void *data)
 Check if the EDHOC client have finished.
void edhoc_client_close (void)
 Close the EDHOC context.
uint8_t edhoc_client_get_ad_2 (char *buf, size_t buf_sz)
 Get the Application Data received in EDHOC message 2.
void edhoc_client_set_ad_1 (const void *data_buffer, uint8_t buffer_size)
 Set the Application Data to be carried in EDHOC message 1.
void edhoc_client_set_ad_3 (const void *data_buffer, uint8_t buffer_size)
 Set the Application Data to be carried in EDHOC message 3.
int8_t edhoc_exporter_oscore (oscore_ctx_t *osc, edhoc_context_t *ctx)
 Derive an OSCORE Context from EDHOC.
void print_oscore_ctx (oscore_ctx_t *osc)
 Print OSCORE Security Context contents for debugging.
int8_t edhoc_exporter (const uint8_t *in_key, uint8_t exporter_label, const uint8_t *context, uint8_t context_sz, uint16_t length, uint8_t *result)
 Derive an application-specific key from EDHOC.
edhoc_error_t edhoc_generate_message_1 (edhoc_context_t *ctx, uint8_t *ad, size_t ad_sz, bool suite_array)
 Generate the EDHOC Message 1 and set it in the EDHOC context.
edhoc_error_t edhoc_generate_message_2 (edhoc_context_t *ctx, const uint8_t *auth_data, size_t auth_data_size)
 Generate the EDHOC Message 2 and set it in the EDHOC context.
edhoc_error_t edhoc_generate_message_3 (edhoc_context_t *ctx, const uint8_t *auth_data, size_t auth_data_size)
 Generate the EDHOC Message 3 and set it in the EDHOC context.
edhoc_error_t edhoc_check_err_rx_msg (uint8_t message, const uint8_t *data, size_t data_size)
 Try to deserialize data as an EDHOC error message.
int edhoc_handler_msg_1 (edhoc_context_t *ctx, uint8_t *payload, size_t payload_size, uint8_t *auth_data)
 Handle the EDHOC Message 1 received.
int edhoc_handler_msg_2 (edhoc_msg_2_t *msg2, edhoc_context_t *ctx, uint8_t *payload, size_t payload_size)
 Handle the EDHOC Message 2 received.
int edhoc_handler_msg_3 (edhoc_msg_3_t *msg3, edhoc_context_t *ctx, uint8_t *payload, size_t payload_size)
 Handle the EDHOC Message 3 received.
void edhoc_server_init (void)
 Activate the EDHOC CoAP Resource.
uint8_t edhoc_server_start (void)
 Create a new EDHOC context for a new EDHOC protocol session.
uint8_t edhoc_server_reset_handshake (void)
 Reset the EDHOC handshake state for a new client connection.
int8_t edhoc_server_callback (process_event_t ev, void *data)
 Check if an EDHOC server session has finished.
void edhoc_server_close (void)
 Close the EDHOC context.
void edhoc_server_process (coap_message_t *req, coap_message_t *res, edhoc_server_t *ser, uint8_t *msg, size_t len)
 Run the EDHOC Responder role process.
void edhoc_server_set_ad_2 (const void *buf, uint8_t buf_sz)
 Set the Application Data to be carried in EDHOC message 2.
uint8_t edhoc_server_get_ad_1 (char *buf)
 Get the Application Data received in EDHOC message 1.
uint8_t edhoc_server_get_ad_3 (char *buf)
 Get the Application Data received in EDHOC message 3.

Variables

coap_resource_t res_edhoc
 CoAP resource.

Detailed Description

Macro Definition Documentation

◆ EDHOC_EAD_PROCESSING

#define EDHOC_EAD_PROCESSING   1

Enable/disable External Authorization Data (EAD) processing.

When enabled, the implementation will process EAD items according to RFC 9528 Section 6:

  • Critical EAD items (negative ead_label) that cannot be processed will trigger an error
  • Non-critical EAD items (non-negative ead_label) will be ignored if not recognized

To disable in project-conf.h:

#define EDHOC_CONF_EAD_PROCESSING 0

Definition at line 338 of file edhoc-config.h.

◆ EDHOC_MAX_CID_LEN

#define EDHOC_MAX_CID_LEN   8

Maximum length of connection identifiers RFC 9528 allows variable-length CIDs including negative integers.

To override in project-conf.h:

#define EDHOC_CONF_MAX_CID_LEN 16

Definition at line 122 of file edhoc-config.h.

Referenced by edhoc_calc_mac(), edhoc_deserialize_msg_1(), edhoc_handler_msg_2(), and edhoc_initialize_context().

◆ EDHOC_MAX_IDENTITY_LEN

#define EDHOC_MAX_IDENTITY_LEN   32

Maximum length of identity strings in credentials Used for human-readable credential identities (e.g., "example.edu").

To override in project-conf.h:

#define EDHOC_CONF_MAX_IDENTITY_LEN 64

Definition at line 157 of file edhoc-config.h.

Referenced by edhoc_check_key_list_identity().

◆ EDHOC_MAX_KID_LEN

#define EDHOC_MAX_KID_LEN   4

Maximum length of Key Identifiers (KID) in credentials COSE Key IDs can be 1-4 bytes typically, but allowing larger for flexibility.

To override in project-conf.h:

#define EDHOC_CONF_MAX_KID_LEN 8

Definition at line 142 of file edhoc-config.h.

◆ EDHOC_SUITES_MAX_COUNT

#define EDHOC_SUITES_MAX_COUNT   10

The max number of suites.

There are nine suites that are defined at the time of writing (0-6 and 24-25). We select just a slightly larger value to avoid using too much unnecessary space for the array of suites.

Definition at line 73 of file edhoc-config.h.

Referenced by edhoc_generate_message_1().

◆ INITIATOR_METHOD2

#define INITIATOR_METHOD2   (EDHOC_METHOD == EDHOC_METHOD2 && EDHOC_ROLE == EDHOC_INITIATOR)

Helper defines for method handling on msg.

reception

Definition at line 202 of file edhoc-config.h.

Function Documentation

◆ edhoc_check_err_rx_msg()

edhoc_error_t edhoc_check_err_rx_msg ( uint8_t message,
const uint8_t * data,
size_t data_size )

Try to deserialize data as an EDHOC error message.

Parameters
messageexpected type of message
datainput CBOR data to parse
data_sizeinput size of CBOR data
Returns
EDHOC_SUCCESS if data is not an EDHOC error message, error code otherwise.

Definition at line 192 of file edhoc-msg-handlers.c.

References edhoc_deserialize_err(), EDHOC_ERR_CREDENTIAL_NOT_FOUND, EDHOC_ERR_MSG_MALFORMED, and EDHOC_ERR_SUITE_NOT_SUPPORTED.

Referenced by edhoc_handler_msg_1(), edhoc_handler_msg_2(), and edhoc_handler_msg_3().

◆ edhoc_client_callback()

int8_t edhoc_client_callback ( process_event_t ev,
void * data )

Check if the EDHOC client have finished.

Parameters
evprocess event
dataprocess data
Return values
1if EDHOC Client process finished success
-1if EDHOC Client process expire attempts
0if the event is not from EDHOC Client process or the EDHOC client process has not finished yet

This function checks the events trigger from the EDHOC client process looking for the EVT_FINISHED or EVT_TRIES_EXPIRE events.

Definition at line 109 of file edhoc-client.c.

◆ edhoc_client_close()

void edhoc_client_close ( void )

Close the EDHOC context.

This function must be called after the Security Context is exported to free the allocated memory.

Definition at line 566 of file edhoc-client.c.

References coap_timer_stop(), edhoc_ctx, and edhoc_finalize().

◆ edhoc_client_get_ad_2()

uint8_t edhoc_client_get_ad_2 ( char * buf,
size_t buf_sz )

Get the Application Data received in EDHOC message 2.

Parameters
bufA pointer to a buffer to copy the Application data
buf_szThe size of the destination buffer
Returns
ad_sz The Application data length, or 0 if error

This function copies to the buff the Application data from the EDHOC message 2 received. Returns 0 if the destination buffer is too small or invalid.

Definition at line 162 of file edhoc-client.c.

◆ edhoc_client_run()

void edhoc_client_run ( void )

Run the EDHOC Initiator role.

This function must be called from the EDHOC Initiator program to start the EDHOC protocol as Initiator. Runs a new process that implements all the EDHOC protocol and exits when the EDHOC protocol finishes successfully or expire the EDHOC_CONF_ATTEMPTS.

  • When the EDHOC protocol finishes successfully a EVT_FINISHED event is triggered.
  • When the EDHOC protocol expires the EDHOC_CONF_ATTEMPTS attempts a EVT_TRIES_EXPIRE event is triggered

Definition at line 126 of file edhoc-client.c.

References process_start().

◆ edhoc_client_set_ad_1()

void edhoc_client_set_ad_1 ( const void * data_buffer,
uint8_t buffer_size )

Set the Application Data to be carried in EDHOC message 1.

Parameters
data_bufferA pointer to a buffer that contains the Application data to be copied
buffer_sizeThe Application data length

This function sets the Application data to be carried in EDHOC message 1.

Definition at line 132 of file edhoc-client.c.

References EDHOC_MAX_AD_SZ.

◆ edhoc_client_set_ad_3()

void edhoc_client_set_ad_3 ( const void * data_buffer,
uint8_t buffer_size )

Set the Application Data to be carried in EDHOC message 3.

Parameters
data_bufferA pointer to a buffer that contains the Application data to be copied
buffer_sizeThe Application data length

This function sets the Application data to be carried in EDHOC message 3.

Definition at line 147 of file edhoc-client.c.

References EDHOC_MAX_AD_SZ.

◆ edhoc_exporter()

int8_t edhoc_exporter ( const uint8_t * in_key,
uint8_t exporter_label,
const uint8_t * context,
uint8_t context_sz,
uint16_t length,
uint8_t * result )

Derive an application-specific key from EDHOC.

Parameters
resultOutput buffer where the derived key will be stored
in_keyPRK_Exporter key to use
exporter_labelLabel used to differentiate different key derivation outputs
contextContext data used to generate the info input for key derivation
context_szThe size of the context data
lengthLength of the key to be derived
Returns
The number of derived key bytes (a positive value) on success, or a negative error code on failure

This function derives a key for application-specific use from the EDHOC shared secret using the EDHOC KDF. The key derivation is based on the provided label and length. This can be used to export keys after the successful completion of the EDHOC protocol.

Definition at line 64 of file edhoc-exporter.c.

References edhoc_kdf().

Referenced by edhoc_exporter_oscore().

◆ edhoc_exporter_oscore()

int8_t edhoc_exporter_oscore ( oscore_ctx_t * osc,
edhoc_context_t * ctx )

Derive an OSCORE Context from EDHOC.

Parameters
oscOutput OSCORE Context struct
ctxInput EDHOC Context struct
Returns
A positive value on success, or a negative HKDF error code on failure

This function derives an OSCORE Security Context [RFC8613] from the EDHOC shared secret. It can be called by both EDHOC Initiator and Responder once the EDHOC protocol has finished successfully.

Definition at line 75 of file edhoc-exporter.c.

References edhoc_exporter(), edhoc_kdf(), and EDHOC_ROLE.

◆ edhoc_generate_message_1()

edhoc_error_t edhoc_generate_message_1 ( edhoc_context_t * ctx,
uint8_t * ad,
size_t ad_sz,
bool suite_array )

Generate the EDHOC Message 1 and set it in the EDHOC context.

Parameters
ctxEDHOC Context struct
adApplication data to include in MSG1
ad_szApplication data length
suite_arrayIf true, MSG1 includes an array of cipher suites when more than one is supported. If false, MSG1 includes a single unsigned suite value regardless of the number of suites supported by the initiator.
Returns
EDHOC_SUCCESS on success, error code on failure

Composes EDHOC Message 1 as described in RFC9528 for EDHOC authentication with asymmetric keys, encoded as a CBOR sequence in the MSG1 element of the context struct. Uses the ephemeral key, cipher suite, and connection identifier already set in the context (they are established by the caller, not by this function). Used by the Initiator EDHOC role.

  • ctx->MSG1 = (METHOD:unsigned, SUITES_I, G_X, C_I_identifier)

Definition at line 199 of file edhoc-msg-generators.c.

◆ edhoc_generate_message_2()

edhoc_error_t edhoc_generate_message_2 ( edhoc_context_t * ctx,
const uint8_t * auth_data,
size_t auth_data_size )

Generate the EDHOC Message 2 and set it in the EDHOC context.

Parameters
ctxEDHOC Context struct
auth_dataApplication data to include in MSG2
auth_data_sizeApplication data length
Returns
EDHOC_SUCCESS on success, error code on failure

Used by the EDHOC Responder role to generate message 2. Computes the transcript hash TH_2 = H(ctx->MSG1, data_2), computes MAC_2 (Message Authentication Code), computes CIPHERTEXT_2, and composes EDHOC Message 2 as described in RFC9528 for EDHOC authentication with asymmetric keys, encoded as a CBOR sequence in the MSG2 element of the context struct. Uses the ephemeral key and connection identifier already set in the context.

  • ctx->MSG2 = a single CBOR byte string containing G_Y || CIPHERTEXT_2
  • where: data_2 = G_Y (C_R is carried inside the plaintext of CIPHERTEXT_2, not in data_2)

Definition at line 258 of file edhoc-msg-generators.c.

◆ edhoc_generate_message_3()

edhoc_error_t edhoc_generate_message_3 ( edhoc_context_t * ctx,
const uint8_t * auth_data,
size_t auth_data_size )

Generate the EDHOC Message 3 and set it in the EDHOC context.

Parameters
ctxEDHOC Context struct
auth_dataApplication data to include in MSG3
auth_data_sizeApplication data length
Returns
EDHOC_SUCCESS on success, error code on failure

Used by the EDHOC Initiator role to generate message 3. Computes the transcript hash TH_3 = H(TH_2, PLAINTEXT_2, data_3), computes MAC_3 (Message Authentication Code), computes CIPHERTEXT_3, and composes EDHOC Message 3 as described in RFC9528 for EDHOC authentication with asymmetric keys, encoded as a CBOR sequence in the MSG3 element of the context struct.

  • ctx->MSG3 = (data_3, CIPHERTEXT_3)
  • where: data_3 = (?C_R_identifier)

Definition at line 406 of file edhoc-msg-generators.c.

◆ edhoc_handler_msg_1()

int edhoc_handler_msg_1 ( edhoc_context_t * ctx,
uint8_t * payload,
size_t payload_size,
uint8_t * auth_data )

Handle the EDHOC Message 1 received.

Parameters
ctxEDHOC Context struct
payloadA pointer to the buffer containing the EDHOC message received
payload_sizeSize of the EDHOC message received
auth_dataA pointer to a buffer to copy the Application Data received in Message 1
Return values
negativenumber (EDHOC ERROR CODES) when an EDHOC ERROR is detected
ad_szThe length of the Application Data received in Message 1, when EDHOC success

Used by Responder EDHOC role to process the Message 1 received

  • Decode the message 1
  • Verify that cipher suite
  • Pass Application data AD_1
  • If any verification step fails to return an EDHOC ERROR code and, if all the steps success
  • the length of the Application Data receive on the Message 1 is returned.

Definition at line 228 of file edhoc-msg-handlers.c.

References edhoc_check_err_rx_msg(), edhoc_deserialize_msg_1(), EDHOC_ERR_MSG_MALFORMED, EDHOC_MAX_AD_SZ, edhoc_print_session_info(), edhoc_process_ead_item(), and print_msg_1().

◆ edhoc_handler_msg_2()

int edhoc_handler_msg_2 ( edhoc_msg_2_t * msg2,
edhoc_context_t * ctx,
uint8_t * payload,
size_t payload_size )

Handle the EDHOC Message 2 received.

Parameters
msg2A pointer to the buffer containing the received EDHOC message 2
ctxEDHOC Context struct
payloadA pointer to the buffer containing the EDHOC message received
payload_sizeSize of the EDHOC message received
Return values
negativeerror code when an EDHOC ERROR is detected
1when EDHOC decode and verify success

Used by Initiator EDHOC role to process the Message 2 received

  • Decode the message 2
  • Verify the other peer through 5-tuple and/or connection identifier C_I

If any verification step fails to return an EDHOC ERROR code and, if all the steps success return 1.

Definition at line 311 of file edhoc-msg-handlers.c.

References cbor_init_reader(), edhoc_check_err_rx_msg(), edhoc_deserialize_msg_2(), edhoc_enc_dec_ciphertext_2(), EDHOC_ERR_MSG_MALFORMED, edhoc_generate_keystream_2e(), edhoc_generate_prk_2e(), edhoc_generate_transcript_hash_2(), EDHOC_MAX_BUFFER, EDHOC_MAX_CID_LEN, edhoc_read_byte_identifier(), and print_msg_2().

◆ edhoc_handler_msg_3()

int edhoc_handler_msg_3 ( edhoc_msg_3_t * msg3,
edhoc_context_t * ctx,
uint8_t * payload,
size_t payload_size )

Handle the EDHOC Message 3 received.

Parameters
msg3A pointer to the buffer containing the received EDHOC message 3
ctxEDHOC Context struct
payloadA pointer to the buffer containing the EDHOC message received
payload_sizeSize of the EDHOC message received
Return values
negativenumber (EDHOC ERROR CODE) when an EDHOC ERROR is detected
1when EDHOC decode and verify success

Used by Responder EDHOC role to process the Message 3 receive

  • Decode the message 3
  • Verify the other peer through 5-tuple and/or connection identifier C_R

If any verification step fails to return an EDHOC ERROR code and,if all the steps success return 1.

Definition at line 385 of file edhoc-msg-handlers.c.

References edhoc_check_err_rx_msg(), edhoc_deserialize_msg_3(), EDHOC_ERR_CRYPTO_DECRYPT, edhoc_generate_transcript_hash_3(), and print_msg_3().

◆ edhoc_server_callback()

int8_t edhoc_server_callback ( process_event_t ev,
void * data )

Check if an EDHOC server session has finished.

Parameters
evProcess event
dataProcess data
Return values
SERV_HANDSHAKE_COMPLETE(non-zero) if the session finished successfully with an EDHOC client
SERV_HANDSHAKE_RESET(non-zero) if the handshake was reset
0if the event is not from the EDHOC server or the handshake has not finished yet

This function checks the events triggered from the EDHOC server protocol, reporting both handshake completion (SERV_HANDSHAKE_COMPLETE) and handshake reset (SERV_HANDSHAKE_RESET). A non-zero return does not by itself imply success, so callers must distinguish the two values.

Definition at line 107 of file edhoc-server.c.

◆ edhoc_server_close()

void edhoc_server_close ( void )

Close the EDHOC context.

This function must be called after the Security Context is exported to free the allocated memory.

Definition at line 342 of file edhoc-server.c.

References edhoc_ctx, and edhoc_finalize().

◆ edhoc_server_get_ad_1()

uint8_t edhoc_server_get_ad_1 ( char * buf)

Get the Application Data received in EDHOC message 1.

Parameters
bufA pointer to a buffer to copy the Application data
Returns
ad_sz The Application data length

This function copies the Application data from the received EDHOC message 1 to the buffer.

Definition at line 133 of file edhoc-server.c.

◆ edhoc_server_get_ad_3()

uint8_t edhoc_server_get_ad_3 ( char * buf)

Get the Application Data received in EDHOC message 3.

Parameters
bufA pointer to a buffer to copy the Application data
Returns
ad_sz The Application data length

This function copies the Application data from the received EDHOC message 3 to the buffer.

Definition at line 140 of file edhoc-server.c.

◆ edhoc_server_init()

void edhoc_server_init ( void )

Activate the EDHOC CoAP Resource.

Activate the EDHOC well-known CoAP Resource at the Uri-Path defined in the WELL_KNOW macro.

Definition at line 334 of file edhoc-server.c.

References coap_activate_resource(), EDHOC_COAP_URI_PATH, process_alloc_event(), and res_edhoc.

◆ edhoc_server_process()

void edhoc_server_process ( coap_message_t * req,
coap_message_t * res,
edhoc_server_t * ser,
uint8_t * msg,
size_t len )

Run the EDHOC Responder role process.

Parameters
reqThe request CoAP message received
resThe response CoAP message to send back
serThe EDHOC server struct
msgA pointer to the buffer with the received message
lenThe received message length

This function must be called from a CoAP POST handler to run the EDHOC protocol Responder role. EDHOC messages 1 and 3 are transferred in POST requests and EDHOC message 2 is transferred in 2.04 (Changed) responses.

Definition at line 348 of file edhoc-server.c.

References coap_timer_set(), coap_timer_set_callback(), EDHOC_MAX_PAYLOAD_LEN, EDHOC_TRACE_STATE, and SERV_TIMEOUT_VAL.

◆ edhoc_server_reset_handshake()

uint8_t edhoc_server_reset_handshake ( void )

Reset the EDHOC handshake state for a new client connection.

Return values
Non-zeroif the authentication credentials for the EDHOC server exist in the key-storage and the EDHOC server resets correctly.

Resets the EDHOC handshake state to prepare for a new client handshake. This clears the current session state while keeping the server running. Must be called after completing or aborting a handshake before accepting the next client.

Definition at line 307 of file edhoc-server.c.

References edhoc_ctx, edhoc_initialize_context(), and edhoc_setup_suites().

Referenced by edhoc_server_start().

◆ edhoc_server_set_ad_2()

void edhoc_server_set_ad_2 ( const void * buf,
uint8_t buf_sz )

Set the Application Data to be carried in EDHOC message 2.

Parameters
bufA pointer to a buffer that contains the Application data to be copied
buf_szThe Application data length

This function sets the Application data to be carried in EDHOC message 2.

Definition at line 121 of file edhoc-server.c.

References EDHOC_MAX_AD_SZ.

◆ edhoc_server_start()

uint8_t edhoc_server_start ( void )

Create a new EDHOC context for a new EDHOC protocol session.

Return values
Non-zeroif the authentication credentials for the EDHOC server exist in the key-storage and the EDHOC server starts correctly.

This function retrieves the DH-static authentication key pair of the Server from the edhoc-key-storage. The authentication keys must be established in the EDHOC key storage before running the EDHOC protocol. Creates a new EDHOC context and generates the DH-ephemeral key for the specific session. A new EDHOC protocol session must be created for each new EDHOC client connection attempt.

Definition at line 321 of file edhoc-server.c.

References edhoc_ctx, and edhoc_server_reset_handshake().

◆ print_oscore_ctx()

void print_oscore_ctx ( oscore_ctx_t * osc)

Print OSCORE Security Context contents for debugging.

Parameters
oscInput OSCORE Context struct

Definition at line 51 of file edhoc-exporter.c.