mbed TLS v2.9.0
ecdh.h
Go to the documentation of this file.
1 
15 /*
16  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
17  * SPDX-License-Identifier: Apache-2.0
18  *
19  * Licensed under the Apache License, Version 2.0 (the "License"); you may
20  * not use this file except in compliance with the License.
21  * You may obtain a copy of the License at
22  *
23  * http://www.apache.org/licenses/LICENSE-2.0
24  *
25  * Unless required by applicable law or agreed to in writing, software
26  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28  * See the License for the specific language governing permissions and
29  * limitations under the License.
30  *
31  * This file is part of Mbed TLS (https://tls.mbed.org)
32  */
33 
34 #ifndef MBEDTLS_ECDH_H
35 #define MBEDTLS_ECDH_H
36 
37 #include "ecp.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
46 typedef enum
47 {
51 
55 typedef struct
56 {
66 }
68 
91  int (*f_rng)(void *, unsigned char *, size_t),
92  void *p_rng );
93 
119  const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
120  int (*f_rng)(void *, unsigned char *, size_t),
121  void *p_rng );
122 
129 
136 
160 int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
161  unsigned char *buf, size_t blen,
162  int (*f_rng)(void *, unsigned char *, size_t),
163  void *p_rng );
164 
183  const unsigned char **buf, const unsigned char *end );
184 
204  mbedtls_ecdh_side side );
205 
225 int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
226  unsigned char *buf, size_t blen,
227  int (*f_rng)(void *, unsigned char *, size_t),
228  void *p_rng );
229 
247  const unsigned char *buf, size_t blen );
248 
271 int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
272  unsigned char *buf, size_t blen,
273  int (*f_rng)(void *, unsigned char *, size_t),
274  void *p_rng );
275 
276 #ifdef __cplusplus
277 }
278 #endif
279 
280 #endif /* ecdh.h */
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 a public key and a TLS ServerKeyExchange payload.
mbedtls_mpi z
Definition: ecdh.h:61
This file provides an API for Elliptic Curves over GF(P) (ECP).
mbedtls_mpi d
Definition: ecdh.h:58
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 a TLS ClientKeyExchange payload.
The ECP key-pair structure.
Definition: ecp.h:254
void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx)
This function frees a context.
mbedtls_mpi _d
Definition: ecdh.h:65
int mbedtls_ecdh_read_public(mbedtls_ecdh_context *ctx, const unsigned char *buf, size_t blen)
This function parses and processes a TLS ClientKeyExchange payload.
The ECP group structure.
Definition: ecp.h:159
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.
mbedtls_ecp_point Vi
Definition: ecdh.h:63
mbedtls_ecp_group grp
Definition: ecdh.h:57
void mbedtls_ecdh_init(mbedtls_ecdh_context *ctx)
This function initializes an ECDH context.
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.
mbedtls_ecdh_side
Definition: ecdh.h:46
int mbedtls_ecdh_read_params(mbedtls_ecdh_context *ctx, const unsigned char **buf, const unsigned char *end)
This function parses and processes a TLS ServerKeyExhange payload.
The ECDH context structure.
Definition: ecdh.h:55
mbedtls_ecp_point Qp
Definition: ecdh.h:60
mbedtls_ecp_point Q
Definition: ecdh.h:59
mbedtls_ecp_point Vf
Definition: ecdh.h:64
MPI structure.
Definition: bignum.h:180
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.
The ECP point structure, in Jacobian coordinates.
Definition: ecp.h:114
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.