Manuel Pégourié-Gonnard | 0bad5c2 | 2013-01-26 15:30:46 +0100 | [diff] [blame] | 1 | /** |
| 2 | * \file ecdh.h |
| 3 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 4 | * \brief The Elliptic Curve Diffie-Hellman (ECDH) protocol APIs. |
| 5 | * |
| 6 | * ECDH is an anonymous key agreement protocol allowing two parties to |
| 7 | * establish a shared secret over an insecure channel. Each party must have an |
| 8 | * elliptic-curve public–private key pair. |
| 9 | * |
| 10 | * For more information, see <em>NIST SP 800-56A Rev. 2: Recommendation for |
| 11 | * Pair-Wise Key Establishment Schemes Using Discrete Logarithm |
| 12 | * Cryptography</em>. |
Darryl Green | a40a101 | 2018-01-05 15:33:17 +0000 | [diff] [blame] | 13 | */ |
| 14 | /* |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 15 | * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved |
Manuel Pégourié-Gonnard | 37ff140 | 2015-09-04 14:21:07 +0200 | [diff] [blame] | 16 | * SPDX-License-Identifier: Apache-2.0 |
| 17 | * |
| 18 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 19 | * not use this file except in compliance with the License. |
| 20 | * You may obtain a copy of the License at |
| 21 | * |
| 22 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 23 | * |
| 24 | * Unless required by applicable law or agreed to in writing, software |
| 25 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 27 | * See the License for the specific language governing permissions and |
| 28 | * limitations under the License. |
Manuel Pégourié-Gonnard | 0bad5c2 | 2013-01-26 15:30:46 +0100 | [diff] [blame] | 29 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 30 | * This file is part of Mbed TLS (https://tls.mbed.org) |
Manuel Pégourié-Gonnard | 0bad5c2 | 2013-01-26 15:30:46 +0100 | [diff] [blame] | 31 | */ |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 32 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 33 | #ifndef MBEDTLS_ECDH_H |
| 34 | #define MBEDTLS_ECDH_H |
Manuel Pégourié-Gonnard | 0bad5c2 | 2013-01-26 15:30:46 +0100 | [diff] [blame] | 35 | |
Manuel Pégourié-Gonnard | bdc9676 | 2013-10-03 11:50:39 +0200 | [diff] [blame] | 36 | #include "ecp.h" |
Manuel Pégourié-Gonnard | 0bad5c2 | 2013-01-26 15:30:46 +0100 | [diff] [blame] | 37 | |
Paul Bakker | 407a0da | 2013-06-27 14:29:21 +0200 | [diff] [blame] | 38 | #ifdef __cplusplus |
| 39 | extern "C" { |
| 40 | #endif |
| 41 | |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 42 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 43 | * Defines the source of the imported EC key: |
| 44 | * <ul><li>Our key.</li> |
| 45 | * <li>The key of the peer.</li></ul> |
Manuel Pégourié-Gonnard | cdff3cf | 2013-12-12 09:55:52 +0100 | [diff] [blame] | 46 | */ |
| 47 | typedef enum |
| 48 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 49 | MBEDTLS_ECDH_OURS, |
| 50 | MBEDTLS_ECDH_THEIRS, |
| 51 | } mbedtls_ecdh_side; |
Manuel Pégourié-Gonnard | cdff3cf | 2013-12-12 09:55:52 +0100 | [diff] [blame] | 52 | |
| 53 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 54 | * \brief The ECDH context structure. |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 55 | */ |
| 56 | typedef struct |
| 57 | { |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 58 | mbedtls_ecp_group grp; /*!< The elliptic curve used. */ |
| 59 | mbedtls_mpi d; /*!< The private key. */ |
| 60 | mbedtls_ecp_point Q; /*!< The public key. */ |
| 61 | mbedtls_ecp_point Qp; /*!< The value of the public key of the peer. */ |
| 62 | mbedtls_mpi z; /*!< The shared secret. */ |
| 63 | int point_format; /*!< The format of point export in TLS messages. */ |
| 64 | mbedtls_ecp_point Vi; /*!< The blinding value. */ |
| 65 | mbedtls_ecp_point Vf; /*!< The unblinding value. */ |
| 66 | mbedtls_mpi _d; /*!< The previous \p d. */ |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 67 | } |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 68 | mbedtls_ecdh_context; |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 69 | |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 70 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 71 | * \brief This function generates an ECDH keypair on an elliptic |
| 72 | * curve. |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 73 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 74 | * This function performs the first of two core computations |
| 75 | * implemented during the ECDH key exchange. The second core |
| 76 | * computation is performed by mbedtls_ecdh_compute_shared(). |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 77 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 78 | * \param grp The ECP group. |
| 79 | * \param d The destination MPI (private key). |
| 80 | * \param Q The destination point (public key). |
| 81 | * \param f_rng The RNG function. |
| 82 | * \param p_rng The RNG parameter. |
| 83 | * |
| 84 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX or |
| 85 | * \c MBEDTLS_MPI_XXX error code on failure. |
| 86 | * |
| 87 | * \see ecp.h |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 88 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 89 | int mbedtls_ecdh_gen_public( mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 90 | int (*f_rng)(void *, unsigned char *, size_t), |
| 91 | void *p_rng ); |
| 92 | |
| 93 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 94 | * \brief This function computes the shared secret. |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 95 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 96 | * This function performs the second of two core computations |
| 97 | * implemented during the ECDH key exchange. The first core |
| 98 | * computation is performed by mbedtls_ecdh_gen_public(). |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 99 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 100 | * \param grp The ECP group. |
| 101 | * \param z The destination MPI (shared secret). |
| 102 | * \param Q The public key from another party. |
| 103 | * \param d Our secret exponent (private key). |
| 104 | * \param f_rng The RNG function. |
| 105 | * \param p_rng The RNG parameter. |
Manuel Pégourié-Gonnard | e09d2f8 | 2013-09-02 14:29:09 +0200 | [diff] [blame] | 106 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 107 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX or |
| 108 | * \c MBEDTLS_MPI_XXX error code on failure. |
| 109 | * |
| 110 | * \see ecp.h |
| 111 | * |
| 112 | * \note If \p f_rng is not NULL, it is used to implement |
Manuel Pégourié-Gonnard | e09d2f8 | 2013-09-02 14:29:09 +0200 | [diff] [blame] | 113 | * countermeasures against potential elaborate timing |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 114 | * attacks. For more information, see mbedtls_ecp_mul(). |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 115 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 116 | int mbedtls_ecdh_compute_shared( mbedtls_ecp_group *grp, mbedtls_mpi *z, |
| 117 | const mbedtls_ecp_point *Q, const mbedtls_mpi *d, |
Manuel Pégourié-Gonnard | e09d2f8 | 2013-09-02 14:29:09 +0200 | [diff] [blame] | 118 | int (*f_rng)(void *, unsigned char *, size_t), |
| 119 | void *p_rng ); |
Manuel Pégourié-Gonnard | 0bad5c2 | 2013-01-26 15:30:46 +0100 | [diff] [blame] | 120 | |
| 121 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 122 | * \brief This function initializes an ECDH context. |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 123 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 124 | * \param ctx The ECDH context to initialize. |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 125 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 126 | void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx ); |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 127 | |
| 128 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 129 | * \brief This function frees a context. |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 130 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 131 | * \param ctx The context to free. |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 132 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 133 | void mbedtls_ecdh_free( mbedtls_ecdh_context *ctx ); |
Manuel Pégourié-Gonnard | 63533e4 | 2013-02-10 14:21:04 +0100 | [diff] [blame] | 134 | |
| 135 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 136 | * \brief This function generates a public key and a TLS |
| 137 | * ServerKeyExchange payload. |
Manuel Pégourié-Gonnard | 1372476 | 2013-02-10 15:01:54 +0100 | [diff] [blame] | 138 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 139 | * This is the first function used by a TLS server for ECDHE |
| 140 | * ciphersuites. |
Manuel Pégourié-Gonnard | 1372476 | 2013-02-10 15:01:54 +0100 | [diff] [blame] | 141 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 142 | * \param ctx The ECDH context. |
| 143 | * \param olen The number of characters written. |
| 144 | * \param buf The destination buffer. |
| 145 | * \param blen The length of the destination buffer. |
| 146 | * \param f_rng The RNG function. |
| 147 | * \param p_rng The RNG parameter. |
Manuel Pégourié-Gonnard | 1372476 | 2013-02-10 15:01:54 +0100 | [diff] [blame] | 148 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 149 | * \note This function assumes that the ECP group (grp) of the |
| 150 | * \p ctx context has already been properly set, |
| 151 | * for example, using mbedtls_ecp_group_load(). |
| 152 | * |
| 153 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX error code |
| 154 | * on failure. |
| 155 | * |
| 156 | * \see ecp.h |
Manuel Pégourié-Gonnard | 1372476 | 2013-02-10 15:01:54 +0100 | [diff] [blame] | 157 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 158 | int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen, |
Manuel Pégourié-Gonnard | 854fbd7 | 2013-02-11 20:28:55 +0100 | [diff] [blame] | 159 | unsigned char *buf, size_t blen, |
| 160 | int (*f_rng)(void *, unsigned char *, size_t), |
| 161 | void *p_rng ); |
| 162 | |
| 163 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 164 | * \brief This function parses and processes a TLS ServerKeyExhange |
| 165 | * payload. |
Manuel Pégourié-Gonnard | 854fbd7 | 2013-02-11 20:28:55 +0100 | [diff] [blame] | 166 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 167 | * This is the first function used by a TLS client for ECDHE |
| 168 | * ciphersuites. |
Manuel Pégourié-Gonnard | 854fbd7 | 2013-02-11 20:28:55 +0100 | [diff] [blame] | 169 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 170 | * \param ctx The ECDH context. |
| 171 | * \param buf The pointer to the start of the input buffer. |
| 172 | * \param end The address for one Byte past the end of the buffer. |
| 173 | * |
| 174 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX error code |
| 175 | * on failure. |
| 176 | * |
| 177 | * \see ecp.h |
Manuel Pégourié-Gonnard | 854fbd7 | 2013-02-11 20:28:55 +0100 | [diff] [blame] | 178 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 179 | int mbedtls_ecdh_read_params( mbedtls_ecdh_context *ctx, |
Manuel Pégourié-Gonnard | 854fbd7 | 2013-02-11 20:28:55 +0100 | [diff] [blame] | 180 | const unsigned char **buf, const unsigned char *end ); |
Manuel Pégourié-Gonnard | 1372476 | 2013-02-10 15:01:54 +0100 | [diff] [blame] | 181 | |
| 182 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 183 | * \brief This function sets up an ECDH context from an EC key. |
Manuel Pégourié-Gonnard | cdff3cf | 2013-12-12 09:55:52 +0100 | [diff] [blame] | 184 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 185 | * It is used by clients and servers in place of the |
| 186 | * ServerKeyEchange for static ECDH, and imports ECDH |
| 187 | * parameters from the EC key information of a certificate. |
Manuel Pégourié-Gonnard | cdff3cf | 2013-12-12 09:55:52 +0100 | [diff] [blame] | 188 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 189 | * \param ctx The ECDH context to set up. |
| 190 | * \param key The EC key to use. |
| 191 | * \param side Defines the source of the key: |
| 192 | * <ul><li>1: Our key.</li> |
| 193 | <li>0: The key of the peer.</li></ul> |
| 194 | * |
| 195 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX error code |
| 196 | * on failure. |
| 197 | * |
| 198 | * \see ecp.h |
Manuel Pégourié-Gonnard | cdff3cf | 2013-12-12 09:55:52 +0100 | [diff] [blame] | 199 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 200 | int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx, const mbedtls_ecp_keypair *key, |
| 201 | mbedtls_ecdh_side side ); |
Manuel Pégourié-Gonnard | cdff3cf | 2013-12-12 09:55:52 +0100 | [diff] [blame] | 202 | |
| 203 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 204 | * \brief This function generates a public key and a TLS |
| 205 | * ClientKeyExchange payload. |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 206 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 207 | * This is the second function used by a TLS client for ECDH(E) |
| 208 | * ciphersuites. |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 209 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 210 | * \param ctx The ECDH context. |
| 211 | * \param olen The number of Bytes written. |
| 212 | * \param buf The destination buffer. |
| 213 | * \param blen The size of the destination buffer. |
| 214 | * \param f_rng The RNG function. |
| 215 | * \param p_rng The RNG parameter. |
| 216 | * |
| 217 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX error code |
| 218 | * on failure. |
| 219 | * |
| 220 | * \see ecp.h |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 221 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 222 | int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen, |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 223 | unsigned char *buf, size_t blen, |
| 224 | int (*f_rng)(void *, unsigned char *, size_t), |
| 225 | void *p_rng ); |
| 226 | |
| 227 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 228 | * \brief This function parses and processes a TLS ClientKeyExchange |
| 229 | * payload. |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 230 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 231 | * This is the second function used by a TLS server for ECDH(E) |
| 232 | * ciphersuites. |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 233 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 234 | * \param ctx The ECDH context. |
| 235 | * \param buf The start of the input buffer. |
| 236 | * \param blen The length of the input buffer. |
| 237 | * |
| 238 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX error code |
| 239 | * on failure. |
| 240 | * |
| 241 | * \see ecp.h |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 242 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 243 | int mbedtls_ecdh_read_public( mbedtls_ecdh_context *ctx, |
Manuel Pégourié-Gonnard | 5cceb41 | 2013-02-11 21:51:45 +0100 | [diff] [blame] | 244 | const unsigned char *buf, size_t blen ); |
| 245 | |
| 246 | /** |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 247 | * \brief This function derives and exports the shared secret. |
Manuel Pégourié-Gonnard | 424fda5 | 2013-02-11 22:05:42 +0100 | [diff] [blame] | 248 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 249 | * This is the last function used by both TLS client |
| 250 | * and servers. |
Manuel Pégourié-Gonnard | 424fda5 | 2013-02-11 22:05:42 +0100 | [diff] [blame] | 251 | * |
Rose Zadik | de2d622 | 2018-01-25 21:57:43 +0000 | [diff] [blame^] | 252 | * \param ctx The ECDH context. |
| 253 | * \param olen The number of Bytes written. |
| 254 | * \param buf The destination buffer. |
| 255 | * \param blen The length of the destination buffer. |
| 256 | * \param f_rng The RNG function. |
| 257 | * \param p_rng The RNG parameter. |
| 258 | * |
| 259 | * \return \c 0 on success, or an \c MBEDTLS_ERR_ECP_XXX error code |
| 260 | * on failure. |
| 261 | * |
| 262 | * \see ecp.h |
| 263 | * |
| 264 | * \note If \p f_rng is not NULL, it is used to implement |
| 265 | * countermeasures against potential elaborate timing |
| 266 | * attacks. For more information, see mbedtls_ecp_mul(). |
Manuel Pégourié-Gonnard | 424fda5 | 2013-02-11 22:05:42 +0100 | [diff] [blame] | 267 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 268 | int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen, |
Manuel Pégourié-Gonnard | e09d2f8 | 2013-09-02 14:29:09 +0200 | [diff] [blame] | 269 | unsigned char *buf, size_t blen, |
| 270 | int (*f_rng)(void *, unsigned char *, size_t), |
| 271 | void *p_rng ); |
Manuel Pégourié-Gonnard | 424fda5 | 2013-02-11 22:05:42 +0100 | [diff] [blame] | 272 | |
Manuel Pégourié-Gonnard | 6545ca7 | 2013-01-26 16:05:22 +0100 | [diff] [blame] | 273 | #ifdef __cplusplus |
| 274 | } |
| 275 | #endif |
| 276 | |
Paul Bakker | 9af723c | 2014-05-01 13:03:14 +0200 | [diff] [blame] | 277 | #endif /* ecdh.h */ |