blob: 55f1ea86ef711d2e897ca4f41d2ac6a475ada857 [file] [log] [blame]
Jarno Lamsa18987a42019-04-24 15:40:43 +03001/* ecc.h - TinyCrypt interface to common ECC functions */
2
3/* Copyright (c) 2014, Kenneth MacKay
4 * All rights reserved.
5 *
Simon Butchercffedb52019-09-09 16:28:54 +01006 * SPDX-License-Identifier: BSD-3-Clause
7 *
Jarno Lamsa18987a42019-04-24 15:40:43 +03008 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * * Redistributions of source code must retain the above copyright notice, this
12 * list of conditions and the following disclaimer.
13 *
14 * * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/*
32 * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions are met:
36 *
37 * - Redistributions of source code must retain the above copyright notice,
38 * this list of conditions and the following disclaimer.
39 *
40 * - Redistributions in binary form must reproduce the above copyright
41 * notice, this list of conditions and the following disclaimer in the
42 * documentation and/or other materials provided with the distribution.
43 *
44 * - Neither the name of Intel Corporation nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
52 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
53 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
54 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
55 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
58 * POSSIBILITY OF SUCH DAMAGE.
59 */
60
61/**
62 * @file
63 * @brief -- Interface to common ECC functions.
64 *
65 * Overview: This software is an implementation of common functions
66 * necessary to elliptic curve cryptography. This implementation uses
67 * curve NIST p-256.
68 *
69 * Security: The curve NIST p-256 provides approximately 128 bits of security.
70 *
71 */
72
Manuel Pégourié-Gonnardafdc1b52019-05-09 11:24:11 +020073#if defined(MBEDTLS_USE_TINYCRYPT)
Jarno Lamsa18987a42019-04-24 15:40:43 +030074#ifndef __TC_UECC_H__
75#define __TC_UECC_H__
76
77#include <stdint.h>
78
79#ifdef __cplusplus
80extern "C" {
81#endif
82
83/* Word size (4 bytes considering 32-bits architectures) */
84#define uECC_WORD_SIZE 4
85
86/* setting max number of calls to prng: */
87#ifndef uECC_RNG_MAX_TRIES
88#define uECC_RNG_MAX_TRIES 64
89#endif
90
91/* defining data types to store word and bit counts: */
92typedef int8_t wordcount_t;
93typedef int16_t bitcount_t;
94/* defining data type for comparison result: */
95typedef int8_t cmpresult_t;
96/* defining data type to store ECC coordinate/point in 32bits words: */
97typedef unsigned int uECC_word_t;
98/* defining data type to store an ECC coordinate/point in 64bits words: */
99typedef uint64_t uECC_dword_t;
100
101/* defining masks useful for ecc computations: */
102#define HIGH_BIT_SET 0x80000000
103#define uECC_WORD_BITS 32
104#define uECC_WORD_BITS_SHIFT 5
105#define uECC_WORD_BITS_MASK 0x01F
106
107/* Number of words of 32 bits to represent an element of the the curve p-256: */
108#define NUM_ECC_WORDS 8
109/* Number of bytes to represent an element of the the curve p-256: */
110#define NUM_ECC_BYTES (uECC_WORD_SIZE*NUM_ECC_WORDS)
111
112/* structure that represents an elliptic curve (e.g. p256):*/
113struct uECC_Curve_t;
114typedef const struct uECC_Curve_t * uECC_Curve;
115struct uECC_Curve_t {
116 wordcount_t num_words;
117 wordcount_t num_bytes;
118 bitcount_t num_n_bits;
119 uECC_word_t p[NUM_ECC_WORDS];
120 uECC_word_t n[NUM_ECC_WORDS];
121 uECC_word_t G[NUM_ECC_WORDS * 2];
122 uECC_word_t b[NUM_ECC_WORDS];
123 void (*double_jacobian)(uECC_word_t * X1, uECC_word_t * Y1, uECC_word_t * Z1,
124 uECC_Curve curve);
125 void (*x_side)(uECC_word_t *result, const uECC_word_t *x, uECC_Curve curve);
126 void (*mmod_fast)(uECC_word_t *result, uECC_word_t *product);
127};
128
129/*
130 * @brief computes doubling of point ion jacobian coordinates, in place.
131 * @param X1 IN/OUT -- x coordinate
132 * @param Y1 IN/OUT -- y coordinate
133 * @param Z1 IN/OUT -- z coordinate
134 * @param curve IN -- elliptic curve
135 */
136void double_jacobian_default(uECC_word_t * X1, uECC_word_t * Y1,
137 uECC_word_t * Z1, uECC_Curve curve);
138
139/*
140 * @brief Computes x^3 + ax + b. result must not overlap x.
141 * @param result OUT -- x^3 + ax + b
142 * @param x IN -- value of x
143 * @param curve IN -- elliptic curve
144 */
145void x_side_default(uECC_word_t *result, const uECC_word_t *x,
146 uECC_Curve curve);
147
148/*
149 * @brief Computes result = product % curve_p
150 * from http://www.nsa.gov/ia/_files/nist-routines.pdf
151 * @param result OUT -- product % curve_p
152 * @param product IN -- value to be reduced mod curve_p
153 */
154void vli_mmod_fast_secp256r1(unsigned int *result, unsigned int *product);
155
156/* Bytes to words ordering: */
157#define BYTES_TO_WORDS_8(a, b, c, d, e, f, g, h) 0x##d##c##b##a, 0x##h##g##f##e
158#define BYTES_TO_WORDS_4(a, b, c, d) 0x##d##c##b##a
159#define BITS_TO_WORDS(num_bits) \
160 ((num_bits + ((uECC_WORD_SIZE * 8) - 1)) / (uECC_WORD_SIZE * 8))
161#define BITS_TO_BYTES(num_bits) ((num_bits + 7) / 8)
162
163/* definition of curve NIST p-256: */
164static const struct uECC_Curve_t curve_secp256r1 = {
165 NUM_ECC_WORDS,
166 NUM_ECC_BYTES,
167 256, /* num_n_bits */ {
168 BYTES_TO_WORDS_8(FF, FF, FF, FF, FF, FF, FF, FF),
169 BYTES_TO_WORDS_8(FF, FF, FF, FF, 00, 00, 00, 00),
170 BYTES_TO_WORDS_8(00, 00, 00, 00, 00, 00, 00, 00),
171 BYTES_TO_WORDS_8(01, 00, 00, 00, FF, FF, FF, FF)
172 }, {
173 BYTES_TO_WORDS_8(51, 25, 63, FC, C2, CA, B9, F3),
174 BYTES_TO_WORDS_8(84, 9E, 17, A7, AD, FA, E6, BC),
175 BYTES_TO_WORDS_8(FF, FF, FF, FF, FF, FF, FF, FF),
176 BYTES_TO_WORDS_8(00, 00, 00, 00, FF, FF, FF, FF)
177 }, {
178 BYTES_TO_WORDS_8(96, C2, 98, D8, 45, 39, A1, F4),
179 BYTES_TO_WORDS_8(A0, 33, EB, 2D, 81, 7D, 03, 77),
180 BYTES_TO_WORDS_8(F2, 40, A4, 63, E5, E6, BC, F8),
181 BYTES_TO_WORDS_8(47, 42, 2C, E1, F2, D1, 17, 6B),
182
183 BYTES_TO_WORDS_8(F5, 51, BF, 37, 68, 40, B6, CB),
184 BYTES_TO_WORDS_8(CE, 5E, 31, 6B, 57, 33, CE, 2B),
185 BYTES_TO_WORDS_8(16, 9E, 0F, 7C, 4A, EB, E7, 8E),
186 BYTES_TO_WORDS_8(9B, 7F, 1A, FE, E2, 42, E3, 4F)
187 }, {
188 BYTES_TO_WORDS_8(4B, 60, D2, 27, 3E, 3C, CE, 3B),
189 BYTES_TO_WORDS_8(F6, B0, 53, CC, B0, 06, 1D, 65),
190 BYTES_TO_WORDS_8(BC, 86, 98, 76, 55, BD, EB, B3),
191 BYTES_TO_WORDS_8(E7, 93, 3A, AA, D8, 35, C6, 5A)
192 },
193 &double_jacobian_default,
194 &x_side_default,
195 &vli_mmod_fast_secp256r1
196};
197
198uECC_Curve uECC_secp256r1(void);
199
200/*
201 * @brief Generates a random integer in the range 0 < random < top.
202 * Both random and top have num_words words.
203 * @param random OUT -- random integer in the range 0 < random < top
204 * @param top IN -- upper limit
205 * @param num_words IN -- number of words
206 * @return a random integer in the range 0 < random < top
207 */
208int uECC_generate_random_int(uECC_word_t *random, const uECC_word_t *top,
209 wordcount_t num_words);
210
211
212/* uECC_RNG_Function type
213 * The RNG function should fill 'size' random bytes into 'dest'. It should
214 * return 1 if 'dest' was filled with random data, or 0 if the random data could
215 * not be generated. The filled-in values should be either truly random, or from
216 * a cryptographically-secure PRNG.
217 *
218 * A correctly functioning RNG function must be set (using uECC_set_rng())
219 * before calling uECC_make_key() or uECC_sign().
220 *
221 * Setting a correctly functioning RNG function improves the resistance to
222 * side-channel attacks for uECC_shared_secret().
223 *
224 * A correct RNG function is set by default. If you are building on another
225 * POSIX-compliant system that supports /dev/random or /dev/urandom, you can
226 * define uECC_POSIX to use the predefined RNG.
227 */
228typedef int(*uECC_RNG_Function)(uint8_t *dest, unsigned int size);
229
230/*
231 * @brief Set the function that will be used to generate random bytes. The RNG
232 * function should return 1 if the random data was generated, or 0 if the random
233 * data could not be generated.
234 *
235 * @note On platforms where there is no predefined RNG function, this must be
236 * called before uECC_make_key() or uECC_sign() are used.
237 *
238 * @param rng_function IN -- function that will be used to generate random bytes
239 */
240void uECC_set_rng(uECC_RNG_Function rng_function);
241
242/*
243 * @brief provides current uECC_RNG_Function.
244 * @return Returns the function that will be used to generate random bytes.
245 */
246uECC_RNG_Function uECC_get_rng(void);
247
248/*
249 * @brief computes the size of a private key for the curve in bytes.
250 * @param curve IN -- elliptic curve
251 * @return size of a private key for the curve in bytes.
252 */
253int uECC_curve_private_key_size(uECC_Curve curve);
254
255/*
256 * @brief computes the size of a public key for the curve in bytes.
257 * @param curve IN -- elliptic curve
258 * @return the size of a public key for the curve in bytes.
259 */
260int uECC_curve_public_key_size(uECC_Curve curve);
261
262/*
263 * @brief Compute the corresponding public key for a private key.
264 * @param private_key IN -- The private key to compute the public key for
265 * @param public_key OUT -- Will be filled in with the corresponding public key
266 * @param curve
267 * @return Returns 1 if key was computed successfully, 0 if an error occurred.
268 */
269int uECC_compute_public_key(const uint8_t *private_key,
270 uint8_t *public_key, uECC_Curve curve);
271
272/*
273 * @brief Compute public-key.
274 * @return corresponding public-key.
275 * @param result OUT -- public-key
276 * @param private_key IN -- private-key
277 * @param curve IN -- elliptic curve
278 */
279uECC_word_t EccPoint_compute_public_key(uECC_word_t *result,
280 uECC_word_t *private_key, uECC_Curve curve);
281
282/*
283 * @brief Regularize the bitcount for the private key so that attackers cannot
284 * use a side channel attack to learn the number of leading zeros.
285 * @return Regularized k
286 * @param k IN -- private-key
287 * @param k0 IN/OUT -- regularized k
288 * @param k1 IN/OUT -- regularized k
289 * @param curve IN -- elliptic curve
290 */
291uECC_word_t regularize_k(const uECC_word_t * const k, uECC_word_t *k0,
292 uECC_word_t *k1, uECC_Curve curve);
293
294/*
295 * @brief Point multiplication algorithm using Montgomery's ladder with co-Z
296 * coordinates. See http://eprint.iacr.org/2011/338.pdf.
297 * @note Result may overlap point.
298 * @param result OUT -- returns scalar*point
299 * @param point IN -- elliptic curve point
300 * @param scalar IN -- scalar
301 * @param initial_Z IN -- initial value for z
302 * @param num_bits IN -- number of bits in scalar
303 * @param curve IN -- elliptic curve
304 */
305void EccPoint_mult(uECC_word_t * result, const uECC_word_t * point,
306 const uECC_word_t * scalar, const uECC_word_t * initial_Z,
307 bitcount_t num_bits, uECC_Curve curve);
308
309/*
310 * @brief Constant-time comparison to zero - secure way to compare long integers
311 * @param vli IN -- very long integer
312 * @param num_words IN -- number of words in the vli
313 * @return 1 if vli == 0, 0 otherwise.
314 */
315uECC_word_t uECC_vli_isZero(const uECC_word_t *vli, wordcount_t num_words);
316
317/*
318 * @brief Check if 'point' is the point at infinity
319 * @param point IN -- elliptic curve point
320 * @param curve IN -- elliptic curve
321 * @return if 'point' is the point at infinity, 0 otherwise.
322 */
323uECC_word_t EccPoint_isZero(const uECC_word_t *point, uECC_Curve curve);
324
325/*
326 * @brief computes the sign of left - right, in constant time.
327 * @param left IN -- left term to be compared
328 * @param right IN -- right term to be compared
329 * @param num_words IN -- number of words
330 * @return the sign of left - right
331 */
332cmpresult_t uECC_vli_cmp(const uECC_word_t *left, const uECC_word_t *right,
333 wordcount_t num_words);
334
335/*
336 * @brief computes sign of left - right, not in constant time.
337 * @note should not be used if inputs are part of a secret
338 * @param left IN -- left term to be compared
339 * @param right IN -- right term to be compared
340 * @param num_words IN -- number of words
341 * @return the sign of left - right
342 */
343cmpresult_t uECC_vli_cmp_unsafe(const uECC_word_t *left, const uECC_word_t *right,
344 wordcount_t num_words);
345
346/*
347 * @brief Computes result = (left - right) % mod.
348 * @note Assumes that (left < mod) and (right < mod), and that result does not
349 * overlap mod.
350 * @param result OUT -- (left - right) % mod
351 * @param left IN -- leftright term in modular subtraction
352 * @param right IN -- right term in modular subtraction
353 * @param mod IN -- mod
354 * @param num_words IN -- number of words
355 */
356void uECC_vli_modSub(uECC_word_t *result, const uECC_word_t *left,
357 const uECC_word_t *right, const uECC_word_t *mod,
358 wordcount_t num_words);
359
360/*
361 * @brief Computes P' = (x1', y1', Z3), P + Q = (x3, y3, Z3) or
362 * P => P', Q => P + Q
363 * @note assumes Input P = (x1, y1, Z), Q = (x2, y2, Z)
364 * @param X1 IN -- x coordinate of P
365 * @param Y1 IN -- y coordinate of P
366 * @param X2 IN -- x coordinate of Q
367 * @param Y2 IN -- y coordinate of Q
368 * @param curve IN -- elliptic curve
369 */
370void XYcZ_add(uECC_word_t * X1, uECC_word_t * Y1, uECC_word_t * X2,
371 uECC_word_t * Y2, uECC_Curve curve);
372
373/*
374 * @brief Computes (x1 * z^2, y1 * z^3)
375 * @param X1 IN -- previous x1 coordinate
376 * @param Y1 IN -- previous y1 coordinate
377 * @param Z IN -- z value
378 * @param curve IN -- elliptic curve
379 */
380void apply_z(uECC_word_t * X1, uECC_word_t * Y1, const uECC_word_t * const Z,
381 uECC_Curve curve);
382
383/*
384 * @brief Check if bit is set.
385 * @return Returns nonzero if bit 'bit' of vli is set.
386 * @warning It is assumed that the value provided in 'bit' is within the
387 * boundaries of the word-array 'vli'.
388 * @note The bit ordering layout assumed for vli is: {31, 30, ..., 0},
389 * {63, 62, ..., 32}, {95, 94, ..., 64}, {127, 126,..., 96} for a vli consisting
390 * of 4 uECC_word_t elements.
391 */
392uECC_word_t uECC_vli_testBit(const uECC_word_t *vli, bitcount_t bit);
393
394/*
395 * @brief Computes result = product % mod, where product is 2N words long.
396 * @param result OUT -- product % mod
397 * @param mod IN -- module
398 * @param num_words IN -- number of words
399 * @warning Currently only designed to work for curve_p or curve_n.
400 */
401void uECC_vli_mmod(uECC_word_t *result, uECC_word_t *product,
402 const uECC_word_t *mod, wordcount_t num_words);
403
404/*
405 * @brief Computes modular product (using curve->mmod_fast)
406 * @param result OUT -- (left * right) mod % curve_p
407 * @param left IN -- left term in product
408 * @param right IN -- right term in product
409 * @param curve IN -- elliptic curve
410 */
411void uECC_vli_modMult_fast(uECC_word_t *result, const uECC_word_t *left,
412 const uECC_word_t *right, uECC_Curve curve);
413
414/*
415 * @brief Computes result = left - right.
416 * @note Can modify in place.
417 * @param result OUT -- left - right
418 * @param left IN -- left term in subtraction
419 * @param right IN -- right term in subtraction
420 * @param num_words IN -- number of words
421 * @return borrow
422 */
423uECC_word_t uECC_vli_sub(uECC_word_t *result, const uECC_word_t *left,
424 const uECC_word_t *right, wordcount_t num_words);
425
426/*
427 * @brief Constant-time comparison function(secure way to compare long ints)
428 * @param left IN -- left term in comparison
429 * @param right IN -- right term in comparison
430 * @param num_words IN -- number of words
431 * @return Returns 0 if left == right, 1 otherwise.
432 */
433uECC_word_t uECC_vli_equal(const uECC_word_t *left, const uECC_word_t *right,
434 wordcount_t num_words);
435
436/*
437 * @brief Computes (left * right) % mod
438 * @param result OUT -- (left * right) % mod
439 * @param left IN -- left term in product
440 * @param right IN -- right term in product
441 * @param mod IN -- mod
442 * @param num_words IN -- number of words
443 */
444void uECC_vli_modMult(uECC_word_t *result, const uECC_word_t *left,
445 const uECC_word_t *right, const uECC_word_t *mod,
446 wordcount_t num_words);
447
448/*
449 * @brief Computes (1 / input) % mod
450 * @note All VLIs are the same size.
451 * @note See "Euclid's GCD to Montgomery Multiplication to the Great Divide"
452 * @param result OUT -- (1 / input) % mod
453 * @param input IN -- value to be modular inverted
454 * @param mod IN -- mod
455 * @param num_words -- number of words
456 */
457void uECC_vli_modInv(uECC_word_t *result, const uECC_word_t *input,
458 const uECC_word_t *mod, wordcount_t num_words);
459
460/*
461 * @brief Sets dest = src.
462 * @param dest OUT -- destination buffer
463 * @param src IN -- origin buffer
464 * @param num_words IN -- number of words
465 */
466void uECC_vli_set(uECC_word_t *dest, const uECC_word_t *src,
467 wordcount_t num_words);
468
469/*
470 * @brief Computes (left + right) % mod.
471 * @note Assumes that (left < mod) and right < mod), and that result does not
472 * overlap mod.
473 * @param result OUT -- (left + right) % mod.
474 * @param left IN -- left term in addition
475 * @param right IN -- right term in addition
476 * @param mod IN -- mod
477 * @param num_words IN -- number of words
478 */
479void uECC_vli_modAdd(uECC_word_t *result, const uECC_word_t *left,
480 const uECC_word_t *right, const uECC_word_t *mod,
481 wordcount_t num_words);
482
483/*
484 * @brief Counts the number of bits required to represent vli.
485 * @param vli IN -- very long integer
486 * @param max_words IN -- number of words
487 * @return number of bits in given vli
488 */
489bitcount_t uECC_vli_numBits(const uECC_word_t *vli,
490 const wordcount_t max_words);
491
492/*
493 * @brief Erases (set to 0) vli
494 * @param vli IN -- very long integer
495 * @param num_words IN -- number of words
496 */
497void uECC_vli_clear(uECC_word_t *vli, wordcount_t num_words);
498
499/*
500 * @brief check if it is a valid point in the curve
501 * @param point IN -- point to be checked
502 * @param curve IN -- elliptic curve
503 * @return 0 if point is valid
504 * @exception returns -1 if it is a point at infinity
505 * @exception returns -2 if x or y is smaller than p,
506 * @exception returns -3 if y^2 != x^3 + ax + b.
507 */
508int uECC_valid_point(const uECC_word_t *point, uECC_Curve curve);
509
510/*
511 * @brief Check if a public key is valid.
512 * @param public_key IN -- The public key to be checked.
513 * @return returns 0 if the public key is valid
514 * @exception returns -1 if it is a point at infinity
515 * @exception returns -2 if x or y is smaller than p,
516 * @exception returns -3 if y^2 != x^3 + ax + b.
517 * @exception returns -4 if public key is the group generator.
518 *
519 * @note Note that you are not required to check for a valid public key before
520 * using any other uECC functions. However, you may wish to avoid spending CPU
521 * time computing a shared secret or verifying a signature using an invalid
522 * public key.
523 */
524int uECC_valid_public_key(const uint8_t *public_key, uECC_Curve curve);
525
526 /*
527 * @brief Converts an integer in uECC native format to big-endian bytes.
528 * @param bytes OUT -- bytes representation
529 * @param num_bytes IN -- number of bytes
530 * @param native IN -- uECC native representation
531 */
532void uECC_vli_nativeToBytes(uint8_t *bytes, int num_bytes,
533 const unsigned int *native);
534
535/*
536 * @brief Converts big-endian bytes to an integer in uECC native format.
537 * @param native OUT -- uECC native representation
538 * @param bytes IN -- bytes representation
539 * @param num_bytes IN -- number of bytes
540 */
541void uECC_vli_bytesToNative(unsigned int *native, const uint8_t *bytes,
542 int num_bytes);
543
544#ifdef __cplusplus
545}
546#endif
547
548#endif /* __TC_UECC_H__ */
Manuel Pégourié-Gonnardafdc1b52019-05-09 11:24:11 +0200549#endif /* MBEDTLS_USE_TINYCRYPT */