nrfxlib API 2.7.99
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_WINDOW_SIZE)
87/*
88 * Maximum "window" size used for point multiplication.
89 * Default: 6.
90 * Minimum value: 2. Maximum value: 7.
91 *
92 * Result is an array of at most ( 1 << ( MBEDTLS_ECP_WINDOW_SIZE - 1 ) )
93 * points used for point multiplication. This value is directly tied to EC
94 * peak memory usage, so decreasing it by one should roughly cut memory usage
95 * by two (if large curves are in use).
96 *
97 * Reduction in size may reduce speed, but larger curves are impacted first.
98 * Sample performances (in ECDHE handshakes/s, with FIXED_POINT_OPTIM = 1):
99 * w-size: 6 5 4 3 2
100 * 521 145 141 135 120 97
101 * 384 214 209 198 177 146
102 * 256 320 320 303 262 226
103 * 224 475 475 453 398 342
104 * 192 640 640 633 587 476
105 */
106#define MBEDTLS_ECP_WINDOW_SIZE 6
107#endif /* MBEDTLS_ECP_WINDOW_SIZE */
108
109#if !defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
110/*
111 * Trade memory for speed on fixed-point multiplication.
112 *
113 * This speeds up repeated multiplication of the generator (that is, the
114 * multiplication in ECDSA signatures, and half of the multiplications in
115 * ECDSA verification and ECDHE) by a factor roughly 3 to 4.
116 *
117 * The cost is increasing EC peak memory usage by a factor roughly 2.
118 *
119 * Change this value to 0 to reduce peak memory usage.
120 */
121#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
122#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
123
124/* \} name SECTION: Module settings */
125
126#define MBEDTLS_ECP_BUDGET( ops ) /* no-op; for compatibility */
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* MBEDTLS_ECP_ALT */
133
134#endif /* MBEDTLS_ECP_ALT_H */