Просмотр исходного кода

Merge atomicdiceroller from https://github.com/xMasterX/all-the-plugins

Willy-JL 2 лет назад
Родитель
Сommit
1c4f871c2d

+ 1 - 0
esubghz_chat/application.fam

@@ -9,6 +9,7 @@ App(
     ],
     stack_size=8 * 1024,
     fap_category="Sub-GHz",
+    fap_libs=["mbedtls"],
     fap_icon="assets/chat_10px.png",
     fap_icon_assets="assets",
     fap_icon_assets_symbol="esubghz_chat",

+ 2 - 2
esubghz_chat/crypto_wrapper.c

@@ -1,6 +1,6 @@
 #include <furi_hal.h>
 #include <lib/mlib/m-dict.h>
-#include <toolbox/sha256.h>
+#include <mbedtls/sha256.h>
 
 #ifndef FURI_HAL_CRYPTO_ADVANCED_AVAIL
 #include "crypto/gcm.h"
@@ -78,7 +78,7 @@ static uint64_t crypto_calc_run_id(FuriString* flipper_name, uint32_t tick) {
     memcpy(h_in + fn_len, &tick, sizeof(uint32_t));
 
     uint8_t h_out[256];
-    sha256(h_in, fn_len + sizeof(uint32_t), h_out);
+    mbedtls_sha256(h_in, fn_len + sizeof(uint32_t), h_out, 0);
 
     uint64_t run_id;
     memcpy(&run_id, h_out, sizeof(uint64_t));

+ 1 - 1
esubghz_chat/esubghz_chat_i.h

@@ -13,7 +13,7 @@
 #include <notification/notification_messages.h>
 // #include <lib/nfc/nfc_worker.h>
 #include <lib/subghz/subghz_tx_rx_worker.h>
-#include <toolbox/sha256.h>
+#include <mbedtls/sha256.h>
 
 #include "crypto_wrapper.h"
 #include "scenes/esubghz_chat_scene.h"

+ 1 - 1
esubghz_chat/scenes/esubghz_chat_pass_input.c

@@ -28,7 +28,7 @@ static bool pass_input_validator(const char* text, FuriString* error, void* cont
     unsigned char key[KEY_BITS / 8];
 
     /* derive a key from the password */
-    sha256((unsigned char*)text, strlen(text), key);
+    mbedtls_sha256((unsigned char*)text, strlen(text), key, 0);
 
     /* initiate the crypto context */
     bool ret = crypto_ctx_set_key(state->crypto_ctx, key, state->name_prefix, furi_get_tick());