mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-29 13:17:58 +08:00
fix(util): fix sha384/512 data calculation overflow
This commit is contained in:
@ -256,9 +256,10 @@ int esp_sha384_finish(esp_sha384_t *ctx, void *dest)
|
||||
|
||||
ctx->buffer[used++] = 0x80;
|
||||
|
||||
memset(ctx->buffer + used, 0, 112 - used);
|
||||
|
||||
if (used > 112) {
|
||||
if (used <= 112)
|
||||
memset(ctx->buffer + used, 0, 112 - used);
|
||||
else {
|
||||
memset(ctx->buffer + used, 0, 128 - used);
|
||||
esp_sha512_transform(ctx, ctx->buffer);
|
||||
memset(ctx->buffer, 0, 112);
|
||||
}
|
||||
|
Reference in New Issue
Block a user