blob: f557a4de281934bccc1267d92dc4e4fc37c967bb [file] [log] [blame]
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +01001/**
2 * \file ecdsa.h
3 *
4 * \brief Elliptic curve DSA
5 *
Manuel Pégourié-Gonnard6fb81872015-07-27 11:11:48 +02006 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +02007 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 * not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010020 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +000021 * This file is part of mbed TLS (https://tls.mbed.org)
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010022 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020023#ifndef MBEDTLS_ECDSA_H
24#define MBEDTLS_ECDSA_H
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010025
Manuel Pégourié-Gonnardbdc96762013-10-03 11:50:39 +020026#include "ecp.h"
Manuel Pégourié-Gonnard887aa5b2014-04-04 13:57:20 +020027#include "md.h"
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +010028
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020029/*
30 * RFC 4492 page 20:
31 *
32 * Ecdsa-Sig-Value ::= SEQUENCE {
33 * r INTEGER,
34 * s INTEGER
35 * }
36 *
37 * Size is at most
38 * 1 (tag) + 1 (len) + 1 (initial 0) + ECP_MAX_BYTES for each of r and s,
39 * twice that + 1 (tag) + 2 (len) for the sequence
40 * (assuming ECP_MAX_BYTES is less than 126 for r and s,
41 * and less than 124 (total len <= 255) for the sequence)
42 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020043#if MBEDTLS_ECP_MAX_BYTES > 124
44#error "MBEDTLS_ECP_MAX_BYTES bigger than expected, please fix MBEDTLS_ECDSA_MAX_LEN"
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020045#endif
Manuel Pégourié-Gonnard5bf262d2015-03-31 11:46:01 +020046/** Maximum size of an ECDSA signature in bytes */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020047#define MBEDTLS_ECDSA_MAX_LEN ( 3 + 2 * ( 3 + MBEDTLS_ECP_MAX_BYTES ) )
Manuel Pégourié-Gonnard63e93192015-03-31 11:15:48 +020048
Manuel Pégourié-Gonnard32aa4372017-04-21 10:29:13 +020049#ifdef __cplusplus
50extern "C" {
51#endif
52
Manuel Pégourié-Gonnardbec2f452013-06-27 10:17:07 +020053/**
54 * \brief ECDSA context structure
55 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020056typedef mbedtls_ecp_keypair mbedtls_ecdsa_context;
Manuel Pégourié-Gonnardbec2f452013-06-27 10:17:07 +020057
Manuel Pégourié-Gonnard32aa4372017-04-21 10:29:13 +020058#if defined(MBEDTLS_ECP_RESTARTABLE)
59
60/**
Manuel Pégourié-Gonnarda0c5bcc2017-04-21 11:33:57 +020061 * \brief Internal restart context for ecdsa_verify()
62 *
63 * \note Opaque struct
64 */
65typedef struct mbedtls_ecdsa_restart_ver mbedtls_ecdsa_restart_ver_ctx;
66
67/**
Manuel Pégourié-Gonnard32aa4372017-04-21 10:29:13 +020068 * \brief General context for resuming ECDSA operations
69 */
70typedef struct
71{
Manuel Pégourié-Gonnard722e5152017-04-21 11:04:47 +020072 mbedtls_ecp_restart_ctx ecp; /*!< base context (admin+ecp info) */
Manuel Pégourié-Gonnarda0c5bcc2017-04-21 11:33:57 +020073 mbedtls_ecdsa_restart_ver_ctx *ver; /*!< ecdsa_verify() sub-context */
Manuel Pégourié-Gonnard32aa4372017-04-21 10:29:13 +020074} mbedtls_ecdsa_restart_ctx;
75
76#else /* MBEDTLS_ECP_RESTARTABLE */
77
78/* Now we can declare functions that take a pointer to that */
79typedef void mbedtls_ecdsa_restart_ctx;
80
81#endif /* MBEDTLS_ECP_RESTARTABLE */
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010082
83/**
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010084 * \brief Compute ECDSA signature of a previously hashed message
85 *
Manuel Pégourié-Gonnardb8cfe3f2015-03-31 11:04:45 +020086 * \note The deterministic version is usually prefered.
87 *
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010088 * \param grp ECP group
89 * \param r First output integer
90 * \param s Second output integer
91 * \param d Private signing key
92 * \param buf Message hash
93 * \param blen Length of buf
94 * \param f_rng RNG function
95 * \param p_rng RNG parameter
96 *
Janos Follath0a5154b2017-03-10 11:31:41 +000097 * \note If the bitlength of the message hash is larger than the
98 * bitlength of the group order, then the hash is truncated as
99 * prescribed by SEC1 4.1.3 step 5.
100 *
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +0100101 * \return 0 if successful,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200102 * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +0100103 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200104int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
105 const mbedtls_mpi *d, const unsigned char *buf, size_t blen,
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +0100106 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
107
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200108#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100109/**
Manuel Pégourié-Gonnardb8cfe3f2015-03-31 11:04:45 +0200110 * \brief Compute ECDSA signature of a previously hashed message,
111 * deterministic version (RFC 6979).
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100112 *
113 * \param grp ECP group
114 * \param r First output integer
115 * \param s Second output integer
116 * \param d Private signing key
117 * \param buf Message hash
118 * \param blen Length of buf
119 * \param md_alg MD algorithm used to hash the message
120 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000121 * \note If the bitlength of the message hash is larger than the
122 * bitlength of the group order, then the hash is truncated as
123 * prescribed by SEC1 4.1.3 step 5.
124 *
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100125 * \return 0 if successful,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200126 * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100127 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200128int mbedtls_ecdsa_sign_det( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
129 const mbedtls_mpi *d, const unsigned char *buf, size_t blen,
130 mbedtls_md_type_t md_alg );
131#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
Manuel Pégourié-Gonnard4daaef72014-01-06 14:25:56 +0100132
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +0100133/**
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100134 * \brief Verify ECDSA signature of a previously hashed message
135 *
136 * \param grp ECP group
137 * \param buf Message hash
138 * \param blen Length of buf
139 * \param Q Public key to use for verification
140 * \param r First integer of the signature
141 * \param s Second integer of the signature
142 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000143 * \note If the bitlength of the message hash is larger than the
144 * bitlength of the group order, then the hash is truncated as
145 * prescribed by SEC1 4.1.4 step 3.
146 *
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100147 * \return 0 if successful,
Manuel Pégourié-Gonnard1ed25052017-04-21 10:04:02 +0200148 * MBEDTLS_ERR_ECP_VERIFY_FAILED if signature is invalid
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200149 * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100150 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200151int mbedtls_ecdsa_verify( mbedtls_ecp_group *grp,
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100152 const unsigned char *buf, size_t blen,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200153 const mbedtls_ecp_point *Q, const mbedtls_mpi *r, const mbedtls_mpi *s);
Manuel Pégourié-Gonnard3aeb5a72013-01-26 18:05:50 +0100154
155/**
Manuel Pégourié-Gonnardaa431612013-08-09 17:10:27 +0200156 * \brief Compute ECDSA signature and write it to buffer,
157 * serialized as defined in RFC 4492 page 20.
Paul Bakker6838bd12013-09-30 13:56:38 +0200158 * (Not thread-safe to use same context in multiple threads)
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200159 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000160 * \note The deterministic version (RFC 6979) is used if
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200161 * MBEDTLS_ECDSA_DETERMINISTIC is defined.
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200162 *
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200163 * \param ctx ECDSA context
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200164 * \param md_alg Algorithm that was used to hash the message
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200165 * \param hash Message hash
166 * \param hlen Length of hash
167 * \param sig Buffer that will hold the signature
168 * \param slen Length of the signature written
169 * \param f_rng RNG function
170 * \param p_rng RNG parameter
171 *
172 * \note The "sig" buffer must be at least as large as twice the
Manuel Pégourié-Gonnard5bf262d2015-03-31 11:46:01 +0200173 * size of the curve used, plus 9 (eg. 73 bytes if a 256-bit
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200174 * curve is used). MBEDTLS_ECDSA_MAX_LEN is always safe.
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200175 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000176 * \note If the bitlength of the message hash is larger than the
177 * bitlength of the group order, then the hash is truncated as
178 * prescribed by SEC1 4.1.3 step 5.
179 *
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200180 * \return 0 if successful,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200181 * or a MBEDTLS_ERR_ECP_XXX, MBEDTLS_ERR_MPI_XXX or
182 * MBEDTLS_ERR_ASN1_XXX error code
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200183 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200184int mbedtls_ecdsa_write_signature( mbedtls_ecdsa_context *ctx, mbedtls_md_type_t md_alg,
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200185 const unsigned char *hash, size_t hlen,
186 unsigned char *sig, size_t *slen,
187 int (*f_rng)(void *, unsigned char *, size_t),
188 void *p_rng );
189
Manuel Pégourié-Gonnardaddb10e2017-04-21 12:54:46 +0200190/**
191 * \brief Restartable version of \c mbedtls_ecdsa_write_signature()
192 *
193 * \note Performs the same job as \c mbedtls_ecdsa_write_signature()
194 * but can return early and restart according to the limit
195 * set with \c mbedtls_ecp_set_max_ops() to reduce blocking.
196 *
197 * \param ctx ECDSA context
198 * \param md_alg Algorithm that was used to hash the message
199 * \param hash Message hash
200 * \param hlen Length of hash
201 * \param sig Buffer that will hold the signature
202 * \param slen Length of the signature written
203 * \param f_rng RNG function
204 * \param p_rng RNG parameter
205 * \param rs_ctx Restart context
206 *
207 * \return See \c mbedtls_ecdsa_write_signature(), or
208 * MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of
209 * operations was reached: see \c mbedtls_ecp_set_max_ops().
210 */
211int mbedtls_ecdsa_write_signature_restartable( mbedtls_ecdsa_context *ctx,
212 mbedtls_md_type_t md_alg,
213 const unsigned char *hash, size_t hlen,
214 unsigned char *sig, size_t *slen,
215 int (*f_rng)(void *, unsigned char *, size_t),
216 void *p_rng,
217 mbedtls_ecdsa_restart_ctx *rs_ctx );
218
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200219#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
220#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
221#if defined(MBEDTLS_DEPRECATED_WARNING)
222#define MBEDTLS_DEPRECATED __attribute__((deprecated))
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200223#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200224#define MBEDTLS_DEPRECATED
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200225#endif
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100226/**
227 * \brief Compute ECDSA signature and write it to buffer,
228 * serialized as defined in RFC 4492 page 20.
229 * Deterministic version, RFC 6979.
230 * (Not thread-safe to use same context in multiple threads)
231 *
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200232 * \deprecated Superseded by mbedtls_ecdsa_write_signature() in 2.0.0
Manuel Pégourié-Gonnarddfdcac92015-03-31 11:41:42 +0200233 *
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100234 * \param ctx ECDSA context
235 * \param hash Message hash
236 * \param hlen Length of hash
237 * \param sig Buffer that will hold the signature
238 * \param slen Length of the signature written
239 * \param md_alg MD algorithm used to hash the message
240 *
241 * \note The "sig" buffer must be at least as large as twice the
Manuel Pégourié-Gonnard5bf262d2015-03-31 11:46:01 +0200242 * size of the curve used, plus 9 (eg. 73 bytes if a 256-bit
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200243 * curve is used). MBEDTLS_ECDSA_MAX_LEN is always safe.
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100244 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000245 * \note If the bitlength of the message hash is larger than the
246 * bitlength of the group order, then the hash is truncated as
247 * prescribed by SEC1 4.1.3 step 5.
248 *
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100249 * \return 0 if successful,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200250 * or a MBEDTLS_ERR_ECP_XXX, MBEDTLS_ERR_MPI_XXX or
251 * MBEDTLS_ERR_ASN1_XXX error code
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100252 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200253int mbedtls_ecdsa_write_signature_det( mbedtls_ecdsa_context *ctx,
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100254 const unsigned char *hash, size_t hlen,
255 unsigned char *sig, size_t *slen,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200256 mbedtls_md_type_t md_alg ) MBEDTLS_DEPRECATED;
257#undef MBEDTLS_DEPRECATED
258#endif /* MBEDTLS_DEPRECATED_REMOVED */
259#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
Manuel Pégourié-Gonnard937340b2014-01-06 10:27:16 +0100260
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200261/**
262 * \brief Read and verify an ECDSA signature
263 *
264 * \param ctx ECDSA context
265 * \param hash Message hash
266 * \param hlen Size of hash
267 * \param sig Signature to read and verify
268 * \param slen Size of sig
269 *
Janos Follath0a5154b2017-03-10 11:31:41 +0000270 * \note If the bitlength of the message hash is larger than the
271 * bitlength of the group order, then the hash is truncated as
272 * prescribed by SEC1 4.1.4 step 3.
273 *
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200274 * \return 0 if successful,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200275 * MBEDTLS_ERR_ECP_BAD_INPUT_DATA if signature is invalid,
276 * MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH if the signature is
Manuel Pégourié-Gonnard35e95dd2014-04-08 12:17:41 +0200277 * valid but its actual length is less than siglen,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200278 * or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_ERR_MPI_XXX error code
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200279 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200280int mbedtls_ecdsa_read_signature( mbedtls_ecdsa_context *ctx,
Manuel Pégourié-Gonnardb694b482013-08-08 13:30:57 +0200281 const unsigned char *hash, size_t hlen,
282 const unsigned char *sig, size_t slen );
283
284/**
Manuel Pégourié-Gonnard32aa4372017-04-21 10:29:13 +0200285 * \brief Restartable version of \c mbedtls_ecdsa_read_signature()
286 *
287 * \note Performs the same job as \c mbedtls_ecdsa_read_signature()
288 * but can return early and restart according to the limit
289 * set with \c mbedtls_ecp_set_max_ops() to reduce blocking.
290 *
291 * \param ctx ECDSA context
292 * \param hash Message hash
293 * \param hlen Size of hash
294 * \param sig Signature to read and verify
295 * \param slen Size of sig
296 * \param rs_ctx Restart context
297 *
298 * \return See \c mbedtls_ecdsa_read_signature(), or
299 * MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of
300 * operations was reached: see \c mbedtls_ecp_set_max_ops().
301 */
302int mbedtls_ecdsa_read_signature_restartable( mbedtls_ecdsa_context *ctx,
303 const unsigned char *hash, size_t hlen,
304 const unsigned char *sig, size_t slen,
305 mbedtls_ecdsa_restart_ctx *rs_ctx );
306
307/**
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200308 * \brief Generate an ECDSA keypair on the given curve
309 *
310 * \param ctx ECDSA context in which the keypair should be stored
Paul Bakkerdcbfdcc2013-09-10 16:16:50 +0200311 * \param gid Group (elliptic curve) to use. One of the various
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200312 * MBEDTLS_ECP_DP_XXX macros depending on configuration.
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200313 * \param f_rng RNG function
314 * \param p_rng RNG parameter
315 *
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200316 * \return 0 on success, or a MBEDTLS_ERR_ECP_XXX code.
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200317 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200318int mbedtls_ecdsa_genkey( mbedtls_ecdsa_context *ctx, mbedtls_ecp_group_id gid,
Manuel Pégourié-Gonnard8eebd012013-08-09 16:21:34 +0200319 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
320
321/**
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200322 * \brief Set an ECDSA context from an EC key pair
323 *
324 * \param ctx ECDSA context to set
325 * \param key EC key to use
326 *
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200327 * \return 0 on success, or a MBEDTLS_ERR_ECP_XXX code.
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200328 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200329int mbedtls_ecdsa_from_keypair( mbedtls_ecdsa_context *ctx, const mbedtls_ecp_keypair *key );
Manuel Pégourié-Gonnardf4999932013-08-12 17:02:59 +0200330
331/**
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200332 * \brief Initialize context
333 *
334 * \param ctx Context to initialize
335 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200336void mbedtls_ecdsa_init( mbedtls_ecdsa_context *ctx );
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200337
338/**
339 * \brief Free context
340 *
341 * \param ctx Context to free
342 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200343void mbedtls_ecdsa_free( mbedtls_ecdsa_context *ctx );
Manuel Pégourié-Gonnard7c8934e2013-06-27 12:54:02 +0200344
Manuel Pégourié-Gonnard32aa4372017-04-21 10:29:13 +0200345#if defined(MBEDTLS_ECP_RESTARTABLE)
346/**
347 * \brief Initialize a restart context
348 */
349void mbedtls_ecdsa_restart_init( mbedtls_ecdsa_restart_ctx *ctx );
350
351/**
352 * \brief Free the components of a restart context
353 */
354void mbedtls_ecdsa_restart_free( mbedtls_ecdsa_restart_ctx *ctx );
355#endif /* MBEDTLS_ECP_RESTARTABLE */
356
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +0100357#ifdef __cplusplus
358}
359#endif
360
Paul Bakker9af723c2014-05-01 13:03:14 +0200361#endif /* ecdsa.h */