1 /*
2   ROM functions for hardware bigint support.
3 
4   It is not recommended to use these functions directly,
5   use the wrapper functions in hwcrypto/mpi.h instead.
6 
7  */
8 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 
14 //     http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 
22 #ifndef _ROM_BIGINT_H_
23 #define _ROM_BIGINT_H_
24 
25 #include <stdint.h>
26 #include <stdbool.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 //TODO: add comment here
33 void ets_bigint_enable(void);
34 
35 void ets_bigint_disable(void);
36 
37 void ets_bigint_wait_finish(void);
38 
39 bool ets_bigint_mod_power_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
40                                   uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
41 
42 bool ets_bigint_mod_power_getz(uint32_t *z, uint32_t len);
43 
44 bool ets_bigint_mult_prepare(uint32_t *x, uint32_t *y, uint32_t len);
45 
46 bool ets_bigint_mult_getz(uint32_t *z, uint32_t len);
47 
48 bool ets_bigint_montgomery_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
49                                         uint32_t m_dash, uint32_t len, bool again);
50 
51 bool ets_bigint_montgomery_mult_getz(uint32_t *z, uint32_t len);
52 
53 bool ets_bigint_mod_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
54                                  uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
55 
56 bool ets_bigint_mod_mult_getz(uint32_t *m, uint32_t *z, uint32_t len);
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif /* _ROM_BIGINT_H_ */
63