|
|
@@ -125,9 +125,7 @@ int mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 )
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int esp_internal_sha512_block_process(mbedtls_sha512_context *ctx,
|
|
|
- const uint8_t *data, size_t len,
|
|
|
- uint8_t *buf, size_t buf_len)
|
|
|
+static void esp_internal_sha512_block_process(mbedtls_sha512_context *ctx, const uint8_t *data)
|
|
|
{
|
|
|
esp_sha_block(ctx->mode, data, ctx->first_block);
|
|
|
|
|
|
@@ -150,9 +148,8 @@ int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx, const unsigned
|
|
|
int mbedtls_sha512_update( mbedtls_sha512_context *ctx, const unsigned char *input,
|
|
|
size_t ilen )
|
|
|
{
|
|
|
- int ret;
|
|
|
size_t fill;
|
|
|
- unsigned int left, len, local_len = 0;
|
|
|
+ unsigned int left, local_len = 0;
|
|
|
|
|
|
if ( ilen == 0 ) {
|
|
|
return 0;
|
|
|
@@ -177,7 +174,7 @@ int mbedtls_sha512_update( mbedtls_sha512_context *ctx, const unsigned char *inp
|
|
|
}
|
|
|
|
|
|
|
|
|
- if ( len || local_len) {
|
|
|
+ if ( (ilen >= 128) || local_len) {
|
|
|
|
|
|
esp_sha_acquire_hardware();
|
|
|
|
|
|
@@ -197,14 +194,14 @@ int mbedtls_sha512_update( mbedtls_sha512_context *ctx, const unsigned char *inp
|
|
|
|
|
|
/* First process buffered block, if any */
|
|
|
if ( local_len ) {
|
|
|
- esp_internal_sha256_block_process(ctx, ctx->buffer);
|
|
|
+ esp_internal_sha512_block_process(ctx, ctx->buffer);
|
|
|
}
|
|
|
|
|
|
while ( ilen >= 128 ) {
|
|
|
- esp_internal_sha256_block_process(ctx, input);
|
|
|
+ esp_internal_sha512_block_process(ctx, input);
|
|
|
|
|
|
- input += 64;
|
|
|
- ilen -= 64;
|
|
|
+ input += 128;
|
|
|
+ ilen -= 128;
|
|
|
}
|
|
|
esp_sha_read_digest_state(ctx->mode, ctx->state);
|
|
|
|