source: asp3_tinet_ecnl_arm/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/wolfmath.h@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.2 KB
Line 
1/* wolfmath.h
2 *
3 * Copyright (C) 2006-2017 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#if defined(HAVE_WOLF_BIGINT) && !defined(WOLF_BIGINT_DEFINED)
23 /* raw big integer */
24 typedef struct WC_BIGINT {
25 byte* buf;
26 word32 len;
27 void* heap;
28 } WC_BIGINT;
29
30 #define WOLF_BIGINT_DEFINED
31#endif
32
33
34/* only define functions if mp_int has been declared */
35#ifdef MP_INT_DEFINED
36
37#ifndef __WOLFMATH_H__
38#define __WOLFMATH_H__
39
40 /* timing resistance array */
41 #if !defined(WC_NO_CACHE_RESISTANT) && \
42 ((defined(HAVE_ECC) && defined(ECC_TIMING_RESISTANT)) || \
43 (defined(USE_FAST_MATH) && defined(TFM_TIMING_RESISTANT)))
44
45 extern const wolfssl_word wc_off_on_addr[2];
46 #endif
47
48 /* common math functions */
49 int get_digit_count(mp_int* a);
50 mp_digit get_digit(mp_int* a, int n);
51 int get_rand_digit(WC_RNG* rng, mp_digit* d);
52 int mp_rand(mp_int* a, int digits, WC_RNG* rng);
53
54
55 #ifdef HAVE_WOLF_BIGINT
56 void wc_bigint_init(WC_BIGINT* a);
57 int wc_bigint_alloc(WC_BIGINT* a, word32 sz);
58 int wc_bigint_from_unsigned_bin(WC_BIGINT* a, const byte* in, word32 inlen);
59 int wc_bigint_to_unsigned_bin(WC_BIGINT* a, byte* out, word32* outlen);
60 void wc_bigint_zero(WC_BIGINT* a);
61 void wc_bigint_free(WC_BIGINT* a);
62
63 int wc_mp_to_bigint(mp_int* src, WC_BIGINT* dst);
64 int wc_bigint_to_mp(WC_BIGINT* src, mp_int* dst);
65 #endif /* HAVE_WOLF_BIGINT */
66
67#endif /* __WOLFMATH_H__ */
68
69#endif /* MP_INT_DEFINED */
Note: See TracBrowser for help on using the repository browser.