1 | /* ecc.h
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2020 wolfSSL Inc.
|
---|
4 | *
|
---|
5 | * This file is part of wolfSSL.
|
---|
6 | *
|
---|
7 | * wolfSSL is free software; you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation; either version 2 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * wolfSSL is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with this program; if not, write to the Free Software
|
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*!
|
---|
23 | \file wolfssl/wolfcrypt/ecc.h
|
---|
24 | */
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef WOLF_CRYPT_ECC_H
|
---|
28 | #define WOLF_CRYPT_ECC_H
|
---|
29 |
|
---|
30 | #include <wolfssl/wolfcrypt/types.h>
|
---|
31 |
|
---|
32 | #ifdef HAVE_ECC
|
---|
33 |
|
---|
34 | #if defined(HAVE_FIPS) && \
|
---|
35 | defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
|
---|
36 | #include <wolfssl/wolfcrypt/fips.h>
|
---|
37 | #endif /* HAVE_FIPS_VERSION >= 2 */
|
---|
38 |
|
---|
39 | #include <wolfssl/wolfcrypt/integer.h>
|
---|
40 | #include <wolfssl/wolfcrypt/random.h>
|
---|
41 |
|
---|
42 | #ifdef HAVE_X963_KDF
|
---|
43 | #include <wolfssl/wolfcrypt/hash.h>
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #ifdef WOLFSSL_ASYNC_CRYPT
|
---|
47 | #include <wolfssl/wolfcrypt/async.h>
|
---|
48 | #ifdef WOLFSSL_CERT_GEN
|
---|
49 | #include <wolfssl/wolfcrypt/asn.h>
|
---|
50 | #endif
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A)
|
---|
54 | #include <wolfssl/wolfcrypt/port/atmel/atmel.h>
|
---|
55 | #endif /* WOLFSSL_ATECC508A */
|
---|
56 |
|
---|
57 | #if defined(WOLFSSL_CRYPTOCELL)
|
---|
58 | #include <wolfssl/wolfcrypt/port/arm/cryptoCell.h>
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #ifdef WOLFSSL_SILABS_SE_ACCEL
|
---|
62 | #include <wolfssl/wolfcrypt/port/silabs/silabs_ecc.h>
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | #ifdef WOLFSSL_HAVE_SP_ECC
|
---|
66 | #include <wolfssl/wolfcrypt/sp_int.h>
|
---|
67 | #endif
|
---|
68 |
|
---|
69 |
|
---|
70 | #ifdef __cplusplus
|
---|
71 | extern "C" {
|
---|
72 | #endif
|
---|
73 |
|
---|
74 |
|
---|
75 | /* Enable curve B parameter if needed */
|
---|
76 | #if defined(HAVE_COMP_KEY) || defined(ECC_CACHE_CURVE)
|
---|
77 | #ifndef USE_ECC_B_PARAM /* Allow someone to force enable */
|
---|
78 | #define USE_ECC_B_PARAM
|
---|
79 | #endif
|
---|
80 | #endif
|
---|
81 |
|
---|
82 |
|
---|
83 | /* Use this as the key->idx if a custom ecc_set is used for key->dp */
|
---|
84 | #define ECC_CUSTOM_IDX (-1)
|
---|
85 |
|
---|
86 |
|
---|
87 | /* Determine max ECC bits based on enabled curves */
|
---|
88 | #if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES)
|
---|
89 | #define MAX_ECC_BITS 521
|
---|
90 | #elif defined(HAVE_ECC512)
|
---|
91 | #define MAX_ECC_BITS 512
|
---|
92 | #elif defined(HAVE_ECC384)
|
---|
93 | #define MAX_ECC_BITS 384
|
---|
94 | #elif defined(HAVE_ECC320)
|
---|
95 | #define MAX_ECC_BITS 320
|
---|
96 | #elif !defined(NO_ECC256)
|
---|
97 | #define MAX_ECC_BITS 256
|
---|
98 | #elif defined(HAVE_ECC239)
|
---|
99 | #define MAX_ECC_BITS 239
|
---|
100 | #elif defined(HAVE_ECC224)
|
---|
101 | #define MAX_ECC_BITS 224
|
---|
102 | #elif defined(HAVE_ECC192)
|
---|
103 | #define MAX_ECC_BITS 192
|
---|
104 | #elif defined(HAVE_ECC160)
|
---|
105 | #define MAX_ECC_BITS 160
|
---|
106 | #elif defined(HAVE_ECC128)
|
---|
107 | #define MAX_ECC_BITS 128
|
---|
108 | #elif defined(HAVE_ECC112)
|
---|
109 | #define MAX_ECC_BITS 112
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | /* calculate max ECC bytes */
|
---|
113 | #if ((MAX_ECC_BITS * 2) % 8) == 0
|
---|
114 | #define MAX_ECC_BYTES (MAX_ECC_BITS / 8)
|
---|
115 | #else
|
---|
116 | /* add byte if not aligned */
|
---|
117 | #define MAX_ECC_BYTES ((MAX_ECC_BITS / 8) + 1)
|
---|
118 | #endif
|
---|
119 |
|
---|
120 | #ifndef ECC_MAX_PAD_SZ
|
---|
121 | /* ECC maximum padding size (when MSB is set extra byte required for R and S) */
|
---|
122 | #define ECC_MAX_PAD_SZ 2
|
---|
123 | #endif
|
---|
124 |
|
---|
125 | enum {
|
---|
126 | ECC_PUBLICKEY = 1,
|
---|
127 | ECC_PRIVATEKEY = 2,
|
---|
128 | ECC_PRIVATEKEY_ONLY = 3,
|
---|
129 | ECC_MAXNAME = 16, /* MAX CURVE NAME LENGTH */
|
---|
130 | SIG_HEADER_SZ = 7, /* ECC signature header size (30 81 87 02 42 [R] 02 42 [S]) */
|
---|
131 | ECC_BUFSIZE = 256, /* for exported keys temp buffer */
|
---|
132 | ECC_MINSIZE = ECC_MIN_KEY_SZ/8, /* MIN Private Key size */
|
---|
133 | ECC_MAXSIZE = 66, /* MAX Private Key size */
|
---|
134 | ECC_MAXSIZE_GEN = 74, /* MAX Buffer size required when generating ECC keys*/
|
---|
135 | ECC_MAX_OID_LEN = 16,
|
---|
136 | ECC_MAX_SIG_SIZE= ((MAX_ECC_BYTES * 2) + ECC_MAX_PAD_SZ + SIG_HEADER_SZ),
|
---|
137 |
|
---|
138 | /* max crypto hardware size */
|
---|
139 | #if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A)
|
---|
140 | ECC_MAX_CRYPTO_HW_SIZE = ATECC_KEY_SIZE, /* from port/atmel/atmel.h */
|
---|
141 | ECC_MAX_CRYPTO_HW_PUBKEY_SIZE = (ATECC_KEY_SIZE*2),
|
---|
142 | #elif defined(PLUTON_CRYPTO_ECC)
|
---|
143 | ECC_MAX_CRYPTO_HW_SIZE = 32,
|
---|
144 | #elif defined(WOLFSSL_SILABS_SE_ACCEL)
|
---|
145 | ECC_MAX_CRYPTO_HW_SIZE = 32,
|
---|
146 | #elif defined(WOLFSSL_CRYPTOCELL)
|
---|
147 | #ifndef CRYPTOCELL_KEY_SIZE
|
---|
148 | CRYPTOCELL_KEY_SIZE = ECC_MAXSIZE,
|
---|
149 | #endif
|
---|
150 | ECC_MAX_CRYPTO_HW_SIZE = CRYPTOCELL_KEY_SIZE,
|
---|
151 | #endif
|
---|
152 |
|
---|
153 | /* point compression type */
|
---|
154 | ECC_POINT_COMP_EVEN = 0x02,
|
---|
155 | ECC_POINT_COMP_ODD = 0x03,
|
---|
156 | ECC_POINT_UNCOMP = 0x04,
|
---|
157 |
|
---|
158 | /* Shamir's dual add constants */
|
---|
159 | SHAMIR_PRECOMP_SZ = 16,
|
---|
160 |
|
---|
161 | #ifdef WOLF_CRYPTO_CB
|
---|
162 | ECC_MAX_ID_LEN = 32,
|
---|
163 | ECC_MAX_LABEL_LEN = 32,
|
---|
164 | #endif
|
---|
165 | };
|
---|
166 |
|
---|
167 | /* Curve Types */
|
---|
168 | typedef enum ecc_curve_id {
|
---|
169 | ECC_CURVE_INVALID = -1,
|
---|
170 | ECC_CURVE_DEF = 0, /* NIST or SECP */
|
---|
171 |
|
---|
172 | /* NIST Prime Curves */
|
---|
173 | ECC_SECP192R1,
|
---|
174 | ECC_PRIME192V2,
|
---|
175 | ECC_PRIME192V3,
|
---|
176 | ECC_PRIME239V1,
|
---|
177 | ECC_PRIME239V2,
|
---|
178 | ECC_PRIME239V3,
|
---|
179 | ECC_SECP256R1,
|
---|
180 |
|
---|
181 | /* SECP Curves */
|
---|
182 | ECC_SECP112R1,
|
---|
183 | ECC_SECP112R2,
|
---|
184 | ECC_SECP128R1,
|
---|
185 | ECC_SECP128R2,
|
---|
186 | ECC_SECP160R1,
|
---|
187 | ECC_SECP160R2,
|
---|
188 | ECC_SECP224R1,
|
---|
189 | ECC_SECP384R1,
|
---|
190 | ECC_SECP521R1,
|
---|
191 |
|
---|
192 | /* Koblitz */
|
---|
193 | ECC_SECP160K1,
|
---|
194 | ECC_SECP192K1,
|
---|
195 | ECC_SECP224K1,
|
---|
196 | ECC_SECP256K1,
|
---|
197 |
|
---|
198 | /* Brainpool Curves */
|
---|
199 | ECC_BRAINPOOLP160R1,
|
---|
200 | ECC_BRAINPOOLP192R1,
|
---|
201 | ECC_BRAINPOOLP224R1,
|
---|
202 | ECC_BRAINPOOLP256R1,
|
---|
203 | ECC_BRAINPOOLP320R1,
|
---|
204 | ECC_BRAINPOOLP384R1,
|
---|
205 | ECC_BRAINPOOLP512R1,
|
---|
206 |
|
---|
207 | /* Twisted Edwards Curves */
|
---|
208 | #ifdef HAVE_CURVE25519
|
---|
209 | ECC_X25519,
|
---|
210 | #endif
|
---|
211 | #ifdef HAVE_CURVE448
|
---|
212 | ECC_X448,
|
---|
213 | #endif
|
---|
214 |
|
---|
215 | #ifdef WOLFSSL_CUSTOM_CURVES
|
---|
216 | ECC_CURVE_CUSTOM,
|
---|
217 | #endif
|
---|
218 | ECC_CURVE_MAX
|
---|
219 | } ecc_curve_id;
|
---|
220 |
|
---|
221 | #ifdef HAVE_OID_ENCODING
|
---|
222 | typedef word16 ecc_oid_t;
|
---|
223 | #else
|
---|
224 | typedef byte ecc_oid_t;
|
---|
225 | /* OID encoded with ASN scheme:
|
---|
226 | first element = (oid[0] * 40) + oid[1]
|
---|
227 | if any element > 127 then MSB 0x80 indicates additional byte */
|
---|
228 | #endif
|
---|
229 |
|
---|
230 |
|
---|
231 | #if !defined(WOLFSSL_ECC_CURVE_STATIC) && defined(USE_WINDOWS_API)
|
---|
232 | /* MSC does something different with the pointers to the arrays than GCC,
|
---|
233 | * and it causes the FIPS checksum to fail. In the case of windows builds,
|
---|
234 | * store everything as arrays instead of pointers to strings. */
|
---|
235 |
|
---|
236 | #define WOLFSSL_ECC_CURVE_STATIC
|
---|
237 | #endif
|
---|
238 |
|
---|
239 | /* ECC set type defined a GF(p) curve */
|
---|
240 | #ifndef WOLFSSL_ECC_CURVE_STATIC
|
---|
241 | typedef struct ecc_set_type {
|
---|
242 | int size; /* The size of the curve in octets */
|
---|
243 | int id; /* id of this curve */
|
---|
244 | const char* name; /* name of this curve */
|
---|
245 | const char* prime; /* prime that defines the field, curve is in (hex) */
|
---|
246 | const char* Af; /* fields A param (hex) */
|
---|
247 | const char* Bf; /* fields B param (hex) */
|
---|
248 | const char* order; /* order of the curve (hex) */
|
---|
249 | const char* Gx; /* x coordinate of the base point on curve (hex) */
|
---|
250 | const char* Gy; /* y coordinate of the base point on curve (hex) */
|
---|
251 | const ecc_oid_t* oid;
|
---|
252 | word32 oidSz;
|
---|
253 | word32 oidSum; /* sum of encoded OID bytes */
|
---|
254 | int cofactor;
|
---|
255 | } ecc_set_type;
|
---|
256 | #else
|
---|
257 | #define MAX_ECC_NAME 16
|
---|
258 | #define MAX_ECC_STRING ((MAX_ECC_BYTES * 2) + 1)
|
---|
259 | /* The values are stored as text strings. */
|
---|
260 |
|
---|
261 | typedef struct ecc_set_type {
|
---|
262 | int size; /* The size of the curve in octets */
|
---|
263 | int id; /* id of this curve */
|
---|
264 | const char name[MAX_ECC_NAME]; /* name of this curve */
|
---|
265 | const char prime[MAX_ECC_STRING]; /* prime that defines the field, curve is in (hex) */
|
---|
266 | const char Af[MAX_ECC_STRING]; /* fields A param (hex) */
|
---|
267 | const char Bf[MAX_ECC_STRING]; /* fields B param (hex) */
|
---|
268 | const char order[MAX_ECC_STRING]; /* order of the curve (hex) */
|
---|
269 | const char Gx[MAX_ECC_STRING]; /* x coordinate of the base point on curve (hex) */
|
---|
270 | const char Gy[MAX_ECC_STRING]; /* y coordinate of the base point on curve (hex) */
|
---|
271 | const ecc_oid_t oid[10];
|
---|
272 | word32 oidSz;
|
---|
273 | word32 oidSum; /* sum of encoded OID bytes */
|
---|
274 | int cofactor;
|
---|
275 | } ecc_set_type;
|
---|
276 | #endif
|
---|
277 |
|
---|
278 |
|
---|
279 | #ifdef ALT_ECC_SIZE
|
---|
280 |
|
---|
281 | /* Note on ALT_ECC_SIZE:
|
---|
282 | * The fast math code uses an array of a fixed size to store the big integers.
|
---|
283 | * By default, the array is big enough for RSA keys. There is a size,
|
---|
284 | * FP_MAX_BITS which can be used to make the array smaller when one wants ECC
|
---|
285 | * but not RSA. Some people want fast math sized for both RSA and ECC, where
|
---|
286 | * ECC won't use as much as RSA. The flag ALT_ECC_SIZE switches in an alternate
|
---|
287 | * ecc_point structure that uses an alternate fp_int that has a shorter array
|
---|
288 | * of fp_digits.
|
---|
289 | *
|
---|
290 | * Now, without ALT_ECC_SIZE, the ecc_point has three single item arrays of
|
---|
291 | * mp_ints for the components of the point. With ALT_ECC_SIZE, the components
|
---|
292 | * of the point are pointers that are set to each of a three item array of
|
---|
293 | * alt_fp_ints. While an mp_int will have 4096 bits of digit inside the
|
---|
294 | * structure, the alt_fp_int will only have 512 bits for ECC 256-bit and
|
---|
295 | * 1056-bits for ECC 521-bit. A size value was added in the ALT case, as well,
|
---|
296 | * and is set by mp_init() and alt_fp_init(). The functions fp_zero() and
|
---|
297 | * fp_copy() use the size parameter. An int needs to be initialized before
|
---|
298 | * using it instead of just fp_zeroing it, the init will call zero. The
|
---|
299 | * FP_MAX_BITS_ECC defaults to calculating based on MAX_ECC_BITS, but
|
---|
300 | * can be set to change the number of bits used in the alternate FP_INT.
|
---|
301 | *
|
---|
302 | * The ALT_ECC_SIZE option only applies to stack based fast math USE_FAST_MATH.
|
---|
303 | */
|
---|
304 |
|
---|
305 | #ifndef USE_FAST_MATH
|
---|
306 | #error USE_FAST_MATH must be defined to use ALT_ECC_SIZE
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | /* determine max bits required for ECC math */
|
---|
310 | #ifndef FP_MAX_BITS_ECC
|
---|
311 | /* max bits rounded up by 8 then doubled */
|
---|
312 | /* (ROUND8(MAX_ECC_BITS) * 2) */
|
---|
313 | #define FP_MAX_BITS_ECC (2 * \
|
---|
314 | ((MAX_ECC_BITS + DIGIT_BIT - 1) / DIGIT_BIT) * DIGIT_BIT)
|
---|
315 |
|
---|
316 | /* Note: For ECC verify only FP_MAX_BITS_ECC can be reduced to:
|
---|
317 | ROUND8(MAX_ECC_BITS) + ROUND8(DIGIT_BIT) */
|
---|
318 | #endif
|
---|
319 |
|
---|
320 | /* verify alignment */
|
---|
321 | #if FP_MAX_BITS_ECC % CHAR_BIT
|
---|
322 | #error FP_MAX_BITS_ECC must be a multiple of CHAR_BIT
|
---|
323 | #endif
|
---|
324 |
|
---|
325 | /* determine buffer size */
|
---|
326 | /* Add one to accommodate extra digit used by sp_mul(), sp_mulmod(), sp_sqr(), and sp_sqrmod(). */
|
---|
327 | #define FP_SIZE_ECC ((FP_MAX_BITS_ECC/DIGIT_BIT) + 1)
|
---|
328 |
|
---|
329 |
|
---|
330 | /* This needs to match the size of the fp_int struct, except the
|
---|
331 | * fp_digit array will be shorter. */
|
---|
332 | typedef struct alt_fp_int {
|
---|
333 | int used, sign, size;
|
---|
334 | mp_digit dp[FP_SIZE_ECC];
|
---|
335 | } alt_fp_int;
|
---|
336 | #endif /* ALT_ECC_SIZE */
|
---|
337 |
|
---|
338 | #ifndef WC_ECCKEY_TYPE_DEFINED
|
---|
339 | typedef struct ecc_key ecc_key;
|
---|
340 | #define WC_ECCKEY_TYPE_DEFINED
|
---|
341 | #endif
|
---|
342 |
|
---|
343 |
|
---|
344 | /* A point on an ECC curve, stored in Jacobian format such that (x,y,z) =>
|
---|
345 | (x/z^2, y/z^3, 1) when interpreted as affine */
|
---|
346 | typedef struct {
|
---|
347 | #ifndef ALT_ECC_SIZE
|
---|
348 | mp_int x[1]; /* The x coordinate */
|
---|
349 | mp_int y[1]; /* The y coordinate */
|
---|
350 | mp_int z[1]; /* The z coordinate */
|
---|
351 | #else
|
---|
352 | mp_int* x; /* The x coordinate */
|
---|
353 | mp_int* y; /* The y coordinate */
|
---|
354 | mp_int* z; /* The z coordinate */
|
---|
355 | alt_fp_int xyz[3];
|
---|
356 | #endif
|
---|
357 | #ifdef WOLFSSL_SMALL_STACK_CACHE
|
---|
358 | ecc_key* key;
|
---|
359 | #endif
|
---|
360 | } ecc_point;
|
---|
361 |
|
---|
362 | /* ECC Flags */
|
---|
363 | enum {
|
---|
364 | WC_ECC_FLAG_NONE = 0x00,
|
---|
365 | #ifdef HAVE_ECC_CDH
|
---|
366 | WC_ECC_FLAG_COFACTOR = 0x01,
|
---|
367 | #endif
|
---|
368 | WC_ECC_FLAG_DEC_SIGN = 0x02,
|
---|
369 | };
|
---|
370 |
|
---|
371 | /* ECC non-blocking */
|
---|
372 | #ifdef WC_ECC_NONBLOCK
|
---|
373 | typedef struct ecc_nb_ctx {
|
---|
374 | #if defined(WOLFSSL_HAVE_SP_ECC) && defined(WOLFSSL_SP_NONBLOCK)
|
---|
375 | sp_ecc_ctx_t sp_ctx;
|
---|
376 | #else
|
---|
377 | /* build configuration not supported */
|
---|
378 | #error ECC non-blocking only supports SP (--enable-sp=nonblock)
|
---|
379 | #endif
|
---|
380 | } ecc_nb_ctx_t;
|
---|
381 | #endif /* WC_ECC_NONBLOCK */
|
---|
382 |
|
---|
383 |
|
---|
384 | /* An ECC Key */
|
---|
385 | struct ecc_key {
|
---|
386 | int type; /* Public or Private */
|
---|
387 | int idx; /* Index into the ecc_sets[] for the parameters of
|
---|
388 | this curve if -1, this key is using user supplied
|
---|
389 | curve in dp */
|
---|
390 | int state;
|
---|
391 | word32 flags;
|
---|
392 | const ecc_set_type* dp; /* domain parameters, either points to NIST
|
---|
393 | curves (idx >= 0) or user supplied */
|
---|
394 | #ifdef WOLFSSL_CUSTOM_CURVES
|
---|
395 | int deallocSet;
|
---|
396 | #endif
|
---|
397 | void* heap; /* heap hint */
|
---|
398 | ecc_point pubkey; /* public key */
|
---|
399 | mp_int k; /* private key */
|
---|
400 | #if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A)
|
---|
401 | int slot; /* Key Slot Number (-1 unknown) */
|
---|
402 | byte pubkey_raw[ECC_MAX_CRYPTO_HW_PUBKEY_SIZE];
|
---|
403 | #endif
|
---|
404 | #if defined(PLUTON_CRYPTO_ECC) || defined(WOLF_CRYPTO_CB)
|
---|
405 | int devId;
|
---|
406 | #endif
|
---|
407 | #ifdef WOLFSSL_SILABS_SE_ACCEL
|
---|
408 | sl_se_command_context_t cmd_ctx;
|
---|
409 | sl_se_key_descriptor_t key;
|
---|
410 | /* Used for SiLabs "plaintext" with public X, public Y, and
|
---|
411 | * private D concatenated. These are respectively at offset `0`,
|
---|
412 | * offset `keysize`, and offset `2 * keysize`.
|
---|
413 | */
|
---|
414 | byte key_raw[3 * ECC_MAX_CRYPTO_HW_SIZE];
|
---|
415 | #endif
|
---|
416 |
|
---|
417 | #ifdef WOLFSSL_ASYNC_CRYPT
|
---|
418 | mp_int* r; /* sign/verify temps */
|
---|
419 | mp_int* s;
|
---|
420 | WC_ASYNC_DEV asyncDev;
|
---|
421 | #ifdef HAVE_CAVIUM_V
|
---|
422 | mp_int* e; /* Sign, Verify and Shared Secret */
|
---|
423 | mp_int* signK;
|
---|
424 | #endif
|
---|
425 | #ifdef WOLFSSL_CERT_GEN
|
---|
426 | CertSignCtx certSignCtx; /* context info for cert sign (MakeSignature) */
|
---|
427 | #endif
|
---|
428 | #endif /* WOLFSSL_ASYNC_CRYPT */
|
---|
429 | #ifdef WOLF_CRYPTO_CB
|
---|
430 | byte id[ECC_MAX_ID_LEN];
|
---|
431 | int idLen;
|
---|
432 | char label[ECC_MAX_LABEL_LEN];
|
---|
433 | int labelLen;
|
---|
434 | #endif
|
---|
435 | #if defined(WOLFSSL_CRYPTOCELL)
|
---|
436 | ecc_context_t ctx;
|
---|
437 | #endif
|
---|
438 |
|
---|
439 | #ifdef WOLFSSL_ECDSA_SET_K
|
---|
440 | mp_int *sign_k;
|
---|
441 | #endif
|
---|
442 |
|
---|
443 | #ifdef WOLFSSL_SMALL_STACK_CACHE
|
---|
444 | mp_int* t1;
|
---|
445 | mp_int* t2;
|
---|
446 | #ifdef ALT_ECC_SIZE
|
---|
447 | mp_int* x;
|
---|
448 | mp_int* y;
|
---|
449 | mp_int* z;
|
---|
450 | #endif
|
---|
451 | #endif
|
---|
452 |
|
---|
453 | #ifdef WOLFSSL_DSP
|
---|
454 | remote_handle64 handle;
|
---|
455 | #endif
|
---|
456 | #ifdef ECC_TIMING_RESISTANT
|
---|
457 | WC_RNG* rng;
|
---|
458 | #endif
|
---|
459 | #ifdef WC_ECC_NONBLOCK
|
---|
460 | ecc_nb_ctx_t* nb_ctx;
|
---|
461 | #endif
|
---|
462 | };
|
---|
463 |
|
---|
464 |
|
---|
465 | WOLFSSL_ABI WOLFSSL_API ecc_key* wc_ecc_key_new(void*);
|
---|
466 | WOLFSSL_ABI WOLFSSL_API void wc_ecc_key_free(ecc_key*);
|
---|
467 |
|
---|
468 |
|
---|
469 | /* ECC predefined curve sets */
|
---|
470 | extern const ecc_set_type ecc_sets[];
|
---|
471 | extern const size_t ecc_sets_count;
|
---|
472 |
|
---|
473 | WOLFSSL_API
|
---|
474 | const char* wc_ecc_get_name(int curve_id);
|
---|
475 |
|
---|
476 | #if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A)
|
---|
477 |
|
---|
478 | #ifdef WOLFSSL_PUBLIC_ECC_ADD_DBL
|
---|
479 | #define ECC_API WOLFSSL_API
|
---|
480 | #else
|
---|
481 | #define ECC_API WOLFSSL_LOCAL
|
---|
482 | #endif
|
---|
483 |
|
---|
484 | ECC_API int ecc_mul2add(ecc_point* A, mp_int* kA,
|
---|
485 | ecc_point* B, mp_int* kB,
|
---|
486 | ecc_point* C, mp_int* a, mp_int* modulus, void* heap);
|
---|
487 |
|
---|
488 | ECC_API int ecc_map(ecc_point*, mp_int*, mp_digit);
|
---|
489 | ECC_API int ecc_map_ex(ecc_point*, mp_int*, mp_digit, int ct);
|
---|
490 | ECC_API int ecc_projective_add_point(ecc_point* P, ecc_point* Q, ecc_point* R,
|
---|
491 | mp_int* a, mp_int* modulus, mp_digit mp);
|
---|
492 | ECC_API int ecc_projective_dbl_point(ecc_point* P, ecc_point* R, mp_int* a,
|
---|
493 | mp_int* modulus, mp_digit mp);
|
---|
494 |
|
---|
495 | WOLFSSL_LOCAL
|
---|
496 | int ecc_projective_add_point_safe(ecc_point* A, ecc_point* B, ecc_point* R,
|
---|
497 | mp_int* a, mp_int* modulus, mp_digit mp, int* infinity);
|
---|
498 | WOLFSSL_LOCAL
|
---|
499 | int ecc_projective_dbl_point_safe(ecc_point* P, ecc_point* R, mp_int* a,
|
---|
500 | mp_int* modulus, mp_digit mp);
|
---|
501 |
|
---|
502 | #endif
|
---|
503 |
|
---|
504 | WOLFSSL_API
|
---|
505 | int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
|
---|
506 | WOLFSSL_ABI WOLFSSL_API
|
---|
507 | int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id);
|
---|
508 | WOLFSSL_API
|
---|
509 | int wc_ecc_make_key_ex2(WC_RNG* rng, int keysize, ecc_key* key, int curve_id,
|
---|
510 | int flags);
|
---|
511 | WOLFSSL_API
|
---|
512 | int wc_ecc_make_pub(ecc_key* key, ecc_point* pubOut);
|
---|
513 | WOLFSSL_API
|
---|
514 | int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng);
|
---|
515 | WOLFSSL_API
|
---|
516 | int wc_ecc_check_key(ecc_key* key);
|
---|
517 | WOLFSSL_API
|
---|
518 | int wc_ecc_is_point(ecc_point* ecp, mp_int* a, mp_int* b, mp_int* prime);
|
---|
519 | WOLFSSL_API
|
---|
520 | int wc_ecc_get_generator(ecc_point* ecp, int curve_idx);
|
---|
521 |
|
---|
522 | #ifdef HAVE_ECC_DHE
|
---|
523 | WOLFSSL_API
|
---|
524 | int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
|
---|
525 | word32* outlen);
|
---|
526 | WOLFSSL_LOCAL
|
---|
527 | int wc_ecc_shared_secret_gen(ecc_key* private_key, ecc_point* point,
|
---|
528 | byte* out, word32 *outlen);
|
---|
529 | WOLFSSL_API
|
---|
530 | int wc_ecc_shared_secret_ex(ecc_key* private_key, ecc_point* point,
|
---|
531 | byte* out, word32 *outlen);
|
---|
532 |
|
---|
533 | #if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) || \
|
---|
534 | defined(PLUTON_CRYPTO_ECC) || defined(WOLFSSL_CRYPTOCELL)
|
---|
535 | #define wc_ecc_shared_secret_ssh wc_ecc_shared_secret
|
---|
536 | #else
|
---|
537 | #define wc_ecc_shared_secret_ssh wc_ecc_shared_secret_ex /* For backwards compat */
|
---|
538 | #endif
|
---|
539 |
|
---|
540 | #endif /* HAVE_ECC_DHE */
|
---|
541 |
|
---|
542 | #ifdef HAVE_ECC_SIGN
|
---|
543 | WOLFSSL_ABI WOLFSSL_API
|
---|
544 | int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen,
|
---|
545 | WC_RNG* rng, ecc_key* key);
|
---|
546 | WOLFSSL_API
|
---|
547 | int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, WC_RNG* rng,
|
---|
548 | ecc_key* key, mp_int *r, mp_int *s);
|
---|
549 | #ifdef WOLFSSL_ECDSA_SET_K
|
---|
550 | WOLFSSL_API
|
---|
551 | int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key);
|
---|
552 | #endif
|
---|
553 | #endif /* HAVE_ECC_SIGN */
|
---|
554 |
|
---|
555 | #ifdef HAVE_ECC_VERIFY
|
---|
556 | WOLFSSL_API
|
---|
557 | int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
---|
558 | word32 hashlen, int* stat, ecc_key* key);
|
---|
559 | WOLFSSL_API
|
---|
560 | int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
---|
561 | word32 hashlen, int* stat, ecc_key* key);
|
---|
562 | #endif /* HAVE_ECC_VERIFY */
|
---|
563 |
|
---|
564 | WOLFSSL_API
|
---|
565 | int wc_ecc_init(ecc_key* key);
|
---|
566 | WOLFSSL_ABI WOLFSSL_API
|
---|
567 | int wc_ecc_init_ex(ecc_key* key, void* heap, int devId);
|
---|
568 | #ifdef WOLF_CRYPTO_CB
|
---|
569 | WOLFSSL_API
|
---|
570 | int wc_ecc_init_id(ecc_key* key, unsigned char* id, int len, void* heap,
|
---|
571 | int devId);
|
---|
572 | WOLFSSL_API
|
---|
573 | int wc_ecc_init_label(ecc_key* key, const char* label, void* heap, int devId);
|
---|
574 | #endif
|
---|
575 | #ifdef WOLFSSL_CUSTOM_CURVES
|
---|
576 | WOLFSSL_LOCAL
|
---|
577 | void wc_ecc_free_curve(const ecc_set_type* curve, void* heap);
|
---|
578 | #endif
|
---|
579 | WOLFSSL_ABI WOLFSSL_API
|
---|
580 | int wc_ecc_free(ecc_key* key);
|
---|
581 | WOLFSSL_API
|
---|
582 | int wc_ecc_set_flags(ecc_key* key, word32 flags);
|
---|
583 | WOLFSSL_API
|
---|
584 | void wc_ecc_fp_free(void);
|
---|
585 | WOLFSSL_LOCAL
|
---|
586 | void wc_ecc_fp_init(void);
|
---|
587 | #ifdef ECC_TIMING_RESISTANT
|
---|
588 | WOLFSSL_API
|
---|
589 | int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng);
|
---|
590 | #endif
|
---|
591 |
|
---|
592 | WOLFSSL_API
|
---|
593 | int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id);
|
---|
594 |
|
---|
595 | WOLFSSL_API
|
---|
596 | int wc_ecc_is_valid_idx(int n);
|
---|
597 | WOLFSSL_API
|
---|
598 | int wc_ecc_get_curve_idx(int curve_id);
|
---|
599 | WOLFSSL_API
|
---|
600 | int wc_ecc_get_curve_id(int curve_idx);
|
---|
601 | #define wc_ecc_get_curve_name_from_id wc_ecc_get_name
|
---|
602 | WOLFSSL_API
|
---|
603 | int wc_ecc_get_curve_size_from_id(int curve_id);
|
---|
604 |
|
---|
605 | WOLFSSL_API
|
---|
606 | int wc_ecc_get_curve_idx_from_name(const char* curveName);
|
---|
607 | WOLFSSL_API
|
---|
608 | int wc_ecc_get_curve_size_from_name(const char* curveName);
|
---|
609 | WOLFSSL_API
|
---|
610 | int wc_ecc_get_curve_id_from_name(const char* curveName);
|
---|
611 | WOLFSSL_API
|
---|
612 | int wc_ecc_get_curve_id_from_params(int fieldSize,
|
---|
613 | const byte* prime, word32 primeSz, const byte* Af, word32 AfSz,
|
---|
614 | const byte* Bf, word32 BfSz, const byte* order, word32 orderSz,
|
---|
615 | const byte* Gx, word32 GxSz, const byte* Gy, word32 GySz, int cofactor);
|
---|
616 | WOLFSSL_API
|
---|
617 | int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp);
|
---|
618 |
|
---|
619 | WOLFSSL_API
|
---|
620 | int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len);
|
---|
621 |
|
---|
622 | WOLFSSL_API const ecc_set_type* wc_ecc_get_curve_params(int curve_idx);
|
---|
623 |
|
---|
624 | WOLFSSL_API
|
---|
625 | ecc_point* wc_ecc_new_point(void);
|
---|
626 | WOLFSSL_API
|
---|
627 | ecc_point* wc_ecc_new_point_h(void* h);
|
---|
628 | WOLFSSL_API
|
---|
629 | void wc_ecc_del_point(ecc_point* p);
|
---|
630 | WOLFSSL_API
|
---|
631 | void wc_ecc_del_point_h(ecc_point* p, void* h);
|
---|
632 | WOLFSSL_API
|
---|
633 | int wc_ecc_copy_point(ecc_point* p, ecc_point *r);
|
---|
634 | WOLFSSL_API
|
---|
635 | int wc_ecc_cmp_point(ecc_point* a, ecc_point *b);
|
---|
636 | WOLFSSL_API
|
---|
637 | int wc_ecc_point_is_at_infinity(ecc_point *p);
|
---|
638 | WOLFSSL_API
|
---|
639 | int wc_ecc_point_is_on_curve(ecc_point *p, int curve_idx);
|
---|
640 |
|
---|
641 | #if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A)
|
---|
642 | WOLFSSL_API
|
---|
643 | int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R,
|
---|
644 | mp_int* a, mp_int* modulus, int map);
|
---|
645 | WOLFSSL_LOCAL
|
---|
646 | int wc_ecc_mulmod_ex(mp_int* k, ecc_point *G, ecc_point *R,
|
---|
647 | mp_int* a, mp_int* modulus, int map, void* heap);
|
---|
648 | WOLFSSL_LOCAL
|
---|
649 | int wc_ecc_mulmod_ex2(mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
|
---|
650 | mp_int* modulus, mp_int* order, WC_RNG* rng, int map,
|
---|
651 | void* heap);
|
---|
652 | #endif /* !WOLFSSL_ATECC508A */
|
---|
653 |
|
---|
654 |
|
---|
655 | #ifdef HAVE_ECC_KEY_EXPORT
|
---|
656 | /* ASN key helpers */
|
---|
657 | WOLFSSL_API
|
---|
658 | int wc_ecc_export_x963(ecc_key*, byte* out, word32* outLen);
|
---|
659 | WOLFSSL_API
|
---|
660 | int wc_ecc_export_x963_ex(ecc_key*, byte* out, word32* outLen, int compressed);
|
---|
661 | /* extended functionality with compressed option */
|
---|
662 | #endif /* HAVE_ECC_KEY_EXPORT */
|
---|
663 |
|
---|
664 | #ifdef HAVE_ECC_KEY_IMPORT
|
---|
665 | WOLFSSL_ABI WOLFSSL_API
|
---|
666 | int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key);
|
---|
667 | WOLFSSL_API
|
---|
668 | int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key,
|
---|
669 | int curve_id);
|
---|
670 | WOLFSSL_API
|
---|
671 | int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
|
---|
672 | word32 pubSz, ecc_key* key);
|
---|
673 | WOLFSSL_API
|
---|
674 | int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
|
---|
675 | const byte* pub, word32 pubSz, ecc_key* key, int curve_id);
|
---|
676 | WOLFSSL_API
|
---|
677 | int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen);
|
---|
678 | WOLFSSL_API
|
---|
679 | int wc_ecc_rs_raw_to_sig(const byte* r, word32 rSz, const byte* s, word32 sSz,
|
---|
680 | byte* out, word32* outlen);
|
---|
681 | WOLFSSL_API
|
---|
682 | int wc_ecc_sig_to_rs(const byte* sig, word32 sigLen, byte* r, word32* rLen,
|
---|
683 | byte* s, word32* sLen);
|
---|
684 | WOLFSSL_API
|
---|
685 | int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy,
|
---|
686 | const char* d, const char* curveName);
|
---|
687 | WOLFSSL_API
|
---|
688 | int wc_ecc_import_raw_ex(ecc_key* key, const char* qx, const char* qy,
|
---|
689 | const char* d, int curve_id);
|
---|
690 | WOLFSSL_API
|
---|
691 | int wc_ecc_import_unsigned(ecc_key* key, byte* qx, byte* qy,
|
---|
692 | byte* d, int curve_id);
|
---|
693 | #endif /* HAVE_ECC_KEY_IMPORT */
|
---|
694 |
|
---|
695 | #ifdef HAVE_ECC_KEY_EXPORT
|
---|
696 | WOLFSSL_API
|
---|
697 | int wc_ecc_export_ex(ecc_key* key, byte* qx, word32* qxLen,
|
---|
698 | byte* qy, word32* qyLen, byte* d, word32* dLen,
|
---|
699 | int encType);
|
---|
700 | WOLFSSL_API
|
---|
701 | int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen);
|
---|
702 | WOLFSSL_API
|
---|
703 | int wc_ecc_export_public_raw(ecc_key* key, byte* qx, word32* qxLen,
|
---|
704 | byte* qy, word32* qyLen);
|
---|
705 | WOLFSSL_API
|
---|
706 | int wc_ecc_export_private_raw(ecc_key* key, byte* qx, word32* qxLen,
|
---|
707 | byte* qy, word32* qyLen, byte* d, word32* dLen);
|
---|
708 | #endif /* HAVE_ECC_KEY_EXPORT */
|
---|
709 |
|
---|
710 | #ifdef HAVE_ECC_KEY_EXPORT
|
---|
711 | WOLFSSL_API
|
---|
712 | int wc_ecc_export_point_der_ex(const int curve_idx, ecc_point* point, byte* out,
|
---|
713 | word32* outLen, int compressed);
|
---|
714 | WOLFSSL_API
|
---|
715 | int wc_ecc_export_point_der(const int curve_idx, ecc_point* point,
|
---|
716 | byte* out, word32* outLen);
|
---|
717 | WOLFSSL_LOCAL
|
---|
718 | int wc_ecc_export_point_der_compressed(const int curve_idx, ecc_point* point,
|
---|
719 | byte* out, word32* outLen);
|
---|
720 | #endif /* HAVE_ECC_KEY_EXPORT */
|
---|
721 |
|
---|
722 |
|
---|
723 | #ifdef HAVE_ECC_KEY_IMPORT
|
---|
724 | WOLFSSL_API
|
---|
725 | int wc_ecc_import_point_der_ex(byte* in, word32 inLen, const int curve_idx,
|
---|
726 | ecc_point* point, int shortKeySize);
|
---|
727 | WOLFSSL_API
|
---|
728 | int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx,
|
---|
729 | ecc_point* point);
|
---|
730 | #endif /* HAVE_ECC_KEY_IMPORT */
|
---|
731 |
|
---|
732 | /* size helper */
|
---|
733 | WOLFSSL_API
|
---|
734 | int wc_ecc_size(ecc_key* key);
|
---|
735 | WOLFSSL_API
|
---|
736 | int wc_ecc_sig_size_calc(int sz);
|
---|
737 | WOLFSSL_API
|
---|
738 | int wc_ecc_sig_size(ecc_key* key);
|
---|
739 |
|
---|
740 | WOLFSSL_API
|
---|
741 | int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz);
|
---|
742 |
|
---|
743 | #ifdef WOLFSSL_CUSTOM_CURVES
|
---|
744 | WOLFSSL_API
|
---|
745 | int wc_ecc_set_custom_curve(ecc_key* key, const ecc_set_type* dp);
|
---|
746 | #endif
|
---|
747 |
|
---|
748 | #ifdef HAVE_ECC_ENCRYPT
|
---|
749 | /* ecc encrypt */
|
---|
750 |
|
---|
751 | enum ecEncAlgo {
|
---|
752 | ecAES_128_CBC = 1, /* default */
|
---|
753 | ecAES_256_CBC = 2
|
---|
754 | };
|
---|
755 |
|
---|
756 | enum ecKdfAlgo {
|
---|
757 | ecHKDF_SHA256 = 1, /* default */
|
---|
758 | ecHKDF_SHA1 = 2
|
---|
759 | };
|
---|
760 |
|
---|
761 | enum ecMacAlgo {
|
---|
762 | ecHMAC_SHA256 = 1, /* default */
|
---|
763 | ecHMAC_SHA1 = 2
|
---|
764 | };
|
---|
765 |
|
---|
766 | enum {
|
---|
767 | KEY_SIZE_128 = 16,
|
---|
768 | KEY_SIZE_256 = 32,
|
---|
769 | IV_SIZE_64 = 8,
|
---|
770 | IV_SIZE_128 = 16,
|
---|
771 | EXCHANGE_SALT_SZ = 16,
|
---|
772 | EXCHANGE_INFO_SZ = 23
|
---|
773 | };
|
---|
774 |
|
---|
775 | enum ecFlags {
|
---|
776 | REQ_RESP_CLIENT = 1,
|
---|
777 | REQ_RESP_SERVER = 2
|
---|
778 | };
|
---|
779 |
|
---|
780 |
|
---|
781 | typedef struct ecEncCtx ecEncCtx;
|
---|
782 |
|
---|
783 | WOLFSSL_API
|
---|
784 | ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng);
|
---|
785 | WOLFSSL_API
|
---|
786 | ecEncCtx* wc_ecc_ctx_new_ex(int flags, WC_RNG* rng, void* heap);
|
---|
787 | WOLFSSL_API
|
---|
788 | void wc_ecc_ctx_free(ecEncCtx*);
|
---|
789 | WOLFSSL_API
|
---|
790 | int wc_ecc_ctx_reset(ecEncCtx*, WC_RNG*); /* reset for use again w/o alloc/free */
|
---|
791 |
|
---|
792 | WOLFSSL_API
|
---|
793 | const byte* wc_ecc_ctx_get_own_salt(ecEncCtx*);
|
---|
794 | WOLFSSL_API
|
---|
795 | int wc_ecc_ctx_set_peer_salt(ecEncCtx*, const byte* salt);
|
---|
796 | WOLFSSL_API
|
---|
797 | int wc_ecc_ctx_set_info(ecEncCtx*, const byte* info, int sz);
|
---|
798 |
|
---|
799 | WOLFSSL_API
|
---|
800 | int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
|
---|
801 | word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx);
|
---|
802 | WOLFSSL_API
|
---|
803 | int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
|
---|
804 | word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx);
|
---|
805 |
|
---|
806 | #endif /* HAVE_ECC_ENCRYPT */
|
---|
807 |
|
---|
808 | #ifdef HAVE_X963_KDF
|
---|
809 | WOLFSSL_API int wc_X963_KDF(enum wc_HashType type, const byte* secret,
|
---|
810 | word32 secretSz, const byte* sinfo, word32 sinfoSz,
|
---|
811 | byte* out, word32 outSz);
|
---|
812 | #endif
|
---|
813 |
|
---|
814 | #ifdef ECC_CACHE_CURVE
|
---|
815 | WOLFSSL_API int wc_ecc_curve_cache_init(void);
|
---|
816 | WOLFSSL_API void wc_ecc_curve_cache_free(void);
|
---|
817 | #endif
|
---|
818 |
|
---|
819 | WOLFSSL_API
|
---|
820 | int wc_ecc_gen_k(WC_RNG* rng, int size, mp_int* k, mp_int* order);
|
---|
821 |
|
---|
822 | #ifdef WOLFSSL_DSP
|
---|
823 | WOLFSSL_API
|
---|
824 | int wc_ecc_set_handle(ecc_key* key, remote_handle64 handle);
|
---|
825 | WOLFSSL_LOCAL
|
---|
826 | int sp_dsp_ecc_verify_256(remote_handle64 handle, const byte* hash, word32 hashLen, mp_int* pX,
|
---|
827 | mp_int* pY, mp_int* pZ, mp_int* r, mp_int* sm, int* res, void* heap);
|
---|
828 | #endif
|
---|
829 |
|
---|
830 | #ifdef WC_ECC_NONBLOCK
|
---|
831 | WOLFSSL_API int wc_ecc_set_nonblock(ecc_key *key, ecc_nb_ctx_t* ctx);
|
---|
832 | #endif
|
---|
833 |
|
---|
834 | #ifdef __cplusplus
|
---|
835 | } /* extern "C" */
|
---|
836 | #endif
|
---|
837 |
|
---|
838 | #endif /* HAVE_ECC */
|
---|
839 | #endif /* WOLF_CRYPT_ECC_H */
|
---|