MPHELL  5.0.0
mphell-define.h
Go to the documentation of this file.
1 /*
2  MPHELL-5.0
3  Author(s): The MPHELL team
4 
5  (C) Copyright 2015-2021 - Institut Fourier / Univ. Grenoble Alpes (France)
6 
7  This file is part of the MPHELL Library.
8  MPHELL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, version 3 of the License.
11 
12  MPHELL 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 Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with MPHELL. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
26 #ifndef MPHELL_DEFINE_H
27 #define MPHELL_DEFINE_H
28 
29 #include <stdint.h>
30 
31 #include "mphell-config.h"
32 
33 #if MPHELL_USE_DEBUG == 1
34 #define MPHELL_USE_ASSERT 1
35 #else
36 #define MPHELL_USE_ASSERT 0
37 #endif
38 
39 #if (MPHELL_USE_VECTORIZATION == 1) && (MPHELL_HAVE_AES_INSTRUCTIONS == 1)
40 #define MPHELL_USE_AES_NI 1
41 #else
42 #define MPHELL_USE_AES_NI 0
43 #endif
44 
45 #if MPHELL_HAVE_GMP == 1
46 #if MPHELL_USE_GMP == 1
47 #include <gmp.h>
48 #define INIT_SIZE_MAIN_STACK 1000
49 #define INIT_SIZE_OTHERS_STACKS 1000
50 #define BLOCK_SIZE GMP_LIMB_BITS
51 #endif
52 #endif
53 
54 #if MPHELL_HAVE_IPP == 1
55 #if MPHELL_USE_IPP == 1
56 #include <ippcp.h>
57 #define INIT_SIZE_MAIN_STACK 1000
58 #define INIT_SIZE_OTHERS_STACKS 1000
59 #define BLOCK_SIZE 32
60 #endif
61 #endif
62 
63 #if MPHELL_HAVE_MBEDTLS == 1
64 #if MPHELL_USE_MBEDTLS == 1
65 #include "mbedtls/bignum.h"
66 #include "mbedtls/bn_mul.h"
67 #define INIT_SIZE_MAIN_STACK 1000
68 #define INIT_SIZE_OTHERS_STACKS 1000
69 #if defined(MBEDTLS_HAVE_INT64)
70 #define BLOCK_SIZE 64
71 #else
72 #define BLOCK_SIZE 32
73 #endif
74 #endif
75 #endif
76 
77 #define STACK_1 1
78 #define STACK_2 2
79 
80 #define POOL_SIZE_FP 40
81 #define POOL_SIZE_FIELD 100
82 #define POOL_SIZE_AMNS 5
83 
84 #if BLOCK_SIZE == 64
85 #define UMAX (~(uint64_t)0)
86 typedef uint64_t block;
87 #else
88 #define UMAX (~(uint32_t)0)
89 typedef uint32_t block;
90 #endif
91 
92 #define BYTES_PER_LIMB (BLOCK_SIZE/8)
93 
94 #endif