Closed
Description
Hardware:
Board: Heltec WiFi Kit 32
Core Installation/update date: 70d0d46
IDE name: Arduino 1.8.5
Flash Frequency: 80Mhz
Upload Speed: 115200
Description:
CONFIG_MBEDTLS_HARDWARE_SHA
option is disabled.
As a result, SHA256 computation is slow.
Sketch:
#include <mbedtls/sha256.h>
void setup() {
Serial.begin(115200);
Serial.println();
}
void loop() {
unsigned long t0 = micros();
mbedtls_sha256_context ctx;
mbedtls_sha256_init(&ctx);
for (int i = 0; i < 16777216; ++i) {
Serial.printf("mode=%d\n", ctx.mode);
mbedtls_sha256_update(&ctx, reinterpret_cast<const uint8_t*>("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno"), 64);
}
uint8_t digest[32];
mbedtls_sha256_finish(&ctx, digest);
mbedtls_sha256_free(&ctx);
unsigned long t1 = micros();
for (int i = 0; i < sizeof(digest); ++i) {
Serial.printf("%02x", digest[i]);
}
Serial.println();
Serial.printf("duration=%lu\n", t1 - t0);
}
Debug Messages:
In "alt" version of mbedtls_sha256_context
, there is a mode
member that indicates whether hardware or software SHA engine is selected.
The sketch does not compile because the mbedtls_sha256_context
only supports software implementation.
sha256-mbedtls:13: error: 'struct mbedtls_sha256_context' has no member named 'mode'
Serial.printf("mode=%d\n", ctx.mode);
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Activity
copercini commentedon Jan 8, 2018
It has disabled due an old bug in hardware acceleration that crash mbedltls sometimes (espressif/esp-idf#630)
It's fixed on IDF now and just waiting for the update for Arduino here: #964
yoursunny commentedon Aug 18, 2018
Core Installation/update date: 172802b
Now that #964 is closed, but
CONFIG_MBEDTLS_HARDWARE_SHA
stays disabled.Can this be enabled?
I tried modifying
tools/sdk/sdkconfig
but it does not seem to be effective. I don't know how to regenerate binaries in there.stale commentedon Aug 1, 2019
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
yoursunny commentedon Aug 1, 2019
This issue should remain open. Enabling hardware SHA engine is a useful performance improvement.
stale commentedon Sep 30, 2019
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
yoursunny commentedon Sep 30, 2019
This issue should remain open. Enabling hardware SHA engine is a useful performance improvement.
stale commentedon Sep 30, 2019
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
stale commentedon Nov 29, 2019
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
yoursunny commentedon Nov 29, 2019
This issue should remain open. Enabling hardware SHA engine is a useful performance improvement.
56 remaining items