Skip to content

Commit abd677a

Browse files
AnthonyGrondinAnthony Grondin
authored and
Anthony Grondin
committed
feat(bignum): Add initial bignum hardware acceleration
Libs need to be rebuilt: - cargo +stable xtask compile - cargo +stable xtask bindings wip: Add initial Modular Exponentiation for bignum
1 parent fcc50ea commit abd677a

File tree

14 files changed

+1037
-7
lines changed

14 files changed

+1037
-7
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "mbedtls"]
22
path = mbedtls
3-
url = https://github.com/Mbed-TLS/mbedtls
3+
url = https://github.com/espressif/mbedtls

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ static_cell = { version = "=1.2", features = ["nightly"] }
7272

7373
esp-mbedtls = { path = "./esp-mbedtls" }
7474

75-
[target.xtensa-esp32s3-none-elf.dependencies]
75+
[[example]]
76+
name = "crypto_self_test"
77+
required-features = ["esp-wifi/wifi-logs"]
7678

7779
[[example]]
7880
name = "async_client"

esp-mbedtls-sys/headers/esp32c3/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,6 +3609,8 @@
36093609
/* MPI / BIGNUM options */
36103610
//#define MBEDTLS_MPI_WINDOW_SIZE 2 /**< Maximum window size used. */
36113611
//#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */
3612+
#define MBEDTLS_MPI_EXP_MOD_ALT
3613+
// #define MBEDTLS_MPI_MUL_MPI_ALT
36123614

36133615
/* CTR_DRBG options */
36143616
//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */

esp-mbedtls-sys/headers/esp32s3/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,6 +3609,9 @@
36093609
/* MPI / BIGNUM options */
36103610
//#define MBEDTLS_MPI_WINDOW_SIZE 2 /**< Maximum window size used. */
36113611
//#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */
3612+
// #define MBEDTLS_BIGNUM_ALT
3613+
#define MBEDTLS_MPI_EXP_MOD_ALT
3614+
#define MBEDTLS_MPI_MUL_MPI_ALT
36123615

36133616
/* CTR_DRBG options */
36143617
//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */

esp-mbedtls-sys/src/include/esp32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4808,6 +4808,7 @@ extern "C" {
48084808
/// buffer of length \p blen Bytes. It may be \c NULL if
48094809
/// \p blen is zero.
48104810
/// \param blen The length of \p buf in Bytes.
4811+
/// \param md_alg The hash algorithm used to hash the original data.
48114812
/// \param f_rng_blind The RNG function used for blinding. This must not be
48124813
/// \c NULL.
48134814
/// \param p_rng_blind The RNG context to be passed to \p f_rng. This may be

esp-mbedtls-sys/src/include/esp32c3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4810,6 +4810,7 @@ extern "C" {
48104810
/// buffer of length \p blen Bytes. It may be \c NULL if
48114811
/// \p blen is zero.
48124812
/// \param blen The length of \p buf in Bytes.
4813+
/// \param md_alg The hash algorithm used to hash the original data.
48134814
/// \param f_rng_blind The RNG function used for blinding. This must not be
48144815
/// \c NULL.
48154816
/// \param p_rng_blind The RNG context to be passed to \p f_rng. This may be

esp-mbedtls-sys/src/include/esp32s2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4808,6 +4808,7 @@ extern "C" {
48084808
/// buffer of length \p blen Bytes. It may be \c NULL if
48094809
/// \p blen is zero.
48104810
/// \param blen The length of \p buf in Bytes.
4811+
/// \param md_alg The hash algorithm used to hash the original data.
48114812
/// \param f_rng_blind The RNG function used for blinding. This must not be
48124813
/// \c NULL.
48134814
/// \param p_rng_blind The RNG context to be passed to \p f_rng. This may be

esp-mbedtls-sys/src/include/esp32s3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4808,6 +4808,7 @@ extern "C" {
48084808
/// buffer of length \p blen Bytes. It may be \c NULL if
48094809
/// \p blen is zero.
48104810
/// \param blen The length of \p buf in Bytes.
4811+
/// \param md_alg The hash algorithm used to hash the original data.
48114812
/// \param f_rng_blind The RNG function used for blinding. This must not be
48124813
/// \c NULL.
48134814
/// \param p_rng_blind The RNG context to be passed to \p f_rng. This may be

esp-mbedtls/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ esp-mbedtls-sys = { path = "../esp-mbedtls-sys" }
88
log = "0.4.17"
99
embedded-io = { version = "0.6.1" }
1010
embedded-io-async = { version = "0.6.0", optional = true }
11+
crypto-bigint = { version = "0.5.3", default-features = false, features = ["extra-sizes"] }
1112
esp32-hal = { version = "0.16.0", optional = true }
1213
esp32c3-hal = { version = "0.13.0", optional = true }
1314
esp32s2-hal = { version = "0.13.0", optional = true }
1415
esp32s3-hal = { version = "0.13.0", optional = true }
16+
cfg-if = "1.0.0"
1517

1618
[features]
1719
async = ["dep:embedded-io-async"]

0 commit comments

Comments
 (0)