Przeglądaj źródła

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

Co-authored-by: Wayne Lin <wclin@nuvoton.com>
Wayne 4 lat temu
rodzic
commit
4e0e77cdc7
2 zmienionych plików z 2 dodań i 2 usunięć
  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)
     {
         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
     {

+ 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)
     {
         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
     {