From 4e4a78f1dea5179032e78704814b64bbbd22d106 Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 3 Sep 2021 14:22:51 +0200 Subject: [PATCH 1/2] Add implementation of the hmac calculation --- modules/crypto_module/src/crypto_module_1.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/crypto_module/src/crypto_module_1.cpp b/modules/crypto_module/src/crypto_module_1.cpp index e909f49..fd74498 100644 --- a/modules/crypto_module/src/crypto_module_1.cpp +++ b/modules/crypto_module/src/crypto_module_1.cpp @@ -89,7 +89,9 @@ uint8_t third_party_library_calc_hmac(const uint8_t * const message, size_t len, if (message[1] == 2) { if (message[2] == 3) { if (message[3] == 4) { - return 0; + int x[3]; + int y = 4; + int z = x[y]; } } } From a55c1d310dadfc577f84c8b1d93c47800ad28f96 Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 3 Sep 2021 16:19:28 +0200 Subject: [PATCH 2/2] Fix buffer overflow --- modules/crypto_module/src/crypto_module_1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/crypto_module/src/crypto_module_1.cpp b/modules/crypto_module/src/crypto_module_1.cpp index fd74498..7e46ea1 100644 --- a/modules/crypto_module/src/crypto_module_1.cpp +++ b/modules/crypto_module/src/crypto_module_1.cpp @@ -90,7 +90,7 @@ uint8_t third_party_library_calc_hmac(const uint8_t * const message, size_t len, if (message[2] == 3) { if (message[3] == 4) { int x[3]; - int y = 4; + int y = 2; int z = x[y]; } } @@ -98,4 +98,4 @@ uint8_t third_party_library_calc_hmac(const uint8_t * const message, size_t len, } } return 0; -} \ No newline at end of file +}