Skip to content

Commit

Permalink
feat(SHA): Use hardware acceleration for SHA operations
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyGrondin committed Sep 3, 2024
1 parent 7de5d0a commit 0265213
Show file tree
Hide file tree
Showing 37 changed files with 2,621 additions and 115 deletions.
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ required-features = ["async"]

[[example]]
name = "edge_server"
required-features = ["async", "esp-hal-embassy", "edge-nal-embassy", "edge-http", "esp-mbedtls/edge-nal"]
required-features = [
"async",
"esp-hal-embassy",
"edge-nal-embassy",
"edge-http",
"esp-mbedtls/edge-nal",
]

[features]
esp32 = [
Expand Down
4 changes: 2 additions & 2 deletions esp-mbedtls-sys/headers/esp32/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@
//#define MBEDTLS_POLY1305_ALT
//#define MBEDTLS_RIPEMD160_ALT
//#define MBEDTLS_RSA_ALT
//#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA1_ALT
//#define MBEDTLS_SHA256_ALT
//#define MBEDTLS_SHA512_ALT
#define MBEDTLS_SHA512_ALT

/*
* When replacing the elliptic curve module, please consider, that it is
Expand Down
3 changes: 3 additions & 0 deletions esp-mbedtls-sys/headers/esp32/sha1_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
typedef struct mbedtls_sha1_context {
void* hasher;
} mbedtls_sha1_context;
5 changes: 5 additions & 0 deletions esp-mbedtls-sys/headers/esp32/sha512_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
typedef struct mbedtls_sha512_context {
void* sha384_hasher;
void* sha512_hasher;
int is384;
} mbedtls_sha512_context;
2 changes: 1 addition & 1 deletion esp-mbedtls-sys/headers/esp32c3/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
//#define MBEDTLS_POLY1305_ALT
//#define MBEDTLS_RIPEMD160_ALT
//#define MBEDTLS_RSA_ALT
//#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA1_ALT
//#define MBEDTLS_SHA256_ALT
//#define MBEDTLS_SHA512_ALT

Expand Down
3 changes: 3 additions & 0 deletions esp-mbedtls-sys/headers/esp32c3/sha1_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
typedef struct mbedtls_sha1_context {
void* hasher;
} mbedtls_sha1_context;
6 changes: 3 additions & 3 deletions esp-mbedtls-sys/headers/esp32s2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@
//#define MBEDTLS_POLY1305_ALT
//#define MBEDTLS_RIPEMD160_ALT
//#define MBEDTLS_RSA_ALT
//#define MBEDTLS_SHA1_ALT
//#define MBEDTLS_SHA256_ALT
//#define MBEDTLS_SHA512_ALT
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_SHA512_ALT

/*
* When replacing the elliptic curve module, please consider, that it is
Expand Down
3 changes: 3 additions & 0 deletions esp-mbedtls-sys/headers/esp32s2/sha1_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
typedef struct mbedtls_sha1_context {
void* hasher;
} mbedtls_sha1_context;
5 changes: 5 additions & 0 deletions esp-mbedtls-sys/headers/esp32s2/sha256_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
typedef struct mbedtls_sha256_context {
void* sha224_hasher;
void* sha256_hasher;
int is224;
} mbedtls_sha256_context;
5 changes: 5 additions & 0 deletions esp-mbedtls-sys/headers/esp32s2/sha512_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
typedef struct mbedtls_sha512_context {
void* sha384_hasher;
void* sha512_hasher;
int is384;
} mbedtls_sha512_context;
6 changes: 3 additions & 3 deletions esp-mbedtls-sys/headers/esp32s3/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@
//#define MBEDTLS_POLY1305_ALT
//#define MBEDTLS_RIPEMD160_ALT
//#define MBEDTLS_RSA_ALT
//#define MBEDTLS_SHA1_ALT
//#define MBEDTLS_SHA256_ALT
//#define MBEDTLS_SHA512_ALT
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_SHA512_ALT

/*
* When replacing the elliptic curve module, please consider, that it is
Expand Down
3 changes: 3 additions & 0 deletions esp-mbedtls-sys/headers/esp32s3/sha1_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
typedef struct mbedtls_sha1_context {
void* hasher;
} mbedtls_sha1_context;
5 changes: 5 additions & 0 deletions esp-mbedtls-sys/headers/esp32s3/sha256_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
typedef struct mbedtls_sha256_context {
void* sha224_hasher;
void* sha256_hasher;
int is224;
} mbedtls_sha256_context;
5 changes: 5 additions & 0 deletions esp-mbedtls-sys/headers/esp32s3/sha512_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
typedef struct mbedtls_sha512_context {
void* sha384_hasher;
void* sha512_hasher;
int is384;
} mbedtls_sha512_context;
Loading

0 comments on commit 0265213

Please sign in to comment.