Mbed TLS v3.5.2
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
25
26#include "mbedtls/build_info.h"
27
28#include "mbedtls/bignum.h"
29
30/*
31 * ECP error codes
32 */
34#define MBEDTLS_ERR_ECP_BAD_INPUT_DATA -0x4F80
36#define MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL -0x4F00
38#define MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE -0x4E80
40#define MBEDTLS_ERR_ECP_VERIFY_FAILED -0x4E00
42#define MBEDTLS_ERR_ECP_ALLOC_FAILED -0x4D80
44#define MBEDTLS_ERR_ECP_RANDOM_FAILED -0x4D00
46#define MBEDTLS_ERR_ECP_INVALID_KEY -0x4C80
48#define MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH -0x4C00
50#define MBEDTLS_ERR_ECP_IN_PROGRESS -0x4B00
51
52/* Flags indicating whether to include code that is specific to certain
53 * types of curves. These flags are for internal library use only. */
54#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
55 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
56 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
57 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
58 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
59 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
60 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
61 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) || \
62 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
63 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
64 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
65#define MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED
66#endif
67#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \
68 defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
69#define MBEDTLS_ECP_MONTGOMERY_ENABLED
70#endif
71
72#ifdef __cplusplus
73extern "C" {
74#endif
75
85/* Note: when adding a new curve:
86 * - Add it at the end of this enum, otherwise you'll break the ABI by
87 * changing the numerical value for existing curves.
88 * - Increment MBEDTLS_ECP_DP_MAX below if needed.
89 * - Update the calculation of MBEDTLS_ECP_MAX_BITS below.
90 * - Add the corresponding MBEDTLS_ECP_DP_xxx_ENABLED macro definition to
91 * mbedtls_config.h.
92 * - List the curve as a dependency of MBEDTLS_ECP_C and
93 * MBEDTLS_ECDSA_C if supported in check_config.h.
94 * - Add the curve to the appropriate curve type macro
95 * MBEDTLS_ECP_yyy_ENABLED above.
96 * - Add the necessary definitions to ecp_curves.c.
97 * - Add the curve to the ecp_supported_curves array in ecp.c.
98 * - Add the curve to applicable profiles in x509_crt.c.
99 * - Add the curve to applicable presets in ssl_tls.c.
100 */
101typedef enum {
117
121#define MBEDTLS_ECP_DP_MAX 14
122
123/*
124 * Curve types
125 */
126typedef enum {
128 MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS, /* y^2 = x^3 + a x + b */
129 MBEDTLS_ECP_TYPE_MONTGOMERY, /* y^2 = x^3 + a x^2 + x */
131
141 uint16_t tls_id;
142 uint16_t bit_size;
143 const char *name;
145
157typedef struct mbedtls_ecp_point {
161}
163
164#if !defined(MBEDTLS_ECP_ALT)
165/*
166 * default Mbed TLS elliptic curve arithmetic implementation
167 *
168 * (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
169 * alternative implementation for the whole module and it will replace this
170 * one.)
171 */
172
232typedef struct mbedtls_ecp_group {
244 size_t pbits;
245 size_t nbits;
248 /* End of public fields */
249
250 unsigned int MBEDTLS_PRIVATE(h);
253 int(*MBEDTLS_PRIVATE(t_pre))(mbedtls_ecp_point *, void *);
254 int(*MBEDTLS_PRIVATE(t_post))(mbedtls_ecp_point *, void *);
255 void *MBEDTLS_PRIVATE(t_data);
257 size_t MBEDTLS_PRIVATE(T_size);
258}
260
269#if !defined(MBEDTLS_ECP_WINDOW_SIZE)
270/*
271 * Maximum "window" size used for point multiplication.
272 * Default: a point where higher memory usage yields diminishing performance
273 * returns.
274 * Minimum value: 2. Maximum value: 7.
275 *
276 * Result is an array of at most ( 1 << ( MBEDTLS_ECP_WINDOW_SIZE - 1 ) )
277 * points used for point multiplication. This value is directly tied to EC
278 * peak memory usage, so decreasing it by one should roughly cut memory usage
279 * by two (if large curves are in use).
280 *
281 * Reduction in size may reduce speed, but larger curves are impacted first.
282 * Sample performances (in ECDHE handshakes/s, with FIXED_POINT_OPTIM = 1):
283 * w-size: 6 5 4 3 2
284 * 521 145 141 135 120 97
285 * 384 214 209 198 177 146
286 * 256 320 320 303 262 226
287 * 224 475 475 453 398 342
288 * 192 640 640 633 587 476
289 */
290#define MBEDTLS_ECP_WINDOW_SIZE 4
291#endif /* MBEDTLS_ECP_WINDOW_SIZE */
292
293#if !defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
294/*
295 * Trade code size for speed on fixed-point multiplication.
296 *
297 * This speeds up repeated multiplication of the generator (that is, the
298 * multiplication in ECDSA signatures, and half of the multiplications in
299 * ECDSA verification and ECDHE) by a factor roughly 3 to 4.
300 *
301 * For each n-bit Short Weierstrass curve that is enabled, this adds 4n bytes
302 * of code size if n < 384 and 8n otherwise.
303 *
304 * Change this value to 0 to reduce code size.
305 */
306#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
307#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
308
311#else /* MBEDTLS_ECP_ALT */
312#include "ecp_alt.h"
313#endif /* MBEDTLS_ECP_ALT */
314
318#if !defined(MBEDTLS_ECP_LIGHT)
319/* Dummy definition to help code that has optional ECP support and
320 * defines an MBEDTLS_ECP_MAX_BYTES-sized array unconditionally. */
321#define MBEDTLS_ECP_MAX_BITS 1
322/* Note: the curves must be listed in DECREASING size! */
323#elif defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
324#define MBEDTLS_ECP_MAX_BITS 521
325#elif defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
326#define MBEDTLS_ECP_MAX_BITS 512
327#elif defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
328#define MBEDTLS_ECP_MAX_BITS 448
329#elif defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
330#define MBEDTLS_ECP_MAX_BITS 384
331#elif defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
332#define MBEDTLS_ECP_MAX_BITS 384
333#elif defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
334#define MBEDTLS_ECP_MAX_BITS 256
335#elif defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
336#define MBEDTLS_ECP_MAX_BITS 256
337#elif defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
338#define MBEDTLS_ECP_MAX_BITS 256
339#elif defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
340#define MBEDTLS_ECP_MAX_BITS 255
341#elif defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
342#define MBEDTLS_ECP_MAX_BITS 225 // n is slightly above 2^224
343#elif defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
344#define MBEDTLS_ECP_MAX_BITS 224
345#elif defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
346#define MBEDTLS_ECP_MAX_BITS 192
347#elif defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
348#define MBEDTLS_ECP_MAX_BITS 192
349#else /* !MBEDTLS_ECP_LIGHT */
350#error "Missing definition of MBEDTLS_ECP_MAX_BITS"
351#endif /* !MBEDTLS_ECP_LIGHT */
352
353#define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
354#define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1)
355
356#if defined(MBEDTLS_ECP_RESTARTABLE)
357
363typedef struct mbedtls_ecp_restart_mul mbedtls_ecp_restart_mul_ctx;
364
370typedef struct mbedtls_ecp_restart_muladd mbedtls_ecp_restart_muladd_ctx;
371
375typedef struct {
376 unsigned MBEDTLS_PRIVATE(ops_done);
377 unsigned MBEDTLS_PRIVATE(depth);
378 mbedtls_ecp_restart_mul_ctx *MBEDTLS_PRIVATE(rsm);
379 mbedtls_ecp_restart_muladd_ctx *MBEDTLS_PRIVATE(ma);
381
382/*
383 * Operation counts for restartable functions
384 */
385#define MBEDTLS_ECP_OPS_CHK 3
386#define MBEDTLS_ECP_OPS_DBL 8
387#define MBEDTLS_ECP_OPS_ADD 11
388#define MBEDTLS_ECP_OPS_INV 120
401int mbedtls_ecp_check_budget(const mbedtls_ecp_group *grp,
403 unsigned ops);
404
405/* Utility macro for checking and updating ops budget */
406#define MBEDTLS_ECP_BUDGET(ops) \
407 MBEDTLS_MPI_CHK(mbedtls_ecp_check_budget(grp, rs_ctx, \
408 (unsigned) (ops)));
409
410#else /* MBEDTLS_ECP_RESTARTABLE */
411
412#define MBEDTLS_ECP_BUDGET(ops) /* no-op; for compatibility */
413
414/* We want to declare restartable versions of existing functions anyway */
416
417#endif /* MBEDTLS_ECP_RESTARTABLE */
418
427typedef struct mbedtls_ecp_keypair {
431}
433
438#define MBEDTLS_ECP_PF_UNCOMPRESSED 0
449#define MBEDTLS_ECP_PF_COMPRESSED 1
450
451/*
452 * Some other constants from RFC 4492
453 */
454#define MBEDTLS_ECP_TLS_NAMED_CURVE 3
456#if defined(MBEDTLS_ECP_RESTARTABLE)
520void mbedtls_ecp_set_max_ops(unsigned max_ops);
521
528int mbedtls_ecp_restart_is_enabled(void);
529#endif /* MBEDTLS_ECP_RESTARTABLE */
530
531/*
532 * Get the type of a curve
533 */
535
549
565
576
587
598
605
616
623
630
639
648
649#if defined(MBEDTLS_ECP_RESTARTABLE)
656void mbedtls_ecp_restart_init(mbedtls_ecp_restart_ctx *ctx);
657
665void mbedtls_ecp_restart_free(mbedtls_ecp_restart_ctx *ctx);
666#endif /* MBEDTLS_ECP_RESTARTABLE */
667
680
693 const mbedtls_ecp_group *src);
694
705
716
730 const mbedtls_ecp_point *Q);
731
745 const char *x, const char *y);
746
773 const mbedtls_ecp_point *P,
774 int format, size_t *olen,
775 unsigned char *buf, size_t buflen);
776
804 const unsigned char *buf, size_t ilen);
805
826 const unsigned char **buf, size_t len);
827
851 const mbedtls_ecp_point *pt,
852 int format, size_t *olen,
853 unsigned char *buf, size_t blen);
854
873
892 const unsigned char **buf, size_t len);
893
913 const unsigned char **buf,
914 size_t len);
934 size_t *olen,
935 unsigned char *buf, size_t blen);
936
967 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
968 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng);
969
1001 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1002 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
1003 mbedtls_ecp_restart_ctx *rs_ctx);
1004
1005#if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED)
1022{
1023 return grp->A.MBEDTLS_PRIVATE(p) == NULL;
1024}
1025
1062 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1063 const mbedtls_mpi *n, const mbedtls_ecp_point *Q);
1064
1107 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
1108 const mbedtls_mpi *n, const mbedtls_ecp_point *Q,
1109 mbedtls_ecp_restart_ctx *rs_ctx);
1110#endif /* MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED */
1111
1140 const mbedtls_ecp_point *pt);
1141
1162 const mbedtls_mpi *d);
1163
1180 mbedtls_mpi *d,
1181 int (*f_rng)(void *, unsigned char *, size_t),
1182 void *p_rng);
1183
1212 const mbedtls_ecp_point *G,
1214 int (*f_rng)(void *, unsigned char *, size_t),
1215 void *p_rng);
1216
1242 int (*f_rng)(void *, unsigned char *, size_t),
1243 void *p_rng);
1244
1259 int (*f_rng)(void *, unsigned char *, size_t),
1260 void *p_rng);
1261
1281 const unsigned char *buf, size_t buflen);
1282
1300 unsigned char *buf, size_t buflen);
1301
1323 const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv,
1324 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng);
1325
1345
1346#if defined(MBEDTLS_SELF_TEST)
1347
1354int mbedtls_ecp_self_test(int verbose);
1355
1356#endif /* MBEDTLS_SELF_TEST */
1357
1358#ifdef __cplusplus
1359}
1360#endif
1361
1362#endif /* ecp.h */
Multi-precision integer library.
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:415
int mbedtls_ecp_export(const mbedtls_ecp_keypair *key, mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q)
This function exports generic key-pair parameters.
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:126
@ MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS
Definition ecp.h:128
@ MBEDTLS_ECP_TYPE_NONE
Definition ecp.h:127
@ MBEDTLS_ECP_TYPE_MONTGOMERY
Definition ecp.h:129
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.
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_check_pub_priv(const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function checks that the keypair objects pub and prv have the same group and the same public poi...
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.
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:101
@ MBEDTLS_ECP_DP_SECP192K1
Definition ecp.h:112
@ MBEDTLS_ECP_DP_SECP384R1
Definition ecp.h:106
@ MBEDTLS_ECP_DP_CURVE448
Definition ecp.h:115
@ MBEDTLS_ECP_DP_CURVE25519
Definition ecp.h:111
@ MBEDTLS_ECP_DP_NONE
Definition ecp.h:102
@ MBEDTLS_ECP_DP_SECP256K1
Definition ecp.h:114
@ MBEDTLS_ECP_DP_BP512R1
Definition ecp.h:110
@ MBEDTLS_ECP_DP_SECP224R1
Definition ecp.h:104
@ MBEDTLS_ECP_DP_SECP521R1
Definition ecp.h:107
@ MBEDTLS_ECP_DP_BP384R1
Definition ecp.h:109
@ MBEDTLS_ECP_DP_SECP224K1
Definition ecp.h:113
@ MBEDTLS_ECP_DP_BP256R1
Definition ecp.h:108
@ MBEDTLS_ECP_DP_SECP192R1
Definition ecp.h:103
@ MBEDTLS_ECP_DP_SECP256R1
Definition ecp.h:105
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:1021
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
const char * name
Definition ecp.h:143
mbedtls_ecp_group_id grp_id
Definition ecp.h:140
uint16_t bit_size
Definition ecp.h:142
uint16_t tls_id
Definition ecp.h:141
The ECP group structure.
Definition ecp.h:232
size_t pbits
Definition ecp.h:244
mbedtls_ecp_group_id id
Definition ecp.h:233
mbedtls_mpi N
Definition ecp.h:243
mbedtls_ecp_point G
Definition ecp.h:242
mbedtls_mpi B
Definition ecp.h:240
mbedtls_mpi P
Definition ecp.h:234
size_t nbits
Definition ecp.h:245
mbedtls_mpi A
Definition ecp.h:235
The ECP key-pair structure.
Definition ecp.h:427
The ECP point structure, in Jacobian coordinates.
Definition ecp.h:157
MPI structure.
Definition bignum.h:207