mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 07:00:05 +08:00
feat(mbedtls): mbedtls using SHA/AES of util component instead of its raw algorithm
This commit is contained in:
@ -16,15 +16,6 @@
|
||||
#include "mbedtls/sha256.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef MBEDTLS_SHA256_ALT
|
||||
/* Wrapper only works if the libsodium context structure can be mapped
|
||||
directly to the mbedTLS context structure.
|
||||
|
||||
See extended comments in crypto_hash_sha512_mbedtls.c
|
||||
*/
|
||||
#error "This wrapper only support standard software mbedTLS SHA"
|
||||
#endif
|
||||
|
||||
/* Sanity check that all the context fields have identical sizes
|
||||
(this should be more or less given from the SHA256 algorithm)
|
||||
|
||||
@ -55,7 +46,6 @@ static void sha256_libsodium_to_mbedtls(mbedtls_sha256_context *mb_ctx, crypto_h
|
||||
memcpy(mb_ctx->total, &ls_state->count, sizeof(mb_ctx->total));
|
||||
memcpy(mb_ctx->state, ls_state->state, sizeof(mb_ctx->state));
|
||||
memcpy(mb_ctx->buffer, ls_state->buf, sizeof(mb_ctx->buffer));
|
||||
mb_ctx->is224 = 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -16,18 +16,6 @@
|
||||
#include "mbedtls/sha512.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef MBEDTLS_SHA512_ALT
|
||||
/* Wrapper only works if the libsodium context structure can be mapped
|
||||
directly to the mbedTLS context structure.
|
||||
|
||||
For ESP8266 hardware SHA, the problems are fitting all the data in
|
||||
the libsodium state structure, and also that libsodium doesn't
|
||||
have mbedtls_sha512_free() or mbedtls_sha512_clone() so we can't
|
||||
manage the hardware state in a clean way.
|
||||
*/
|
||||
#error "This wrapper only support standard software mbedTLS SHA"
|
||||
#endif
|
||||
|
||||
/* Sanity check that all the context fields have identical sizes
|
||||
(this should be more or less given from the SHA512 algorithm)
|
||||
|
||||
@ -59,7 +47,6 @@ static void sha512_libsodium_to_mbedtls(mbedtls_sha512_context *mb_ctx, crypto_h
|
||||
memcpy(mb_ctx->total, ls_state->count, sizeof(mb_ctx->total));
|
||||
memcpy(mb_ctx->state, ls_state->state, sizeof(mb_ctx->state));
|
||||
memcpy(mb_ctx->buffer, ls_state->buf, sizeof(mb_ctx->buffer));
|
||||
mb_ctx->is384 = 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user