mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
esp32 hwcrypto: Make SHA-224 an obvious no-op for now
This is not the long term solution...
This commit is contained in:

committed by
Wu Jian Gang

parent
2bee84062a
commit
2580c07ae6
@@ -138,10 +138,10 @@ void esp_sha256_start( SHA256_CTX *ctx, int is224 )
|
||||
|
||||
if ( is224 == 0 ) {
|
||||
/* SHA-256 */
|
||||
ctx->context_type = SHA256;
|
||||
ctx->context_type = SHA2_256;
|
||||
} else {
|
||||
/* SHA-224 */
|
||||
ctx->context_type = SHA224;
|
||||
/* SHA-224 is not supported! */
|
||||
ctx->context_type = SHA_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,13 @@ void esp_sha256_update( SHA256_CTX *ctx, const unsigned char *input, size_t ilen
|
||||
*/
|
||||
void esp_sha256_finish( SHA256_CTX *ctx, unsigned char output[32] )
|
||||
{
|
||||
ets_sha_finish(&ctx->context, ctx->context_type, output);
|
||||
if ( ctx->context_type == SHA2_256 ) {
|
||||
ets_sha_finish(&ctx->context, ctx->context_type, output);
|
||||
} else {
|
||||
/* No hardware SHA-224 support, but mbedTLS API doesn't allow failure.
|
||||
For now, zero the output to make it clear it's not valid. */
|
||||
bzero( output, 28 );
|
||||
}
|
||||
esp_sha_release_hardware();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user