Mbed TLS v2.28.9
Loading...
Searching...
No Matches
ecp.h
Go to the documentation of this file.
1
17/*
18 * Copyright The Mbed TLS Contributors
19 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
20 */
21
22#ifndef MBEDTLS_ECP_H
23#define MBEDTLS_ECP_H
24
25#if !defined(MBEDTLS_CONFIG_FILE)
26#include "mbedtls/config.h"
27#else
28#include MBEDTLS_CONFIG_FILE
29#endif
30
31#include "mbedtls/bignum.h"
32
33#if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \
34 !defined(inline) && !defined(__cplusplus)
35#define inline __inline
36#endif
37
38/*
39 * ECP error codes
40 */
42#define MBEDTLS_ERR_ECP_BAD_INPUT_DATA -0x4F80
44#define MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL -0x4F00
46#define MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE -0x4E80
48#define MBEDTLS_ERR_ECP_VERIFY_FAILED -0x4E00
50#define MBEDTLS_ERR_ECP_ALLOC_FAILED -0x4D80
52#define MBEDTLS_ERR_ECP_RANDOM_FAILED -0x4D00
54#define MBEDTLS_ERR_ECP_INVALID_KEY -0x4C80
56#define MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH -0x4C00
57
58/* MBEDTLS_ERR_ECP_HW_ACCEL_FAILED is deprecated and should not be used. */
60#define MBEDTLS_ERR_ECP_HW_ACCEL_FAILED -0x4B80
61
63#define MBEDTLS_ERR_ECP_IN_PROGRESS -0x4B00
64
65/* Flags indicating whether to include code that is specific to certain
66 * types of curves. These flags are for internal library use only. */
67#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
68 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
69 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
70 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
71 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
72 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
73 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
74 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) || \
75 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
76 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
77 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
78#define MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED
79#endif
80#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \
81 defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
82#define MBEDTLS_ECP_MONTGOMERY_ENABLED
83#endif
84
85#ifdef __cplusplus
86extern "C" {
87#endif
88
98/* Note: when adding a new curve:
99 * - Add it at the end of this enum, otherwise you'll break the ABI by
100 * changing the numerical value for existing curves.
101 * - Increment MBEDTLS_ECP_DP_MAX below if needed.
102 * - Update the calculation of MBEDTLS_ECP_MAX_BITS_MIN below.
103 * - Add the corresponding MBEDTLS_ECP_DP_xxx_ENABLED macro definition to
104 * config.h.
105 * - List the curve as a dependency of MBEDTLS_ECP_C and
106 * MBEDTLS_ECDSA_C if supported in check_config.h.
107 * - Add the curve to the appropriate curve type macro
108 * MBEDTLS_ECP_yyy_ENABLED above.
109 * - Add the necessary definitions to ecp_curves.c.
110 * - Add the curve to the ecp_supported_curves array in ecp.c.
111 * - Add the curve to applicable profiles in x509_crt.c if applicable.
112 */
129
135#define MBEDTLS_ECP_DP_MAX 12
136
137/*
138 * Curve types
139 */
140typedef enum {
142 MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS, /* y^2 = x^3 + a x + b */
143 MBEDTLS_ECP_TYPE_MONTGOMERY, /* y^2 = x^3 + a x^2 + x */
145
155
173
174/* Determine the minimum safe value of MBEDTLS_ECP_MAX_BITS. */
175#if !defined(MBEDTLS_ECP_C)
176#define MBEDTLS_ECP_MAX_BITS_MIN 0
177/* Note: the curves must be listed in DECREASING size! */
178#elif defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
179#define MBEDTLS_ECP_MAX_BITS_MIN 521
180#elif defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
181#define MBEDTLS_ECP_MAX_BITS_MIN 512
182#elif defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
183#define MBEDTLS_ECP_MAX_BITS_MIN 448
184#elif defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
185#define MBEDTLS_ECP_MAX_BITS_MIN 384
186#elif defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
187#define MBEDTLS_ECP_MAX_BITS_MIN 384
188#elif defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
189#define MBEDTLS_ECP_MAX_BITS_MIN 256
190#elif defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
191#define MBEDTLS_ECP_MAX_BITS_MIN 256
192#elif defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
193#define MBEDTLS_ECP_MAX_BITS_MIN 256
194#elif defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
195#define MBEDTLS_ECP_MAX_BITS_MIN 255
196#elif defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
197#define MBEDTLS_ECP_MAX_BITS_MIN 225 // n is slightly above 2^224
198#elif defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
199#define MBEDTLS_ECP_MAX_BITS_MIN 224
200#elif defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
201#define MBEDTLS_ECP_MAX_BITS_MIN 192
202#elif defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
203#define MBEDTLS_ECP_MAX_BITS_MIN 192
204#else
205#error "MBEDTLS_ECP_C enabled, but no curve?"
206#endif
207
208#if !defined(MBEDTLS_ECP_ALT)
209/*
210 * default Mbed TLS elliptic curve arithmetic implementation
211 *
212 * (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
213 * alternative implementation for the whole module and it will replace this
214 * one.)
215 */
216
296
305#if defined(MBEDTLS_ECP_MAX_BITS)
306
307#if MBEDTLS_ECP_MAX_BITS < MBEDTLS_ECP_MAX_BITS_MIN
308#error "MBEDTLS_ECP_MAX_BITS is smaller than the largest supported curve"
309#endif
310
311#elif defined(MBEDTLS_ECP_C)
315#define MBEDTLS_ECP_MAX_BITS MBEDTLS_ECP_MAX_BITS_MIN
316
317#else
318/* MBEDTLS_ECP_MAX_BITS is not relevant without MBEDTLS_ECP_C, but set it
319 * to a nonzero value so that code that unconditionally allocates an array
320 * of a size based on it keeps working if built without ECC support. */
321#define MBEDTLS_ECP_MAX_BITS 1
322#endif
323
324#define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
325#define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1)
326
327#if !defined(MBEDTLS_ECP_WINDOW_SIZE)
328/*
329 * Maximum "window" size used for point multiplication.
330 * Default: a point where higher memory usage yields diminishing performance
331 * returns.
332 * Minimum value: 2. Maximum value: 7.
333 *
334 * Result is an array of at most ( 1 << ( MBEDTLS_ECP_WINDOW_SIZE - 1 ) )
335 * points used for point multiplication. This value is directly tied to EC
336 * peak memory usage, so decreasing it by one should roughly cut memory usage
337 * by two (if large curves are in use).
338 *
339 * Reduction in size may reduce speed, but larger curves are impacted first.
340 * Sample performances (in ECDHE handshakes/s, with FIXED_POINT_OPTIM = 1):
341 * w-size: 6 5 4 3 2
342 * 521 145 141 135 120 97
343 * 384 214 209 198 177 146
344 * 256 320 320 303 262 226
345 * 224 475 475 453 398 342
346 * 192 640 640 633 587 476
347 */
348#define MBEDTLS_ECP_WINDOW_SIZE 4
349#endif /* MBEDTLS_ECP_WINDOW_SIZE */
350
351#if !defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
352/*
353 * Trade memory for speed on fixed-point multiplication.
354 *
355 * This speeds up repeated multiplication of the generator (that is, the
356 * multiplication in ECDSA signatures, and half of the multiplications in
357 * ECDSA verification and ECDHE) by a factor roughly 3 to 4.
358 *
359 * The cost is increasing EC peak memory usage by a factor roughly 2.
360 *
361 * Change this value to 0 to reduce peak memory usage.
362 */
363#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
364#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
365
368#else /* MBEDTLS_ECP_ALT */
369#include "ecp_alt.h"
370#endif /* MBEDTLS_ECP_ALT */
371
372#if defined(MBEDTLS_ECP_RESTARTABLE)
373
379typedef struct mbedtls_ecp_restart_mul mbedtls_ecp_restart_mul_ctx;
380
386typedef struct mbedtls_ecp_restart_muladd mbedtls_ecp_restart_muladd_ctx;
387
391typedef struct {
392 unsigned ops_done;
393 unsigned depth;
394 mbedtls_ecp_restart_mul_ctx *rsm;
395 mbedtls_ecp_restart_muladd_ctx *ma;
397
398/*
399 * Operation counts for restartable functions
400 */
401#define MBEDTLS_ECP_OPS_CHK 3
402#define MBEDTLS_ECP_OPS_DBL 8
403#define MBEDTLS_ECP_OPS_ADD 11
404#define MBEDTLS_ECP_OPS_INV 120
417int mbedtls_ecp_check_budget(const mbedtls_ecp_group *grp,
419 unsigned ops);
420
421/* Utility macro for checking and updating ops budget */
422#define MBEDTLS_ECP_BUDGET(ops) \
423 MBEDTLS_MPI_CHK(mbedtls_ecp_check_budget(grp, rs_ctx, \
424 (unsigned) (ops)));
425
426#else /* MBEDTLS_ECP_RESTARTABLE */
427
428#define MBEDTLS_ECP_BUDGET(ops) /* no-op; for compatibility */
429
430/* We want to declare restartable versions of existing functions anyway */
432
433#endif /* MBEDTLS_ECP_RESTARTABLE */
434
449
450/*
451 * Point formats, from RFC 4492's enum ECPointFormat
452 */
453#define MBEDTLS_ECP_PF_UNCOMPRESSED 0
454#define MBEDTLS_ECP_PF_COMPRESSED 1
456/*
457 * Some other constants from RFC 4492
458 */
459#define MBEDTLS_ECP_TLS_NAMED_CURVE 3
461#if defined(MBEDTLS_ECP_RESTARTABLE)
519void mbedtls_ecp_set_max_ops(unsigned max_ops);
520
527int mbedtls_ecp_restart_is_enabled(void);
528#endif /* MBEDTLS_ECP_RESTARTABLE */
529
530/*
531 * Get the type of a curve
532 */
534
548
564
575
586
597
604
615
622
629
638
647
648#if defined(MBEDTLS_ECP_RESTARTABLE)
655void mbedtls_ecp_restart_init(mbedtls_ecp_restart_ctx *ctx);
656
664void mbedtls_ecp_restart_free(mbedtls_ecp_restart_ctx *ctx);
665#endif /* MBEDTLS_ECP_RESTARTABLE */
666
679
692 const mbedtls_ecp_group *src);
693
704
715
729 const mbedtls_ecp_point *Q);
730
744 const char *x, const char *y);
745
772 const mbedtls_ecp_point *P,
773 int format, size_t *olen,
774 unsigned char *buf, size_t buflen);
775
800 const unsigned char *buf, size_t ilen);
801
822 const unsigned char **buf, size_t len);
823
847 const mbedtls_ecp_point *pt,
848 int format, size_t *olen,
849 unsigned char *buf, size_t blen);
850
869
888 const unsigned char **buf, size_t len);
889
909 const unsigned char **buf,
910 size_t len);
930 size_t *olen,
931 unsigned char *buf, size_t blen);
932
970 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
971 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng);
972
1004 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1005 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
1006 mbedtls_ecp_restart_ctx *rs_ctx);
1007
1008#if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED)
1025{
1026 return grp->A.p == NULL;
1027}
1028
1065 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1066 const mbedtls_mpi *n, const mbedtls_ecp_point *Q);
1067
1110 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1111 const mbedtls_mpi *n, const mbedtls_ecp_point *Q,
1112 mbedtls_ecp_restart_ctx *rs_ctx);
1113#endif /* MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED */
1114
1143 const mbedtls_ecp_point *pt);
1144
1165 const mbedtls_mpi *d);
1166
1183 mbedtls_mpi *d,
1184 int (*f_rng)(void *, unsigned char *, size_t),
1185 void *p_rng);
1186
1215 const mbedtls_ecp_point *G,
1217 int (*f_rng)(void *, unsigned char *, size_t),
1218 void *p_rng);
1219
1245 int (*f_rng)(void *, unsigned char *, size_t),
1246 void *p_rng);
1247
1262 int (*f_rng)(void *, unsigned char *, size_t),
1263 void *p_rng);
1264
1286 const unsigned char *buf, size_t buflen);
1287
1331 unsigned char *buf, size_t buflen);
1332
1351 const mbedtls_ecp_keypair *prv);
1352
1353#if defined(MBEDTLS_SELF_TEST)
1354
1361int mbedtls_ecp_self_test(int verbose);
1362
1363#endif /* MBEDTLS_SELF_TEST */
1364
1365#ifdef __cplusplus
1366}
1367#endif
1368
1369#endif /* ecp.h */
Multi-precision integer library.
Configuration options (set of defines)
void mbedtls_ecp_keypair_free(mbedtls_ecp_keypair *key)
This function frees the components of a key pair.
int mbedtls_ecp_point_read_binary(const mbedtls_ecp_group *grp, mbedtls_ecp_point *P, const unsigned char *buf, size_t ilen)
This function imports a point from unsigned binary data.
int mbedtls_ecp_muladd(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_mpi *m, const mbedtls_ecp_point *P, const mbedtls_mpi *n, const mbedtls_ecp_point *Q)
This function performs multiplication and addition of two points by integers: R = m * P + n * Q.
int mbedtls_ecp_gen_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates an ECP key.
int mbedtls_ecp_is_zero(mbedtls_ecp_point *pt)
This function checks if a point is the point at infinity.
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key, unsigned char *buf, size_t buflen)
This function exports an elliptic curve private key.
int mbedtls_ecp_tls_write_group(const mbedtls_ecp_group *grp, size_t *olen, unsigned char *buf, size_t blen)
This function exports an elliptic curve as a TLS ECParameters record as defined in RFC 4492,...
int mbedtls_ecp_group_copy(mbedtls_ecp_group *dst, const mbedtls_ecp_group *src)
This function copies the contents of group src into group dst.
mbedtls_ecp_curve_type mbedtls_ecp_get_type(const mbedtls_ecp_group *grp)
void mbedtls_ecp_restart_ctx
Definition ecp.h:431
int mbedtls_ecp_mul(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_mpi *m, const mbedtls_ecp_point *P, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function performs a scalar multiplication of a point by an integer: R = m * P.
mbedtls_ecp_curve_type
Definition ecp.h:140
@ MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS
Definition ecp.h:142
@ MBEDTLS_ECP_TYPE_NONE
Definition ecp.h:141
@ MBEDTLS_ECP_TYPE_MONTGOMERY
Definition ecp.h:143
const mbedtls_ecp_group_id * mbedtls_ecp_grp_id_list(void)
This function retrieves the list of internal group identifiers of all supported curves in the order o...
void mbedtls_ecp_group_init(mbedtls_ecp_group *grp)
This function initializes an ECP group context without loading any domain parameters.
int mbedtls_ecp_gen_keypair_base(mbedtls_ecp_group *grp, const mbedtls_ecp_point *G, mbedtls_mpi *d, mbedtls_ecp_point *Q, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates a keypair with a configurable base point.
struct mbedtls_ecp_group mbedtls_ecp_group
The ECP group structure.
int mbedtls_ecp_check_pub_priv(const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv)
This function checks that the keypair objects pub and prv have the same group and the same public poi...
struct mbedtls_ecp_keypair mbedtls_ecp_keypair
The ECP key-pair structure.
int mbedtls_ecp_mul_restartable(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_mpi *m, const mbedtls_ecp_point *P, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, mbedtls_ecp_restart_ctx *rs_ctx)
This function performs multiplication of a point by an integer: R = m * P in a restartable way.
int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q)
This function compares two points.
int mbedtls_ecp_check_privkey(const mbedtls_ecp_group *grp, const mbedtls_mpi *d)
This function checks that an mbedtls_mpi is a valid private key for this curve.
int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, const char *x, const char *y)
This function imports a non-zero point from two ASCII strings.
int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id)
This function sets up an ECP group context from a standardized set of domain parameters.
void mbedtls_ecp_keypair_init(mbedtls_ecp_keypair *key)
This function initializes a key pair as an invalid one.
int mbedtls_ecp_tls_read_group_id(mbedtls_ecp_group_id *grp, const unsigned char **buf, size_t len)
This function extracts an elliptic curve group ID from a TLS ECParameters record as defined in RFC 44...
const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_name(const char *name)
This function retrieves curve information from a human-readable name.
void mbedtls_ecp_point_free(mbedtls_ecp_point *pt)
This function frees the components of a point.
int mbedtls_ecp_tls_read_point(const mbedtls_ecp_group *grp, mbedtls_ecp_point *pt, const unsigned char **buf, size_t len)
This function imports a point from a TLS ECPoint record.
int mbedtls_ecp_read_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key, const unsigned char *buf, size_t buflen)
This function reads an elliptic curve private key.
void mbedtls_ecp_group_free(mbedtls_ecp_group *grp)
This function frees the components of an ECP group.
int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q)
This function copies the contents of point Q into point P.
int mbedtls_ecp_muladd_restartable(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_mpi *m, const mbedtls_ecp_point *P, const mbedtls_mpi *n, const mbedtls_ecp_point *Q, mbedtls_ecp_restart_ctx *rs_ctx)
This function performs multiplication and addition of two points by integers: R = m * P + n * Q in a ...
int mbedtls_ecp_gen_privkey(const mbedtls_ecp_group *grp, mbedtls_mpi *d, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates a private key.
int mbedtls_ecp_gen_keypair(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 ECP keypair.
int mbedtls_ecp_tls_write_point(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt, int format, size_t *olen, unsigned char *buf, size_t blen)
This function exports a point as a TLS ECPoint record defined in RFC 4492, Section 5....
const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_grp_id(mbedtls_ecp_group_id grp_id)
This function retrieves curve information from an internal group identifier.
int mbedtls_ecp_set_zero(mbedtls_ecp_point *pt)
This function sets a point to the point at infinity.
struct mbedtls_ecp_curve_info mbedtls_ecp_curve_info
struct mbedtls_ecp_point mbedtls_ecp_point
The ECP point structure, in Jacobian coordinates.
int mbedtls_ecp_tls_read_group(mbedtls_ecp_group *grp, const unsigned char **buf, size_t len)
This function sets up an ECP group context from a TLS ECParameters record as defined in RFC 4492,...
const mbedtls_ecp_curve_info * mbedtls_ecp_curve_list(void)
This function retrieves the information defined in mbedtls_ecp_curve_info() for all supported curves.
void mbedtls_ecp_point_init(mbedtls_ecp_point *pt)
This function initializes a point as zero.
int mbedtls_ecp_check_pubkey(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt)
This function checks that a point is a valid public key on this curve.
mbedtls_ecp_group_id
Definition ecp.h:113
@ MBEDTLS_ECP_DP_SECP192K1
Definition ecp.h:124
@ MBEDTLS_ECP_DP_SECP384R1
Definition ecp.h:118
@ MBEDTLS_ECP_DP_CURVE448
Definition ecp.h:127
@ MBEDTLS_ECP_DP_CURVE25519
Definition ecp.h:123
@ MBEDTLS_ECP_DP_NONE
Definition ecp.h:114
@ MBEDTLS_ECP_DP_SECP256K1
Definition ecp.h:126
@ MBEDTLS_ECP_DP_BP512R1
Definition ecp.h:122
@ MBEDTLS_ECP_DP_SECP224R1
Definition ecp.h:116
@ MBEDTLS_ECP_DP_SECP521R1
Definition ecp.h:119
@ MBEDTLS_ECP_DP_BP384R1
Definition ecp.h:121
@ MBEDTLS_ECP_DP_SECP224K1
Definition ecp.h:125
@ MBEDTLS_ECP_DP_BP256R1
Definition ecp.h:120
@ MBEDTLS_ECP_DP_SECP192R1
Definition ecp.h:115
@ MBEDTLS_ECP_DP_SECP256R1
Definition ecp.h:117
int mbedtls_ecp_point_write_binary(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *P, int format, size_t *olen, unsigned char *buf, size_t buflen)
This function exports a point into unsigned binary data.
const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_tls_id(uint16_t tls_id)
This function retrieves curve information from a TLS NamedCurve value.
int mbedtls_ecp_self_test(int verbose)
The ECP checkup routine.
static int mbedtls_ecp_group_a_is_minus_3(const mbedtls_ecp_group *grp)
This function checks if domain parameter A of the curve is -3.
Definition ecp.h:1024
const char * name
Definition ecp.h:153
mbedtls_ecp_group_id grp_id
Definition ecp.h:150
uint16_t bit_size
Definition ecp.h:152
uint16_t tls_id
Definition ecp.h:151
The ECP group structure.
Definition ecp.h:270
size_t pbits
Definition ecp.h:282
int(* t_pre)(mbedtls_ecp_point *, void *)
Definition ecp.h:289
unsigned int h
Definition ecp.h:286
mbedtls_ecp_group_id id
Definition ecp.h:271
size_t T_size
Definition ecp.h:293
mbedtls_ecp_point * T
Definition ecp.h:292
mbedtls_mpi N
Definition ecp.h:281
void * t_data
Definition ecp.h:291
mbedtls_ecp_point G
Definition ecp.h:280
int(* t_post)(mbedtls_ecp_point *, void *)
Definition ecp.h:290
mbedtls_mpi B
Definition ecp.h:278
int(* modp)(mbedtls_mpi *)
Definition ecp.h:287
mbedtls_mpi P
Definition ecp.h:272
size_t nbits
Definition ecp.h:283
mbedtls_mpi A
Definition ecp.h:273
The ECP key-pair structure.
Definition ecp.h:443
mbedtls_ecp_point Q
Definition ecp.h:446
mbedtls_mpi d
Definition ecp.h:445
mbedtls_ecp_group grp
Definition ecp.h:444
The ECP point structure, in Jacobian coordinates.
Definition ecp.h:167
mbedtls_mpi Z
Definition ecp.h:170
mbedtls_mpi X
Definition ecp.h:168
mbedtls_mpi Y
Definition ecp.h:169
MPI structure.
Definition bignum.h:196
mbedtls_mpi_uint * p
Definition bignum.h:217