![]() |
Contiki-NG
|
This is an implementation of Ephemeral Diffie-Hellman Over COSE (EDHOC), a very compact and lightweight authenticated Diffie-Hellman key exchange with ephemeral keys that provides mutual authentication, perfect forward secrecy, and identity protection as described in RFC9528. More...
Functions | |
| void | edhoc_storage_init (void) |
| Reserve memory for the EDHOC context struct. | |
| uint8_t | edhoc_setup_suites (edhoc_context_t *ctx) |
| Initialize the EDHOC Context with the defined EDHOC parameters. | |
| void | edhoc_finalize (edhoc_context_t *ctx) |
| Close the EDHOC context. | |
| 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. | |
| uint8_t | edhoc_generate_error_message (uint8_t *msg_er, size_t msg_er_sz, const edhoc_context_t *ctx, int8_t err) |
| Generate the EDHOC ERROR Message. | |
| int | edhoc_authenticate_msg (edhoc_context_t *ctx, uint8_t *ad, bool msg2) |
| Authenticate the rx message. | |
| int16_t | edhoc_kdf (const uint8_t *prk, uint8_t info_label, const uint8_t *context, uint8_t context_sz, uint16_t length, uint8_t *result) |
| EDHOC Key Derivation Function (KDF) based on HMAC-based Expand (RFC 5869). | |
| int16_t | edhoc_expand (const uint8_t *prk, const uint8_t *info, uint16_t info_sz, uint16_t length, uint8_t *result) |
| HMAC-based Key Expansion Function for EDHOC context using HKDF (RFC 5869). | |
| uint8_t | edhoc_initialize_context (edhoc_context_t *ctx) |
| Internal API functions. | |
| uint8_t | edhoc_get_own_auth_key (edhoc_context_t *ctx, cose_key_t **key) |
| Retrieve own authentication key from key storage. | |
| int8_t | edhoc_set_config_from_suite (edhoc_context_t *ctx, uint8_t suite) |
| Set EDHOC configuration parameters based on cipher suite. | |
| void | edhoc_print_session_info (const edhoc_context_t *ctx) |
| Print current EDHOC session information for debugging. | |
| int8_t | edhoc_generate_transcript_hash_2 (edhoc_context_t *ctx, const uint8_t *eph_pub, uint8_t *msg, uint16_t msg_sz) |
| Generate transcript hash TH_2. | |
| uint8_t | edhoc_generate_transcript_hash_3 (edhoc_context_t *ctx, const uint8_t *cred, uint16_t cred_sz, const uint8_t *plaintext, uint16_t plaintext_sz) |
| Generate transcript hash TH_3. | |
| uint8_t | edhoc_generate_transcript_hash_4 (edhoc_context_t *ctx, const uint8_t *cred, uint16_t cred_sz, const uint8_t *plaintext, uint16_t plaintext_sz) |
| Generate transcript hash TH_4. | |
| bool | edhoc_generate_prk_2e (edhoc_context_t *ctx) |
| Generate pseudorandom key PRK_2e. | |
| bool | edhoc_generate_prk_3e2m (edhoc_context_t *ctx, const ecc_key_t *auth_key, uint8_t gen) |
| Generate pseudorandom key PRK_3e2m. | |
| bool | edhoc_generate_prk_4e3m (edhoc_context_t *ctx, const ecc_key_t *auth_key, uint8_t gen) |
| Generate pseudorandom key PRK_4e3m. | |
| int16_t | edhoc_generate_keystream_2e (edhoc_context_t *ctx, uint16_t length, uint8_t *ks_2e) |
| Generate keystream KS_2e for encryption. | |
| int16_t | edhoc_enc_dec_ciphertext_2 (const edhoc_context_t *ctx, const uint8_t *ks_2e, uint8_t *plaintext, uint16_t plaintext_sz) |
| Encrypt/decrypt ciphertext 2 using XOR with keystream. | |
| size_t | edhoc_generate_cred_x (const cose_key_t *cose, uint8_t *cred, size_t cred_sz) |
| Generate CBOR-encoded credential CRED_X. | |
| size_t | edhoc_generate_id_cred_x (const cose_key_t *cose, uint8_t *cred, size_t cred_sz) |
| Generate credential identifier ID_CRED_X. | |
| uint8_t | edhoc_calc_mac (const edhoc_context_t *ctx, uint8_t mac_num, uint8_t mac_len, uint8_t *mac) |
| Calculate message authentication code (MAC). | |
| void | edhoc_print_config_summary (const edhoc_context_t *ctx) |
| Print EDHOC session configuration summary. | |
Variables | |
| edhoc_context_t * | edhoc_ctx |
| EDHOC context struct used in the EDHOC protocol. | |
This is an implementation of Ephemeral Diffie-Hellman Over COSE (EDHOC), a very compact and lightweight authenticated Diffie-Hellman key exchange with ephemeral keys that provides mutual authentication, perfect forward secrecy, and identity protection as described in RFC9528.
| int edhoc_authenticate_msg | ( | edhoc_context_t * | ctx, |
| uint8_t * | ad, | ||
| bool | msg2 ) |
Authenticate the rx message.
| ctx | EDHOC Context struct |
| ad | A pointer to a buffer to copy the Application Data of the rx message |
| msg2 | Determines whether the message is a Message 2 |
| negative | error code when an EDHOC ERROR is detected |
| ad_sz | The length of the Application Data received in Message 2, when EDHOC success |
Used by Initiator and Responder EDHOC role to Authenticate the other party
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 is returned.
Definition at line 867 of file edhoc.c.
References cbor_end_writer(), cbor_get_position(), cbor_get_remaining(), cbor_init_reader(), cbor_init_writer(), cbor_write_data(), cbor_write_object(), cose_sign1_verify(), edhoc_calc_mac(), EDHOC_ERR_CRYPTO_AUTHENTICATION, EDHOC_ERR_INTERNAL_ERROR, edhoc_generate_cred_x(), edhoc_generate_id_cred_x(), edhoc_generate_prk_3e2m(), edhoc_generate_prk_4e3m(), edhoc_generate_transcript_hash_4(), edhoc_get_ad(), edhoc_get_key_id_cred_x(), edhoc_get_sign(), EDHOC_MAX_AD_SZ, EDHOC_MAX_CRED_LEN, and edhoc_read_byte_identifier().
| uint8_t edhoc_calc_mac | ( | const edhoc_context_t * | ctx, |
| uint8_t | mac_num, | ||
| uint8_t | mac_len, | ||
| uint8_t * | mac ) |
Calculate message authentication code (MAC).
| ctx | EDHOC context |
| mac_num | MAC number (2 or 3) |
| mac_len | MAC length |
| mac | Output buffer for MAC |
Computes MAC_2 or MAC_3 for EDHOC message authentication
Definition at line 417 of file edhoc.c.
References cbor_end_writer(), cbor_init_writer(), cbor_write_data(), cbor_write_object(), edhoc_kdf(), EDHOC_MAX_CID_LEN, and EDHOC_ROLE.
Referenced by edhoc_authenticate_msg().
| int16_t edhoc_enc_dec_ciphertext_2 | ( | const edhoc_context_t * | ctx, |
| const uint8_t * | ks_2e, | ||
| uint8_t * | plaintext, | ||
| uint16_t | plaintext_sz ) |
Encrypt/decrypt ciphertext 2 using XOR with keystream.
| ctx | EDHOC context |
| ks_2e | Keystream for XOR operation |
| plaintext | Input/output buffer for plaintext/ciphertext |
| plaintext_sz | Buffer size |
Performs XOR encryption/decryption of EDHOC message 2 content
Definition at line 665 of file edhoc.c.
Referenced by edhoc_generate_message_2(), and edhoc_handler_msg_2().
| int16_t edhoc_expand | ( | const uint8_t * | prk, |
| const uint8_t * | info, | ||
| uint16_t | info_sz, | ||
| uint16_t | length, | ||
| uint8_t * | result ) |
HMAC-based Key Expansion Function for EDHOC context using HKDF (RFC 5869).
| prk | PRK (Pseudorandom Key) - a pseudorandom key used as input for the HMAC-based key derivation. |
| info | Additional context information used in the key derivation, which is generated from the info_label and context. |
| info_sz | The size of the info parameter in bytes. |
| length | The desired length of the output key material (OKM) in bytes. |
| result | OKM (Output Keying Material) - the buffer where the derived key will be stored. |
length).This function implements the HKDF-Expand function as described in RFC 5869. It takes the PRK, context info, and the desired length to produce the final key material. It calls hkdf_expand internally to perform the HMAC-based key expansion using SHA-256.
The steps include:
Example usage:
Definition at line 406 of file edhoc.c.
References sha_256_hkdf_expand().
Referenced by edhoc_kdf().
| void edhoc_finalize | ( | edhoc_context_t * | ctx | ) |
Close the EDHOC context.
| ctx | EDHOC context struct |
Used by both Initiator and Responder EDHOC roles to de-allocate the memory reserved for the EDHOC context when EDHOC protocol finalize.
Definition at line 83 of file edhoc.c.
References memb_free().
Referenced by edhoc_client_close(), and edhoc_server_close().
| size_t edhoc_generate_cred_x | ( | const cose_key_t * | cose, |
| uint8_t * | cred, | ||
| size_t | cred_sz ) |
Generate CBOR-encoded credential CRED_X.
| cose | COSE key containing credential information |
| cred | Output buffer for credential |
| cred_sz | Output buffer size |
Generates CBOR credential structure from COSE key
Definition at line 210 of file edhoc.c.
References cbor_close_map(), cbor_end_writer(), cbor_init_writer(), cbor_open_map(), cbor_write_data(), cbor_write_signed(), cbor_write_text(), and cbor_write_unsigned().
Referenced by edhoc_authenticate_msg(), edhoc_generate_id_cred_x(), edhoc_generate_message_2(), and edhoc_generate_message_3().
| uint8_t edhoc_generate_error_message | ( | uint8_t * | msg_er, |
| size_t | msg_er_sz, | ||
| const edhoc_context_t * | ctx, | ||
| int8_t | err ) |
Generate the EDHOC ERROR Message.
| msg_er | A pointer to a buffer to copy the generated CBOR message error |
| msg_er_sz | The size of the destination buffer |
| ctx | EDHOC Context struct |
| err | EDHOC error number |
An EDHOC error message can be sent by both parties as a reply to any non-error EDHOC message. If any verification step fails on the EDHOC protocol the Initiator or Responder must send an EDHOC error message back that contains a brief human-readable diagnostic message.
Definition at line 784 of file edhoc.c.
References EDHOC_ERR_BUFFER_OVERFLOW, EDHOC_ERR_CID_INVALID, EDHOC_ERR_CORRELATION, EDHOC_ERR_CREDENTIAL_NOT_FOUND, EDHOC_ERR_CRITICAL_EAD_UNSUPPORTED, EDHOC_ERR_CRYPTO_AUTHENTICATION, EDHOC_ERR_CRYPTO_DECRYPT, EDHOC_ERR_ID_CRED_MALFORMED, EDHOC_ERR_INTERNAL_ERROR, EDHOC_ERR_KEY_NOT_FOUND, EDHOC_ERR_METHOD_NOT_SUPPORTED, EDHOC_ERR_MSG_MALFORMED, EDHOC_ERR_NETWORK_TIMEOUT, EDHOC_ERR_NOT_ALLOWED_IDENTITY, EDHOC_ERR_SEQUENCE_ERROR, EDHOC_ERR_SUITE_NOT_SUPPORTED, EDHOC_ERR_WRONG_CID, and edhoc_serialize_err().
| size_t edhoc_generate_id_cred_x | ( | const cose_key_t * | cose, |
| uint8_t * | cred, | ||
| size_t | cred_sz ) |
Generate credential identifier ID_CRED_X.
| cose | COSE key containing credential information |
| cred | Output buffer for credential ID |
| cred_sz | Output buffer size |
Generates credential identifier (KID or full credential)
Definition at line 242 of file edhoc.c.
References cbor_close_map(), cbor_end_writer(), cbor_init_writer(), cbor_open_map(), cbor_write_data(), cbor_write_unsigned(), EDHOC_AUTHENT_TYPE, and edhoc_generate_cred_x().
Referenced by edhoc_authenticate_msg(), edhoc_generate_message_2(), and edhoc_generate_message_3().
| int16_t edhoc_generate_keystream_2e | ( | edhoc_context_t * | ctx, |
| uint16_t | length, | ||
| uint8_t * | ks_2e ) |
Generate keystream KS_2e for encryption.
| ctx | EDHOC context |
| length | Keystream length |
| ks_2e | Output keystream buffer |
Derives keystream for encrypting/decrypting EDHOC message 2
Definition at line 561 of file edhoc.c.
References EDHOC_DBG_VALUE, and edhoc_kdf().
Referenced by edhoc_generate_message_2(), and edhoc_handler_msg_2().
| 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.
| ctx | EDHOC Context struct |
| ad | Application data to include in MSG1 |
| ad_sz | Application data length |
| suite_array | If 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. |
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.
Definition at line 199 of file edhoc-msg-generators.c.
References EDHOC_ERR_NULL_POINTER, EDHOC_ERR_SUITE_NOT_SUPPORTED, and EDHOC_SUITES_MAX_COUNT.
| 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.
| ctx | EDHOC Context struct |
| auth_data | Application data to include in MSG2 |
| auth_data_size | Application data length |
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.
Definition at line 258 of file edhoc-msg-generators.c.
References cbor_close_data(), cbor_end_writer(), cbor_init_writer(), cbor_open_data(), cbor_write_data(), cbor_write_object(), cose_sign1_sign(), edhoc_enc_dec_ciphertext_2(), EDHOC_ERR_CBOR_ENCODING, EDHOC_ERR_CRYPTO_HASH, EDHOC_ERR_CRYPTO_SIGN, EDHOC_ERR_NULL_POINTER, edhoc_generate_cred_x(), edhoc_generate_id_cred_x(), edhoc_generate_keystream_2e(), edhoc_generate_prk_2e(), edhoc_generate_prk_3e2m(), edhoc_generate_transcript_hash_2(), EDHOC_MAC_OR_SIG_BUF_LEN, EDHOC_MAX_CRED_LEN, and edhoc_print_credential().
| 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.
| ctx | EDHOC Context struct |
| auth_data | Application data to include in MSG3 |
| auth_data_size | Application data length |
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.
Definition at line 406 of file edhoc-msg-generators.c.
References cbor_end_writer(), cbor_init_writer(), cbor_write_data(), cbor_write_object(), cose_print_key(), cose_sign1_sign(), EDHOC_ERR_BUFFER_TOO_SMALL, EDHOC_ERR_CRYPTO_ENCRYPT, EDHOC_ERR_CRYPTO_SIGN, EDHOC_ERR_NULL_POINTER, edhoc_generate_cred_x(), edhoc_generate_id_cred_x(), edhoc_generate_prk_4e3m(), edhoc_generate_transcript_hash_3(), edhoc_generate_transcript_hash_4(), EDHOC_MAC_OR_SIG_BUF_LEN, EDHOC_MAX_CRED_LEN, and edhoc_print_credential().
| bool edhoc_generate_prk_2e | ( | edhoc_context_t * | ctx | ) |
Generate pseudorandom key PRK_2e.
| ctx | EDHOC context |
Generates PRK_2e using ECDH shared secret and TH_2
Definition at line 542 of file edhoc.c.
References ecdh_generate_ikm(), EDHOC_DBG_VALUE, and edhoc_trace_prk_derivation().
Referenced by edhoc_generate_message_2(), and edhoc_handler_msg_2().
| bool edhoc_generate_prk_3e2m | ( | edhoc_context_t * | ctx, |
| const ecc_key_t * | auth_key, | ||
| uint8_t | gen ) |
Generate pseudorandom key PRK_3e2m.
| ctx | EDHOC context |
| auth_key | Authentication key |
| gen | Key generation mode |
Generates PRK_3e2m using authentication key and ephemeral key
Referenced by edhoc_authenticate_msg(), and edhoc_generate_message_2().
| bool edhoc_generate_prk_4e3m | ( | edhoc_context_t * | ctx, |
| const ecc_key_t * | auth_key, | ||
| uint8_t | gen ) |
Generate pseudorandom key PRK_4e3m.
| ctx | EDHOC context |
| auth_key | Authentication key |
| gen | Key generation mode |
Generates PRK_4e3m using authentication key and ephemeral key
Referenced by edhoc_authenticate_msg(), and edhoc_generate_message_3().
| int8_t edhoc_generate_transcript_hash_2 | ( | edhoc_context_t * | ctx, |
| const uint8_t * | eph_pub, | ||
| uint8_t * | msg, | ||
| uint16_t | msg_sz ) |
Generate transcript hash TH_2.
| ctx | EDHOC context |
| eph_pub | Ephemeral public key |
| msg | Message 1 buffer |
| msg_sz | Message 1 size |
Computes TH_2 = H(G_Y, H(message_1)) for EDHOC protocol
Definition at line 279 of file edhoc.c.
References cbor_end_writer(), cbor_init_writer(), cbor_write_data(), EDHOC_DBG_VALUE, edhoc_trace_transcript_hash(), and EDHOC_TRACE_VALUE.
Referenced by edhoc_generate_message_2(), and edhoc_handler_msg_2().
| uint8_t edhoc_generate_transcript_hash_3 | ( | edhoc_context_t * | ctx, |
| const uint8_t * | cred, | ||
| uint16_t | cred_sz, | ||
| const uint8_t * | plaintext, | ||
| uint16_t | plaintext_sz ) |
Generate transcript hash TH_3.
| ctx | EDHOC context |
| cred | Credential data |
| cred_sz | Credential size |
| plaintext | Plaintext data |
| plaintext_sz | Plaintext size |
Computes TH_3 = H(TH_2, PLAINTEXT_2, CRED_R) for EDHOC protocol
Definition at line 306 of file edhoc.c.
References cbor_end_writer(), cbor_init_writer(), cbor_write_data(), cbor_write_object(), EDHOC_DBG_VALUE, EDHOC_MAX_BUFFER, edhoc_trace_transcript_hash(), and EDHOC_TRACE_VALUE.
Referenced by edhoc_generate_message_3(), and edhoc_handler_msg_3().
| uint8_t edhoc_generate_transcript_hash_4 | ( | edhoc_context_t * | ctx, |
| const uint8_t * | cred, | ||
| uint16_t | cred_sz, | ||
| const uint8_t * | plaintext, | ||
| uint16_t | plaintext_sz ) |
Generate transcript hash TH_4.
| ctx | EDHOC context |
| cred | Credential data |
| cred_sz | Credential size |
| plaintext | Plaintext data |
| plaintext_sz | Plaintext size |
Computes TH_4 = H(TH_3, PLAINTEXT_3, CRED_I) for EDHOC protocol
Definition at line 335 of file edhoc.c.
References cbor_end_writer(), cbor_init_writer(), cbor_write_data(), cbor_write_object(), EDHOC_DBG_VALUE, EDHOC_MAX_BUFFER, edhoc_trace_transcript_hash(), and EDHOC_TRACE_VALUE.
Referenced by edhoc_authenticate_msg(), and edhoc_generate_message_3().
| uint8_t edhoc_get_own_auth_key | ( | edhoc_context_t * | ctx, |
| cose_key_t ** | key ) |
Retrieve own authentication key from key storage.
| ctx | EDHOC context |
| key | Pointer to store the found authentication key |
Searches for authentication key using subject name or key ID
Definition at line 743 of file edhoc.c.
References edhoc_check_key_list_identity(), and edhoc_check_key_list_kid().
Referenced by edhoc_initialize_context().
| uint8_t edhoc_initialize_context | ( | edhoc_context_t * | ctx | ) |
Internal API functions.
Initialize the EDHOC context with default parameters
| ctx | EDHOC context to initialize |
Sets up cipher suites, authentication keys, connection ID, role, and method
Definition at line 688 of file edhoc.c.
References EDHOC_CID, EDHOC_DEFAULT_CID_LEN, edhoc_get_own_auth_key(), EDHOC_MAX_CID_LEN, EDHOC_METHOD, EDHOC_ROLE, edhoc_set_config_from_suite(), and edhoc_setup_suites().
Referenced by edhoc_server_reset_handshake().
| int16_t edhoc_kdf | ( | const uint8_t * | prk, |
| uint8_t | info_label, | ||
| const uint8_t * | context, | ||
| uint8_t | context_sz, | ||
| uint16_t | length, | ||
| uint8_t * | result ) |
EDHOC Key Derivation Function (KDF) based on HMAC-based Expand (RFC 5869).
| result | OKM (Output Keying Material) - the buffer where the derived key will be stored. |
| prk | PRK (Pseudorandom Key) - a pseudorandom key used as input to the key derivation, should be at least HASH_LEN bytes. |
| info_label | Label used to generate the CBOR-based info input for key derivation. |
| context | Context data used to generate the info input for key derivation. |
| context_sz | The size of the Context data. |
| length | Desired length of the output key material (OKM) in bytes. |
length) on success, or 0 on failure.This function combines the PRK, info_label, and context to generate an input info parameter that is used for HKDF-Expand as defined in RFC 5869. It is used by both the Initiator and Responder in the EDHOC protocol to generate keying material. Internally, this function calls edhoc_expand to compute the final OKM.
The function performs the following steps:
Example usage:
Definition at line 373 of file edhoc.c.
References edhoc_expand().
Referenced by edhoc_calc_mac(), edhoc_exporter(), edhoc_exporter_oscore(), and edhoc_generate_keystream_2e().
| void edhoc_print_config_summary | ( | const edhoc_context_t * | ctx | ) |
| void edhoc_print_session_info | ( | const edhoc_context_t * | ctx | ) |
Print current EDHOC session information for debugging.
| ctx | EDHOC context |
Logs session details including role, method, cipher suite, and connection IDs
Definition at line 366 of file edhoc.c.
References edhoc_trace_session_summary().
Referenced by edhoc_handler_msg_1().
| int8_t edhoc_set_config_from_suite | ( | edhoc_context_t * | ctx, |
| uint8_t | suite ) |
Set EDHOC configuration parameters based on cipher suite.
| ctx | EDHOC context |
| suite | Selected cipher suite |
Configures ECDH curve, MAC length, AEAD algorithm, and signature algorithm
Definition at line 188 of file edhoc.c.
Referenced by edhoc_initialize_context().
| uint8_t edhoc_setup_suites | ( | edhoc_context_t * | ctx | ) |
Initialize the EDHOC Context with the defined EDHOC parameters.
| ctx | An EDHOC context struct to fill in |
Used in the edhoc_new to set the default protocol definitions and in the Responder to reset the initial values to prepare for a new EDHOC connection. Sets up the cipher suites selection logic and validates that at least one cipher suite is supported.
Definition at line 89 of file edhoc.c.
References EDHOC_ERR_SUITE_NOT_SUPPORTED, and EDHOC_SUPPORTED_SUITE_1.
Referenced by edhoc_initialize_context(), and edhoc_server_reset_handshake().
| void edhoc_storage_init | ( | void | ) |
Reserve memory for the EDHOC context struct.
Used by both Initiator and Responder EDHOC roles to reserve memory
Definition at line 67 of file edhoc.c.
References memb_init().