![]() |
Contiki-NG
|
ECDH interface for the EDHOC implementation. More...
Go to the source code of this file.
Functions | |
| bool | ecdh_generate_keypair (uint8_t curve_id, uint8_t *pub_x, uint8_t *pub_y, uint8_t *priv) |
| Generates a fresh ECDH key pair. | |
| bool | ecdh_generate_ikm (uint8_t curve_id, const uint8_t *peer_x, const uint8_t *private_key, uint8_t *ikm) |
| Computes an ECDH shared secret. | |
| bool | ecc_sign_hash (uint8_t curve_id, const uint8_t *hash, const uint8_t *private_key, uint8_t *signature) |
| Generates an ECDSA signature for a message hash. | |
| bool | ecc_verify_hash (uint8_t curve_id, const uint8_t *hash, const uint8_t *public_key, const uint8_t *signature) |
| Verifies an ECDSA signature of a message hash. | |
ECDH interface for the EDHOC implementation.
Thin synchronous wrapper around the Contiki-NG ECC driver (lib/ecc.h). Long-running operations from the underlying driver are busy-waited to completion so that the EDHOC protocol code can stay synchronous.
Definition in file ecdh.h.
| bool ecc_sign_hash | ( | uint8_t | curve_id, |
| const uint8_t * | hash, | ||
| const uint8_t * | private_key, | ||
| uint8_t * | signature ) |
Generates an ECDSA signature for a message hash.
| curve_id | The EDHOC curve identifier (e.g. EDHOC_CURVE_P256). |
| hash | The message hash (ECC_KEY_LEN bytes). |
| private_key | The signer's private key (ECC_KEY_LEN bytes). |
| signature | Output buffer for the signature (2*ECC_KEY_LEN bytes). |
Definition at line 174 of file ecdh.c.
References ecc_disable(), ecc_get_protothread(), ecc_sign(), PT_INIT, PT_SCHEDULE, and watchdog_periodic().
Referenced by cose_sign1_sign().
| bool ecc_verify_hash | ( | uint8_t | curve_id, |
| const uint8_t * | hash, | ||
| const uint8_t * | public_key, | ||
| const uint8_t * | signature ) |
Verifies an ECDSA signature of a message hash.
| curve_id | The EDHOC curve identifier (e.g. EDHOC_CURVE_P256). |
| hash | The message hash (ECC_KEY_LEN bytes). |
| public_key | The signer's public key (2*ECC_KEY_LEN bytes). |
| signature | The signature to verify (2*ECC_KEY_LEN bytes). |
Definition at line 203 of file ecdh.c.
References ecc_disable(), ecc_get_protothread(), ecc_verify(), PT_INIT, PT_SCHEDULE, and watchdog_periodic().
Referenced by cose_sign1_verify().
| bool ecdh_generate_ikm | ( | uint8_t | curve_id, |
| const uint8_t * | peer_x, | ||
| const uint8_t * | private_key, | ||
| uint8_t * | ikm ) |
Computes an ECDH shared secret.
| curve_id | The EDHOC curve identifier (e.g. EDHOC_CURVE_P256). |
| peer_x | The peer's public-key x-coordinate (ECC_KEY_LEN bytes). The y-coordinate is recovered from peer_x using point decompression (odd-y branch), so EDHOC's x-only on-wire encoding can be passed in directly. |
| private_key | Our private key (ECC_KEY_LEN bytes). |
| ikm | Output buffer for the shared secret (ECC_KEY_LEN bytes). |
Definition at line 123 of file ecdh.c.
References ecc_decompress_public_key(), ecc_disable(), ecc_generate_shared_secret(), ecc_get_protothread(), PT_INIT, PT_SCHEDULE, and watchdog_periodic().
Referenced by edhoc_generate_prk_2e().
| bool ecdh_generate_keypair | ( | uint8_t | curve_id, |
| uint8_t * | pub_x, | ||
| uint8_t * | pub_y, | ||
| uint8_t * | priv ) |
Generates a fresh ECDH key pair.
| curve_id | The EDHOC curve identifier (e.g. EDHOC_CURVE_P256). |
| pub_x | Output buffer for the x-coordinate (ECC_KEY_LEN bytes). |
| pub_y | Output buffer for the y-coordinate (ECC_KEY_LEN bytes). |
| priv | Output buffer for the private key (ECC_KEY_LEN bytes). |
Definition at line 91 of file ecdh.c.
References ecc_disable(), ecc_generate_key_pair(), ecc_get_protothread(), PT_INIT, PT_SCHEDULE, and watchdog_periodic().