Mbed OS Reference
Loading...
Searching...
No Matches
ecdh.h File Reference

This file contains ECDH definitions and functions. More...

#include "mbedtls/config.h"
#include "mbedtls/ecp.h"

Go to the source code of this file.

Data Structures

struct  mbedtls_ecdh_context_mbed
 The context used by the default ECDH implementation. More...
 
struct  mbedtls_ecdh_context
 The ECDH context structure. More...
 

Typedefs

typedef struct mbedtls_ecdh_context_mbed mbedtls_ecdh_context_mbed
 The context used by the default ECDH implementation. More...
 
typedef struct mbedtls_ecdh_context mbedtls_ecdh_context
 The ECDH context structure. More...
 

Enumerations

enum  mbedtls_ecdh_side { MBEDTLS_ECDH_OURS , MBEDTLS_ECDH_THEIRS }
 Defines the source of the imported EC key. More...
 
enum  mbedtls_ecdh_variant { MBEDTLS_ECDH_VARIANT_NONE = 0 , MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0 }
 Defines the ECDH implementation used. More...
 

Functions

int mbedtls_ecdh_can_do (mbedtls_ecp_group_id gid)
 Check whether a given group can be used for ECDH. More...
 
int mbedtls_ecdh_gen_public (mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 This function generates an ECDH keypair on an elliptic curve. More...
 
int mbedtls_ecdh_compute_shared (mbedtls_ecp_group *grp, mbedtls_mpi *z, const mbedtls_ecp_point *Q, const mbedtls_mpi *d, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 This function computes the shared secret. More...
 
void mbedtls_ecdh_init (mbedtls_ecdh_context *ctx)
 This function initializes an ECDH context. More...
 
int mbedtls_ecdh_setup (mbedtls_ecdh_context *ctx, mbedtls_ecp_group_id grp_id)
 This function sets up the ECDH context with the information given. More...
 
void mbedtls_ecdh_free (mbedtls_ecdh_context *ctx)
 This function frees a context. More...
 
int mbedtls_ecdh_make_params (mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 This function generates an EC key pair and exports its in the format used in a TLS ServerKeyExchange handshake message. More...
 
int mbedtls_ecdh_read_params (mbedtls_ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
 This function parses the ECDHE parameters in a TLS ServerKeyExchange handshake message. More...
 
int mbedtls_ecdh_get_params (mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key, mbedtls_ecdh_side side)
 This function sets up an ECDH context from an EC key. More...
 
int mbedtls_ecdh_make_public (mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 This function generates a public key and exports it as a TLS ClientKeyExchange payload. More...
 
int mbedtls_ecdh_read_public (mbedtls_ecdh_context *ctx, const unsigned char *buf, size_t blen)
 This function parses and processes the ECDHE payload of a TLS ClientKeyExchange message. More...
 
int mbedtls_ecdh_calc_secret (mbedtls_ecdh_context *ctx, size_t *olen, unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
 This function derives and exports the shared secret. More...
 

Detailed Description

This file contains ECDH definitions and functions.

The Elliptic Curve Diffie-Hellman (ECDH) protocol is an anonymous key agreement protocol allowing two parties to establish a shared secret over an insecure channel. Each party must have an elliptic-curve public–private key pair.

For more information, see NIST SP 800-56A Rev. 2: Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryptography.

Definition in file ecdh.h.