mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
Merge branch 'bugfix/mbedtls_arguments' into 'master'
mbedtls: fix argument types and take care overflow warnings Closes GCC-239 See merge request espressif/esp-idf!17847
This commit is contained in:
@@ -185,7 +185,7 @@ static const unsigned char sha256_padding[64] = {
|
||||
/*
|
||||
* SHA-256 final digest
|
||||
*/
|
||||
int mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] )
|
||||
int mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char *output )
|
||||
{
|
||||
int ret;
|
||||
uint32_t last, padn;
|
||||
|
@@ -231,7 +231,7 @@ static const unsigned char sha512_padding[128] = {
|
||||
/*
|
||||
* SHA-512 final digest
|
||||
*/
|
||||
int mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] )
|
||||
int mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char *output )
|
||||
{
|
||||
int ret;
|
||||
size_t last, padn;
|
||||
|
@@ -322,7 +322,7 @@ static const unsigned char sha256_padding[64] = {
|
||||
/*
|
||||
* SHA-256 final digest
|
||||
*/
|
||||
int mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] )
|
||||
int mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char *output )
|
||||
{
|
||||
int ret;
|
||||
uint32_t last, padn;
|
||||
|
@@ -360,7 +360,7 @@ static const unsigned char sha512_padding[128] = {
|
||||
/*
|
||||
* SHA-512 final digest
|
||||
*/
|
||||
int mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] )
|
||||
int mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char *output )
|
||||
{
|
||||
int ret;
|
||||
size_t last, padn;
|
||||
|
@@ -245,12 +245,19 @@ TEST_CASE("mbedtls SHA384 clone", "[mbedtls][")
|
||||
TEST_ASSERT_EQUAL(0, mbedtls_sha512_update(&ctx, one_hundred_bs, 100));
|
||||
TEST_ASSERT_EQUAL(0, mbedtls_sha512_update(&clone, one_hundred_bs, 100));
|
||||
}
|
||||
/* intended warning supression: is384 == true */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
TEST_ASSERT_EQUAL(0, mbedtls_sha512_finish(&ctx, sha384));
|
||||
#pragma GCC diagnostic pop
|
||||
mbedtls_sha512_free(&ctx);
|
||||
|
||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha384_thousand_bs, sha384, 48, "SHA512 original calculation");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
TEST_ASSERT_EQUAL(0, mbedtls_sha512_finish(&clone, sha384));
|
||||
#pragma GCC diagnostic pop
|
||||
mbedtls_sha512_free(&clone);
|
||||
|
||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha384_thousand_bs, sha384, 48, "SHA512 cloned calculation");
|
||||
|
Reference in New Issue
Block a user