MPHELL  5.0.0
mphell-tmp.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_TMP_H
27 #define MPHELL_TMP_H
28 
29 #include <stdbool.h>
30 
31 #include "mphell-errors.h"
32 
33 /*********************************** TMP ALLOC *******************************/
34 
39 void
41 
46 void
48 
49 #if MPHELL_USE_GMP == 1
50 
58 void
59 gmp_tmp_alloc(__mpz_struct * t, const uint8_t size, uint8_t stack);
60 
68 void
69 gmp_tmp_free(__mpz_struct * t, const uint8_t size, uint8_t stack);
70 
71 #elif MPHELL_USE_IPP == 1
72 
80 void
81 ippcp_bn_tmp_alloc(IppsBigNumState ** t, const uint8_t size, uint8_t stack);
82 
90 void
91 ippcp_bn_tmp_free(IppsBigNumState ** t, const uint8_t size, uint8_t stack);
92 
93 #elif MPHELL_USE_MBEDTLS == 1
94 
102 void
103 mbedtls_tmp_alloc(mbedtls_mpi * t, const uint8_t size, uint8_t stack);
104 
112 void
113 mbedtls_tmp_free(mbedtls_mpi * t, const uint8_t size, uint8_t stack);
114 
115 #endif
116 
123 uint32_t get_stack_size(uint8_t stack);
124 
133 bool verify_stack_size(uint32_t prev_size, uint8_t stack);
134 
135 #endif
Declaration of error functions.
bool verify_stack_size(uint32_t prev_size, uint8_t stack)
Compare the current size and the previous size of stack nb stack.
Definition: mphell-tmp.c:338
void free_tmp_memory()
Free the stack for temporary elements.
uint32_t get_stack_size(uint8_t stack)
Get the current size of stack nb stack.
Definition: mphell-tmp.c:320
void alloc_tmp_memory()
Allocate the stack for temporary elements, its size is defined in mphell-define.h.