1
2
3
4
5
6
7
12
13
14
15
16
20
21
22
26
27
28
35
36
37
41
42
43
47
48
49
55
56
57
61
62
63
64
73
74
81
82
83
88
89
90
94
95
96
#ifndef _ESP_BIGNUM_H_
#define _ESP_BIGNUM_H_
#include <mbedtls/bignum.h>
#include <stdbool.h>
/* ... */
#if CONFIG_IDF_TARGET_ESP32
#define ESP_MPI_USE_MONT_EXP
#endif
/* ... */
void esp_mpi_enable_hardware_hw_op( void );
/* ... */
void esp_mpi_disable_hardware_hw_op( void );
/* ... */
size_t esp_mpi_hardware_words(size_t words);
/* ... */
void esp_mpi_mul_mpi_mod_hw_op(const mbedtls_mpi *X, const mbedtls_mpi *Y, const mbedtls_mpi *M, const mbedtls_mpi *Rinv, mbedtls_mpi_uint Mprime, size_t hw_words);
/* ... */
void esp_mpi_mul_mpi_hw_op(const mbedtls_mpi *X, const mbedtls_mpi *Y, size_t num_words);
/* ... */
void esp_mpi_mult_mpi_failover_mod_mult_hw_op(const mbedtls_mpi *X, const mbedtls_mpi *Y, size_t num_words);
/* ... */
void esp_mpi_read_result_hw_op(mbedtls_mpi *Z, size_t z_words);
#ifdef ESP_MPI_USE_MONT_EXP
/* ... */
int esp_mont_hw_op(mbedtls_mpi* Z, const mbedtls_mpi* X, const mbedtls_mpi* Y, const mbedtls_mpi* M,
mbedtls_mpi_uint Mprime,
size_t hw_words,
bool again);
/* ... */
#else
/* ... */
void esp_mpi_exp_mpi_mod_hw_op(const mbedtls_mpi *X, const mbedtls_mpi *Y, const mbedtls_mpi *M, const mbedtls_mpi *Rinv, mbedtls_mpi_uint Mprime, size_t hw_words);
/* ... */
#endif
/* ... */
void esp_mpi_interrupt_enable( bool enable );
/* ... */
void esp_mpi_interrupt_clear( void );
/* ... */
#endif