Explorar o código

[BUGFIX] Fix output buffer length issues. (#56)

Co-authored-by: Wayne Lin <wclin@nuvoton.com>
Wayne %!s(int64=4) %!d(string=hai) anos
pai
achega
4e0e77cdc7
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      ports/src/sha1_alt.c
  2. 1 1
      ports/src/sha512_alt.c

+ 1 - 1
ports/src/sha1_alt.c

@@ -160,7 +160,7 @@ int mbedtls_sha1_finish_ret(mbedtls_sha1_context *ctx, unsigned char output[20])
     if (ctx)
     if (ctx)
     {
     {
         LOG_D("sha1 finish ctx[%08x] out:%08x", *ctx, output);
         LOG_D("sha1 finish ctx[%08x] out:%08x", *ctx, output);
-        rt_hwcrypto_hash_finish(*ctx, output, 32);
+        rt_hwcrypto_hash_finish(*ctx, output, 20);
     }
     }
     else
     else
     {
     {

+ 1 - 1
ports/src/sha512_alt.c

@@ -170,7 +170,7 @@ int mbedtls_sha512_finish_ret(mbedtls_sha512_context *ctx, unsigned char output[
     if (ctx)
     if (ctx)
     {
     {
         LOG_D("sha2 finish ctx[%08x] out:%08x", *ctx, output);
         LOG_D("sha2 finish ctx[%08x] out:%08x", *ctx, output);
-        rt_hwcrypto_hash_finish(*ctx, output, 32);
+        rt_hwcrypto_hash_finish(*ctx, output, 64);
     }
     }
     else
     else
     {
     {