mbedtls: Add missing sha_caps includes

This commit is contained in:
Angus Gratton 2020-11-06 14:49:57 +11:00 committed by bot
parent 6a19590132
commit a4fb6c0173
3 changed files with 11 additions and 3 deletions

View File

@ -29,6 +29,7 @@
#include "sdkconfig.h"
#include "mbedtls/config.h"
#include "soc/soc_caps.h"
/**
* \name SECTION: System support
@ -130,7 +131,13 @@
#ifdef CONFIG_MBEDTLS_HARDWARE_SHA
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA256_ALT
#if SOC_SHA_SUPPORT_SHA512
#define MBEDTLS_SHA512_ALT
#else
#undef MBEDTLS_SHA512_ALT
#endif
#else
#undef MBEDTLS_SHA1_ALT
#undef MBEDTLS_SHA256_ALT

View File

@ -64,13 +64,13 @@ static void test_bignum_mult_variant(const char *a_str, const char *b_str, const
mbedtls_mpi_write_string(&X, 16, x_buf, sizeof(x_buf)-1, &x_buf_len);
TEST_ASSERT_EQUAL_STRING_MESSAGE(e_str, x_buf, "mbedtls_mpi_mul_mpi result wrong");
#ifdef CONFIG_MBEDTLS_HARDWARE_MPI
/* if mod_bits arg is set, also do a esp_mpi_mul_mod() call */
if (mod_bits > 0) {
mbedtls_mpi_init(&M);
for(int i = 0; i < mod_bits; i++) {
mbedtls_mpi_set_bit(&M, i, 1);
}
TEST_ASSERT_FALSE(esp_mpi_mul_mpi_mod(&X, &A, &B, &M));
mbedtls_mpi_write_string(&X, 16, x_buf, sizeof(x_buf)-1, &x_buf_len);
@ -78,7 +78,7 @@ static void test_bignum_mult_variant(const char *a_str, const char *b_str, const
mbedtls_mpi_free(&M);
}
#endif
mbedtls_mpi_free(&A);
mbedtls_mpi_free(&B);

View File

@ -15,6 +15,7 @@
#include "sdkconfig.h"
#include "test_apb_dport_access.h"
#include "sodium/utils.h"
#include "soc/soc_caps.h"
TEST_CASE("mbedtls SHA self-tests", "[mbedtls]")
{
@ -369,7 +370,7 @@ TEST_CASE("mbedtls SHA, input in flash", "[mbedtls]")
#if !DISABLED_FOR_TARGETS(ESP32)
/* Function are not implemented in SW */
#ifdef CONFIG_MBEDTLS_HARDWARE_SHA
#if CONFIG_MBEDTLS_HARDWARE_SHA && SOC_SHA_SUPPORT_SHA512_T
/*
* FIPS-180-2 test vectors