crypto tests: fix mallocs that were missing MALLOC_CAP_8BIT
Tests had the potential to fail they got non byte-accessible memory allocated.
This commit is contained in:
parent
7fa491a00f
commit
32f16e8c30
2 changed files with 10 additions and 10 deletions
|
@ -509,7 +509,7 @@ void aes_psram_ctr_test(uint32_t input_buf_caps, uint32_t output_buf_caps)
|
||||||
memset(nonce, 0x2F, 16);
|
memset(nonce, 0x2F, 16);
|
||||||
memset(key, 0x1E, 16);
|
memset(key, 0x1E, 16);
|
||||||
|
|
||||||
// allocate internal memory
|
// allocate memory according the requested caps
|
||||||
uint8_t *chipertext = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, output_buf_caps);
|
uint8_t *chipertext = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, output_buf_caps);
|
||||||
uint8_t *plaintext = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, input_buf_caps);
|
uint8_t *plaintext = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, input_buf_caps);
|
||||||
uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
|
uint8_t *decryptedtext = heap_caps_malloc(SZ, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
|
||||||
|
@ -558,8 +558,8 @@ void aes_psram_one_buf_ctr_test(void)
|
||||||
memset(nonce, 0x2F, 16);
|
memset(nonce, 0x2F, 16);
|
||||||
memset(key, 0x1E, 16);
|
memset(key, 0x1E, 16);
|
||||||
|
|
||||||
// allocate internal memory
|
// allocate external memory
|
||||||
uint8_t *buf = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, MALLOC_CAP_SPIRAM);
|
uint8_t *buf = heap_caps_malloc(SZ + ALIGNMENT_SIZE_BYTES, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
|
|
||||||
TEST_ASSERT_NOT_NULL(buf);
|
TEST_ASSERT_NOT_NULL(buf);
|
||||||
|
|
||||||
|
@ -1157,17 +1157,17 @@ void aes_icache_ctr_test(uint32_t output_buf_caps)
|
||||||
/* Tests how crypto DMA handles data in external memory */
|
/* Tests how crypto DMA handles data in external memory */
|
||||||
TEST_CASE("mbedtls AES PSRAM tests", "[aes]")
|
TEST_CASE("mbedtls AES PSRAM tests", "[aes]")
|
||||||
{
|
{
|
||||||
aes_psram_ctr_test(MALLOC_CAP_INTERNAL, MALLOC_CAP_SPIRAM);
|
aes_psram_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
aes_psram_ctr_test(MALLOC_CAP_SPIRAM, MALLOC_CAP_INTERNAL);
|
aes_psram_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
|
||||||
aes_psram_ctr_test(MALLOC_CAP_SPIRAM, MALLOC_CAP_SPIRAM);
|
aes_psram_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
aes_psram_one_buf_ctr_test();
|
aes_psram_one_buf_ctr_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tests how crypto DMA handles data from iCache */
|
/* Tests how crypto DMA handles data from iCache */
|
||||||
TEST_CASE("mbedtls AES iCache tests", "[aes]")
|
TEST_CASE("mbedtls AES iCache tests", "[aes]")
|
||||||
{
|
{
|
||||||
aes_icache_ctr_test(MALLOC_CAP_SPIRAM);
|
aes_icache_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
aes_icache_ctr_test(MALLOC_CAP_INTERNAL);
|
aes_icache_ctr_test(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
|
||||||
}
|
}
|
||||||
#endif // CONFIG_SPIRAM_USE_MALLOC
|
#endif // CONFIG_SPIRAM_USE_MALLOC
|
||||||
|
|
||||||
|
|
|
@ -402,8 +402,8 @@ TEST_CASE("mbedtls SHA256 PSRAM DMA", "[mbedtls]")
|
||||||
mbedtls_sha256_context sha256_ctx;
|
mbedtls_sha256_context sha256_ctx;
|
||||||
unsigned char sha256[32];
|
unsigned char sha256[32];
|
||||||
|
|
||||||
// allocate internal memory
|
// allocate external memory
|
||||||
uint8_t *buf = heap_caps_malloc(CALL_SZ, MALLOC_CAP_SPIRAM);
|
uint8_t *buf = heap_caps_malloc(CALL_SZ, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
TEST_ASSERT(esp_ptr_external_ram(buf));
|
TEST_ASSERT(esp_ptr_external_ram(buf));
|
||||||
memset(buf, 0x54, CALL_SZ);
|
memset(buf, 0x54, CALL_SZ);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue