mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-05 04:15:21 +02:00
hw crypto: activated hardware acceleration for esp32s2beta
Activated AES, RSA and SHA hardware acceleration for esp32s2 and enabled related unit tests. Updated with changes made for ESP32 from0a04034,961f59fandcaea288. Added performance targets for esp32s2beta Closes IDF-757
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
error hex value (mbedTLS uses -N for error codes) */
|
||||
#define TEST_ASSERT_MBEDTLS_OK(X) TEST_ASSERT_EQUAL_HEX32(0, -(X))
|
||||
|
||||
TEST_CASE_ESP32("mbedtls ECDH Generate Key", "[mbedtls]")
|
||||
TEST_CASE("mbedtls ECDH Generate Key", "[mbedtls]")
|
||||
{
|
||||
mbedtls_ecdh_context ctx;
|
||||
mbedtls_entropy_context entropy;
|
||||
@@ -48,7 +48,7 @@ TEST_CASE("mbedtls ECP self-tests", "[mbedtls]")
|
||||
TEST_ASSERT_EQUAL(0, mbedtls_ecp_self_test(1));
|
||||
}
|
||||
|
||||
TEST_CASE_ESP32("mbedtls ECP mul w/ koblitz", "[mbedtls]")
|
||||
TEST_CASE("mbedtls ECP mul w/ koblitz", "[mbedtls]")
|
||||
{
|
||||
/* Test case code via https://github.com/espressif/esp-idf/issues/1556 */
|
||||
mbedtls_entropy_context ctxEntropy;
|
||||
|
||||
@@ -165,7 +165,7 @@ static bool test_bignum_modexp(const char *z_str, const char *x_str, const char
|
||||
return fail;
|
||||
}
|
||||
|
||||
TEST_CASE_ESP32("test MPI modexp", "[bignum]")
|
||||
TEST_CASE("test MPI modexp", "[bignum]")
|
||||
{
|
||||
bool test_error = false;
|
||||
printf("Z = (X ^ Y) mod M \n");
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "test_apb_dport_access.h"
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA self-tests", "[mbedtls]")
|
||||
TEST_CASE("mbedtls SHA self-tests", "[mbedtls]")
|
||||
{
|
||||
start_apb_access_loop();
|
||||
TEST_ASSERT_FALSE_MESSAGE(mbedtls_sha1_self_test(1), "SHA1 self-tests should pass.");
|
||||
@@ -121,7 +121,7 @@ static void tskRunSHA256Test(void *pvParameters)
|
||||
|
||||
#define SHA_TASK_STACK_SIZE (10*1024)
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA multithreading", "[mbedtls]")
|
||||
TEST_CASE("mbedtls SHA multithreading", "[mbedtls]")
|
||||
{
|
||||
done_sem = xSemaphoreCreateCounting(4, 0);
|
||||
xTaskCreate(tskRunSHA1Test, "SHA1Task1", SHA_TASK_STACK_SIZE, NULL, 3, NULL);
|
||||
@@ -164,13 +164,13 @@ void tskRunSHASelftests(void *param)
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA self-tests multithreaded", "[mbedtls]")
|
||||
TEST_CASE("mbedtls SHA self-tests multithreaded", "[mbedtls]")
|
||||
{
|
||||
done_sem = xSemaphoreCreateCounting(2, 0);
|
||||
xTaskCreate(tskRunSHASelftests, "SHASelftests1", SHA_TASK_STACK_SIZE, NULL, 3, NULL);
|
||||
xTaskCreate(tskRunSHASelftests, "SHASelftests2", SHA_TASK_STACK_SIZE, NULL, 3, NULL);
|
||||
|
||||
const int TIMEOUT_MS = 20000;
|
||||
const int TIMEOUT_MS = 40000;
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
if(!xSemaphoreTake(done_sem, TIMEOUT_MS/portTICK_PERIOD_MS)) {
|
||||
@@ -180,7 +180,7 @@ TEST_CASE_ESP32("mbedtls SHA self-tests multithreaded", "[mbedtls]")
|
||||
vSemaphoreDelete(done_sem);
|
||||
}
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA512 clone", "[mbedtls]")
|
||||
TEST_CASE("mbedtls SHA512 clone", "[mbedtls]")
|
||||
{
|
||||
mbedtls_sha512_context ctx;
|
||||
mbedtls_sha512_context clone;
|
||||
@@ -205,7 +205,7 @@ TEST_CASE_ESP32("mbedtls SHA512 clone", "[mbedtls]")
|
||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha512_thousand_bs, sha512, 64, "SHA512 cloned calculation");
|
||||
}
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA384 clone", "[mbedtls]")
|
||||
TEST_CASE("mbedtls SHA384 clone", "[mbedtls]")
|
||||
{
|
||||
mbedtls_sha512_context ctx;
|
||||
mbedtls_sha512_context clone;
|
||||
@@ -231,7 +231,7 @@ TEST_CASE_ESP32("mbedtls SHA384 clone", "[mbedtls]")
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA256 clone", "[mbedtls]")
|
||||
TEST_CASE("mbedtls SHA256 clone", "[mbedtls]")
|
||||
{
|
||||
mbedtls_sha256_context ctx;
|
||||
mbedtls_sha256_context clone;
|
||||
@@ -276,6 +276,7 @@ static void tskFinaliseSha(void *v_param)
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
// No concurrent SHA sessions in esp32s2, only has one engine
|
||||
TEST_CASE_ESP32("mbedtls SHA session passed between tasks" , "[mbedtls]")
|
||||
{
|
||||
finalise_sha_param_t param = { 0 };
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "test_utils.h"
|
||||
#include "sodium/utils.h"
|
||||
|
||||
TEST_CASE_ESP32("mbedtls SHA performance", "[aes]")
|
||||
TEST_CASE("mbedtls SHA performance", "[aes]")
|
||||
{
|
||||
const unsigned CALLS = 256;
|
||||
const unsigned CALL_SZ = 16*1024;
|
||||
@@ -36,8 +36,8 @@ TEST_CASE_ESP32("mbedtls SHA performance", "[aes]")
|
||||
free(buf);
|
||||
mbedtls_sha256_free(&sha256_ctx);
|
||||
|
||||
/* Check the result. Reference value can be calculated using:
|
||||
* dd if=/dev/zero bs=$((16*1024)) count=256 | tr '\000' '\125' | sha256sum
|
||||
/* Check the result. Reference value can be calculated using:
|
||||
* dd if=/dev/zero bs=$((16*1024)) count=256 | tr '\000' '\125' | sha256sum
|
||||
*/
|
||||
const char* expected_hash = "c88df2638fb9699abaad05780fa5e0fdb6058f477069040eac8bed3231286275";
|
||||
char hash_str[sizeof(sha256) * 2 + 1];
|
||||
|
||||
Reference in New Issue
Block a user