nrfxlib API 0.1.0
Loading...
Searching...
No Matches
ecp_alt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#ifndef MBEDTLS_ECP_ALT_H
7#define MBEDTLS_ECP_ALT_H
8
9#if defined(MBEDTLS_ECP_ALT)
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
53typedef struct mbedtls_ecp_group
54{
55 mbedtls_ecp_group_id id;
56 mbedtls_mpi P;
57 mbedtls_mpi A;
59 mbedtls_mpi B;
61 mbedtls_ecp_point G;
62 mbedtls_mpi N;
63 size_t pbits;
64 size_t nbits;
67 unsigned int h;
68 int (*modp)(mbedtls_mpi *);
70 int (*t_pre)(mbedtls_ecp_point *, void *);
71 int (*t_post)(mbedtls_ecp_point *, void *);
72 void *t_data;
73 mbedtls_ecp_point *T;
74 size_t T_size;
75}
76mbedtls_ecp_group;
77
86#if !defined(MBEDTLS_ECP_MAX_BITS)
90#define MBEDTLS_ECP_MAX_BITS 384
91#endif
92
93#if !defined(MBEDTLS_ECP_WINDOW_SIZE)
94/*
95 * Maximum "window" size used for point multiplication.
96 * Default: 6.
97 * Minimum value: 2. Maximum value: 7.
98 *
99 * Result is an array of at most ( 1 << ( MBEDTLS_ECP_WINDOW_SIZE - 1 ) )
100 * points used for point multiplication. This value is directly tied to EC
101 * peak memory usage, so decreasing it by one should roughly cut memory usage
102 * by two (if large curves are in use).
103 *
104 * Reduction in size may reduce speed, but larger curves are impacted first.
105 * Sample performances (in ECDHE handshakes/s, with FIXED_POINT_OPTIM = 1):
106 * w-size: 6 5 4 3 2
107 * 521 145 141 135 120 97
108 * 384 214 209 198 177 146
109 * 256 320 320 303 262 226
110 * 224 475 475 453 398 342
111 * 192 640 640 633 587 476
112 */
113#define MBEDTLS_ECP_WINDOW_SIZE 6
114#endif /* MBEDTLS_ECP_WINDOW_SIZE */
115
116#if !defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
117/*
118 * Trade memory for speed on fixed-point multiplication.
119 *
120 * This speeds up repeated multiplication of the generator (that is, the
121 * multiplication in ECDSA signatures, and half of the multiplications in
122 * ECDSA verification and ECDHE) by a factor roughly 3 to 4.
123 *
124 * The cost is increasing EC peak memory usage by a factor roughly 2.
125 *
126 * Change this value to 0 to reduce peak memory usage.
127 */
128#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
129#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
130
131/* \} name SECTION: Module settings */
132
133#define MBEDTLS_ECP_BUDGET( ops ) /* no-op; for compatibility */
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif /* MBEDTLS_ECP_ALT */
140
141#endif /* MBEDTLS_ECP_ALT_H */