blob: 11df7e21571a033ef37448a998542ab4b78df7bb [file] [log] [blame]
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +01001/**
2 * \file ecdsa.h
3 *
Rose Zadik817297f2018-03-27 11:30:14 +01004 * \brief This file contains ECDSA definitions and functions.
Rose Zadikbff87d92018-01-25 21:58:53 +00005 *
Rose Zadik817297f2018-03-27 11:30:14 +01006 * The Elliptic Curve Digital Signature Algorithm (ECDSA) is defined in
7 * <em>Standards for Efficient Cryptography Group (SECG):
Rose Zadikbff87d92018-01-25 21:58:53 +00008 * SEC1 Elliptic Curve Cryptography</em>.
9 * The use of ECDSA for TLS is defined in <em>RFC-4492: Elliptic Curve
10 * Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS)</em>.
11 *
Darryl Greena40a1012018-01-05 15:33:17 +000012 */
13/*
Rose Zadikbff87d92018-01-25 21:58:53 +000014 * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +020015 * SPDX-License-Identifier: Apache-2.0
16 *
17 * Licensed under the Apache License, Version 2.0 (the "License"); you may
18 * not use this file except in compliance with the License.
19 * You may obtain a copy of the License at
20 *
21 * http://www.apache.org/licenses/LICENSE-2.0
22 *
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010028 *
Rose Zadikbff87d92018-01-25 21:58:53 +000029 * This file is part of Mbed TLS (https://tls.mbed.org)
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010030 */
Rose Zadikbff87d92018-01-25 21:58:53 +000031
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020032#ifndef MBEDTLS_ECDSA_H
33#define MBEDTLS_ECDSA_H
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010034
Manuel Pégourié-Gonnardbdc96762013-10-03 11:50:39 +020035#include "ecp.h"
Manuel Pégourié-Gonnard887aa5b2014-04-04 13:57:20 +020036#include "md.h"
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +010037
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020038/*
Rose Zadikbff87d92018-01-25 21:58:53 +000039 * RFC-4492 page 20:
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020040 *
41 * Ecdsa-Sig-Value ::= SEQUENCE {
42 * r INTEGER,
43 * s INTEGER
44 * }
45 *
46 * Size is at most
47 * 1 (tag) + 1 (len) + 1 (initial 0) + ECP_MAX_BYTES for each of r and s,
48 * twice that + 1 (tag) + 2 (len) for the sequence
49 * (assuming ECP_MAX_BYTES is less than 126 for r and s,
50 * and less than 124 (total len <= 255) for the sequence)
51 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020052#if MBEDTLS_ECP_MAX_BYTES > 124
53#error "MBEDTLS_ECP_MAX_BYTES bigger than expected, please fix MBEDTLS_ECDSA_MAX_LEN"
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020054#endif
Rose Zadikbff87d92018-01-25 21:58:53 +000055/** The maximal size of an ECDSA signature in Bytes. */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020056#define MBEDTLS_ECDSA_MAX_LEN ( 3 + 2 * ( 3 + MBEDTLS_ECP_MAX_BYTES ) )
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020057
Manuel Pégourié-Gonnardbec2f452013-06-27 10:17:07 +020058/**
Rose Zadikbff87d92018-01-25 21:58:53 +000059 * \brief The ECDSA context structure.
Manuel Pégourié-Gonnardbec2f452013-06-27 10:17:07 +020060 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020061typedef mbedtls_ecp_keypair mbedtls_ecdsa_context;
Manuel Pégourié-Gonnardbec2f452013-06-27 10:17:07 +020062
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010063#ifdef __cplusplus
64extern "C" {
65#endif
66
67/**
Rose Zadikbff87d92018-01-25 21:58:53 +000068 * \brief This function computes the ECDSA signature of a
69 * previously-hashed message.
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010070 *
Rose Zadikbff87d92018-01-25 21:58:53 +000071 * \note The deterministic version is usually preferred.
Manuel Pégourié-Gonnardb8cfe3f2015-03-31 11:04:45 +020072 *
Rose Zadik817297f2018-03-27 11:30:14 +010073 * \note If the bitlength of the message hash is larger than the
74 * bitlength of the group order, then the hash is truncated
75 * as defined in <em>Standards for Efficient Cryptography Group
76 * (SECG): SEC1 Elliptic Curve Cryptography</em>, section
77 * 4.1.3, step 5.
78 *
79 * \see ecp.h
80 *
Rose Zadikbff87d92018-01-25 21:58:53 +000081 * \param grp The ECP group.
82 * \param r The first output integer.
83 * \param s The second output integer.
84 * \param d The private signing key.
85 * \param buf The message hash.
86 * \param blen The length of \p buf.
87 * \param f_rng The RNG function.
Rose Zadik817297f2018-03-27 11:30:14 +010088 * \param p_rng The RNG context.
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010089 *
Rose Zadik817297f2018-03-27 11:30:14 +010090 * \return \c 0 on success.
91 * \return An \c MBEDTLS_ERR_ECP_XXX
Rose Zadikbff87d92018-01-25 21:58:53 +000092 * or \c MBEDTLS_MPI_XXX error code on failure.
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010093 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020094int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
95 const mbedtls_mpi *d, const unsigned char *buf, size_t blen,
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010096 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
97
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020098#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +010099/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000100 * \brief This function computes the ECDSA signature of a
101 * previously-hashed message, deterministic version.
Rose Zadik817297f2018-03-27 11:30:14 +0100102 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000103 * For more information, see <em>RFC-6979: Deterministic
104 * Usage of the Digital Signature Algorithm (DSA) and Elliptic
105 * Curve Digital Signature Algorithm (ECDSA)</em>.
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100106 *
Rose Zadik817297f2018-03-27 11:30:14 +0100107 * \note If the bitlength of the message hash is larger than the
108 * bitlength of the group order, then the hash is truncated as
109 * defined in <em>Standards for Efficient Cryptography Group
110 * (SECG): SEC1 Elliptic Curve Cryptography</em>, section
111 * 4.1.3, step 5.
112 *
113 * \see ecp.h
114 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000115 * \param grp The ECP group.
116 * \param r The first output integer.
117 * \param s The second output integer.
118 * \param d The private signing key.
119 * \param buf The message hash.
120 * \param blen The length of \p buf.
121 * \param md_alg The MD algorithm used to hash the message.
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100122 *
Rose Zadik817297f2018-03-27 11:30:14 +0100123 * \return \c 0 on success.
Rose Zadik14d0d572018-04-16 16:09:30 +0100124 * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX
Rose Zadikbff87d92018-01-25 21:58:53 +0000125 * error code on failure.
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100126 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200127int mbedtls_ecdsa_sign_det( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
128 const mbedtls_mpi *d, const unsigned char *buf, size_t blen,
129 mbedtls_md_type_t md_alg );
130#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100131
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +0100132/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000133 * \brief This function verifies the ECDSA signature of a
134 * previously-hashed message.
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100135 *
Rose Zadik817297f2018-03-27 11:30:14 +0100136 * \note If the bitlength of the message hash is larger than the
137 * bitlength of the group order, then the hash is truncated as
138 * defined in <em>Standards for Efficient Cryptography Group
139 * (SECG): SEC1 Elliptic Curve Cryptography</em>, section
140 * 4.1.4, step 3.
141 *
142 * \see ecp.h
143 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000144 * \param grp The ECP group.
145 * \param buf The message hash.
146 * \param blen The length of \p buf.
147 * \param Q The public key to use for verification.
148 * \param r The first integer of the signature.
149 * \param s The second integer of the signature.
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100150 *
Rose Zadik817297f2018-03-27 11:30:14 +0100151 * \return \c 0 on success.
Rose Zadik14d0d572018-04-16 16:09:30 +0100152 * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if the signature
153 * is invalid.
Rose Zadik817297f2018-03-27 11:30:14 +0100154 * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX
Rose Zadikbff87d92018-01-25 21:58:53 +0000155 * error code on failure for any other reason.
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100156 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200157int mbedtls_ecdsa_verify( mbedtls_ecp_group *grp,
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100158 const unsigned char *buf, size_t blen,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200159 const mbedtls_ecp_point *Q, const mbedtls_mpi *r, const mbedtls_mpi *s);
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100160
161/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000162 * \brief This function computes the ECDSA signature and writes it
163 * to a buffer, serialized as defined in <em>RFC-4492:
164 * Elliptic Curve Cryptography (ECC) Cipher Suites for
165 * Transport Layer Security (TLS)</em>.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200166 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000167 * \warning It is not thread-safe to use the same context in
168 * multiple threads.
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200169 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000170 * \note The deterministic version is used if
171 * #MBEDTLS_ECDSA_DETERMINISTIC is defined. For more
172 * information, see <em>RFC-6979: Deterministic Usage
173 * of the Digital Signature Algorithm (DSA) and Elliptic
174 * Curve Digital Signature Algorithm (ECDSA)</em>.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200175 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000176 * \note The \p sig buffer must be at least twice as large as the
177 * size of the curve used, plus 9. For example, 73 Bytes if
178 * a 256-bit curve is used. A buffer length of
179 * #MBEDTLS_ECDSA_MAX_LEN is always safe.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200180 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000181 * \note If the bitlength of the message hash is larger than the
182 * bitlength of the group order, then the hash is truncated as
Rose Zadikbff87d92018-01-25 21:58:53 +0000183 * defined in <em>Standards for Efficient Cryptography Group
184 * (SECG): SEC1 Elliptic Curve Cryptography</em>, section
185 * 4.1.3, step 5.
Janos Follath0a5154b2017-03-10 11:31:41 +0000186 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000187 * \see ecp.h
Rose Zadik817297f2018-03-27 11:30:14 +0100188 *
189 * \param ctx The ECDSA context.
190 * \param md_alg The message digest that was used to hash the message.
191 * \param hash The message hash.
192 * \param hlen The length of the hash.
193 * \param sig The buffer that holds the signature.
194 * \param slen The length of the signature written.
195 * \param f_rng The RNG function.
196 * \param p_rng The RNG context.
197 *
198 * \return \c 0 on success.
199 * \return An \c MBEDTLS_ERR_ECP_XXX, \c MBEDTLS_ERR_MPI_XXX or
200 * \c MBEDTLS_ERR_ASN1_XXX error code on failure.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200201 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200202int mbedtls_ecdsa_write_signature( mbedtls_ecdsa_context *ctx, mbedtls_md_type_t md_alg,
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200203 const unsigned char *hash, size_t hlen,
204 unsigned char *sig, size_t *slen,
205 int (*f_rng)(void *, unsigned char *, size_t),
206 void *p_rng );
207
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200208#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
209#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
210#if defined(MBEDTLS_DEPRECATED_WARNING)
211#define MBEDTLS_DEPRECATED __attribute__((deprecated))
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200212#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200213#define MBEDTLS_DEPRECATED
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200214#endif
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100215/**
Rose Zadik817297f2018-03-27 11:30:14 +0100216 * \brief This function computes an ECDSA signature and writes
217 * it to a buffer, serialized as defined in <em>RFC-4492:
218 * Elliptic Curve Cryptography (ECC) Cipher Suites for
219 * Transport Layer Security (TLS)</em>.
Rose Zadikbff87d92018-01-25 21:58:53 +0000220 *
Rose Zadik817297f2018-03-27 11:30:14 +0100221 * The deterministic version is defined in <em>RFC-6979:
222 * Deterministic Usage of the Digital Signature Algorithm (DSA)
223 * and Elliptic Curve Digital Signature Algorithm (ECDSA)</em>.
Rose Zadikbff87d92018-01-25 21:58:53 +0000224 *
225 * \warning It is not thread-safe to use the same context in
226 * multiple threads.
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100227 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000228 * \note The \p sig buffer must be at least twice as large as the
229 * size of the curve used, plus 9. For example, 73 Bytes if a
230 * 256-bit curve is used. A buffer length of
231 * #MBEDTLS_ECDSA_MAX_LEN is always safe.
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100232 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000233 * \note If the bitlength of the message hash is larger than the
234 * bitlength of the group order, then the hash is truncated as
Rose Zadikbff87d92018-01-25 21:58:53 +0000235 * defined in <em>Standards for Efficient Cryptography Group
236 * (SECG): SEC1 Elliptic Curve Cryptography</em>, section
237 * 4.1.3, step 5.
Janos Follath0a5154b2017-03-10 11:31:41 +0000238 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000239 * \see ecp.h
Rose Zadik817297f2018-03-27 11:30:14 +0100240 *
Rose Zadikec5d4162018-04-17 15:55:28 +0100241 * \deprecated Superseded by mbedtls_ecdsa_write_signature() in
242 * Mbed TLS version 2.0 and later.
Rose Zadik817297f2018-03-27 11:30:14 +0100243 *
244 * \param ctx The ECDSA context.
Rose Zadik14d0d572018-04-16 16:09:30 +0100245 * \param hash The message hash.
Rose Zadik817297f2018-03-27 11:30:14 +0100246 * \param hlen The length of the hash.
247 * \param sig The buffer that holds the signature.
248 * \param slen The length of the signature written.
249 * \param md_alg The MD algorithm used to hash the message.
250 *
251 * \return \c 0 on success.
252 * \return An \c MBEDTLS_ERR_ECP_XXX, \c MBEDTLS_ERR_MPI_XXX or
253 * \c MBEDTLS_ERR_ASN1_XXX error code on failure.
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100254 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200255int mbedtls_ecdsa_write_signature_det( mbedtls_ecdsa_context *ctx,
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100256 const unsigned char *hash, size_t hlen,
257 unsigned char *sig, size_t *slen,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200258 mbedtls_md_type_t md_alg ) MBEDTLS_DEPRECATED;
259#undef MBEDTLS_DEPRECATED
260#endif /* MBEDTLS_DEPRECATED_REMOVED */
261#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100262
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200263/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000264 * \brief This function reads and verifies an ECDSA signature.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200265 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000266 * \note If the bitlength of the message hash is larger than the
267 * bitlength of the group order, then the hash is truncated as
Rose Zadikbff87d92018-01-25 21:58:53 +0000268 * defined in <em>Standards for Efficient Cryptography Group
269 * (SECG): SEC1 Elliptic Curve Cryptography</em>, section
270 * 4.1.4, step 3.
Janos Follath0a5154b2017-03-10 11:31:41 +0000271 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000272 * \see ecp.h
Rose Zadik817297f2018-03-27 11:30:14 +0100273 *
274 * \param ctx The ECDSA context.
275 * \param hash The message hash.
276 * \param hlen The size of the hash.
277 * \param sig The signature to read and verify.
278 * \param slen The size of \p sig.
279 *
280 * \return \c 0 on success.
281 * \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if signature is invalid.
282 * \return #MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH if the signature is
283 * valid but its actual length is less than \p siglen.
284 * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_ERR_MPI_XXX
285 * error code on failure for any other reason.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200286 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200287int mbedtls_ecdsa_read_signature( mbedtls_ecdsa_context *ctx,
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200288 const unsigned char *hash, size_t hlen,
289 const unsigned char *sig, size_t slen );
290
291/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000292 * \brief This function generates an ECDSA keypair on the given curve.
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200293 *
Rose Zadik817297f2018-03-27 11:30:14 +0100294 * \see ecp.h
295 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000296 * \param ctx The ECDSA context to store the keypair in.
297 * \param gid The elliptic curve to use. One of the various
298 * \c MBEDTLS_ECP_DP_XXX macros depending on configuration.
299 * \param f_rng The RNG function.
Rose Zadik817297f2018-03-27 11:30:14 +0100300 * \param p_rng The RNG context.
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200301 *
Rose Zadik817297f2018-03-27 11:30:14 +0100302 * \return \c 0 on success.
303 * \return An \c MBEDTLS_ERR_ECP_XXX code on failure.
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200304 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200305int mbedtls_ecdsa_genkey( mbedtls_ecdsa_context *ctx, mbedtls_ecp_group_id gid,
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200306 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
307
308/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000309 * \brief This function sets an ECDSA context from an EC key pair.
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200310 *
Rose Zadik817297f2018-03-27 11:30:14 +0100311 * \see ecp.h
312 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000313 * \param ctx The ECDSA context to set.
314 * \param key The EC key to use.
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200315 *
Rose Zadik817297f2018-03-27 11:30:14 +0100316 * \return \c 0 on success.
317 * \return An \c MBEDTLS_ERR_ECP_XXX code on failure.
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200318 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200319int mbedtls_ecdsa_from_keypair( mbedtls_ecdsa_context *ctx, const mbedtls_ecp_keypair *key );
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200320
321/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000322 * \brief This function initializes an ECDSA context.
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200323 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000324 * \param ctx The ECDSA context to initialize.
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200325 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200326void mbedtls_ecdsa_init( mbedtls_ecdsa_context *ctx );
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200327
328/**
Rose Zadikbff87d92018-01-25 21:58:53 +0000329 * \brief This function frees an ECDSA context.
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200330 *
Rose Zadikbff87d92018-01-25 21:58:53 +0000331 * \param ctx The ECDSA context to free.
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200332 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200333void mbedtls_ecdsa_free( mbedtls_ecdsa_context *ctx );
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200334
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +0100335#ifdef __cplusplus
336}
337#endif
338
Paul Bakker9af723c2014-05-01 13:03:14 +0200339#endif /* ecdsa.h */