Update apps pt2 + Add MAYHEM Evil Portal

This commit is contained in:
Willy-JL
2023-07-26 03:48:19 +02:00
parent 356a4678d6
commit 2ee9349d50
47 changed files with 1249 additions and 129 deletions

View File

@@ -10,13 +10,15 @@ App(
order=10,
fap_icon="flipbip_10px.png",
fap_icon_assets="icons",
fap_icon_assets_symbol="flipbip",
fap_private_libs=[
Lib(
name="crypto",
),
],
fap_category="Tools",
fap_description="Crypto toolkit for Flipper",
fap_author="Struan Clark (xtruan)",
fap_weburl="https://github.com/xtruan/FlipBIP",
fap_version=(1, 11),
fap_description="Crypto wallet tools for Flipper",
)

View File

@@ -15,7 +15,7 @@
#include "views/flipbip_startscreen.h"
#include "views/flipbip_scene_1.h"
#define FLIPBIP_VERSION "v1.0.0"
#define FLIPBIP_VERSION "v1.11.0"
#define COIN_BTC 0
#define COIN_DOGE 3

View File

@@ -32,7 +32,11 @@ const char* FILE_HSTR = "fb01";
const char* FILE_K1 = "fb0131d5cf688221c109163908ebe51debb46227c6cc8b37641910833222772a"
"baefe6d9ceb651842260e0d1e05e3b90d15e7d5ffaaabc0207bf200a117793a2";
bool flipbip_load_file(char* settings, const FlipBipFile file_type, const char* file_name) {
bool flipbip_load_file(
char* settings,
size_t slen,
const FlipBipFile file_type,
const char* file_name) {
bool ret = false;
const char* path;
if(file_type == FlipBipFileKey) {
@@ -52,10 +56,12 @@ bool flipbip_load_file(char* settings, const FlipBipFile file_type, const char*
File* settings_file = storage_file_alloc(fs_api);
if(storage_file_open(settings_file, path, FSAM_READ, FSOM_OPEN_EXISTING)) {
char chr;
int i = 0;
size_t i = 0;
while((storage_file_read(settings_file, &chr, 1) == 1) &&
!storage_file_eof(settings_file) && !isspace(chr)) {
settings[i] = chr;
if(i < slen) {
settings[i] = chr;
}
i++;
}
ret = true;
@@ -193,7 +199,7 @@ bool flipbip_load_file_secure(char* settings) {
memzero(data, dlen);
// load k2 from file
if(!flipbip_load_file(data, FlipBipFileKey, NULL)) return false;
if(!flipbip_load_file(data, dlen, FlipBipFileKey, NULL)) return false;
// check header
if(data[0] != FILE_HSTR[0] || data[1] != FILE_HSTR[1] || data[2] != FILE_HSTR[2] ||
@@ -219,7 +225,7 @@ bool flipbip_load_file_secure(char* settings) {
data -= FILE_HLEN;
// load data from file
if(!flipbip_load_file(data, FlipBipFileDat, NULL)) return false;
if(!flipbip_load_file(data, dlen, FlipBipFileDat, NULL)) return false;
// check header
if(data[0] != FILE_HSTR[0] || data[1] != FILE_HSTR[1] || data[2] != FILE_HSTR[2] ||

View File

@@ -1,4 +1,5 @@
#include <stdbool.h>
#include <stddef.h>
typedef enum {
FlipBipFileDat,
@@ -7,7 +8,11 @@ typedef enum {
} FlipBipFile;
bool flipbip_has_file(const FlipBipFile file_type, const char* file_name, const bool remove);
bool flipbip_load_file(char* settings, const FlipBipFile file_type, const char* file_name);
bool flipbip_load_file(
char* settings,
size_t slen,
const FlipBipFile file_type,
const char* file_name);
bool flipbip_save_file(
const char* settings,
const FlipBipFile file_type,

View File

@@ -52,8 +52,7 @@ void random_buffer(uint8_t* buf, size_t len) {
#else /* PLATFORM INDEPENDENT */
#pragma message( \
"NOT SUITABLE FOR PRODUCTION USE! Replace random32() function with your own secure code.")
#pragma message("NOT SUITABLE FOR PRODUCTION USE! Replace random32() function with your own secure code.")
// The following code is not supposed to be used in a production environment.
// It's included only to make the library testable.
@@ -69,20 +68,20 @@ void random_buffer(uint8_t* buf, size_t len) {
//
uint32_t random32(void) {
// Linear congruential generator from Numerical Recipes
// https://en.wikipedia.org/wiki/Linear_congruential_generator
seed = 1664525 * seed + 1013904223;
return seed;
// Linear congruential generator from Numerical Recipes
// https://en.wikipedia.org/wiki/Linear_congruential_generator
seed = 1664525 * seed + 1013904223;
return seed;
}
void __attribute__((weak)) random_buffer(uint8_t* buf, size_t len) {
uint32_t r = 0;
for(size_t i = 0; i < len; i++) {
if(i % 4 == 0) {
r = random32();
}
buf[i] = (r >> ((i % 4) * 8)) & 0xFF;
void __attribute__((weak)) random_buffer(uint8_t *buf, size_t len) {
uint32_t r = 0;
for (size_t i = 0; i < len; i++) {
if (i % 4 == 0) {
r = random32();
}
buf[i] = (r >> ((i % 4) * 8)) & 0xFF;
}
}
#endif /* FLIPPER_HAL_RANDOM */

View File

@@ -47,4 +47,4 @@ bool flipbip_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
void flipbip_scene_scene_1_on_exit(void* context) {
FlipBip* app = context;
UNUSED(app);
}
}

View File

@@ -7,7 +7,7 @@
#include <storage/storage.h>
#include <string.h>
#include "flipbip_icons.h"
#include "assets_icons.h"
#include <assets_icons.h>
#include "../helpers/flipbip_haptic.h"
#include "../helpers/flipbip_led.h"
#include "../helpers/flipbip_string.h"

View File

@@ -4,7 +4,7 @@
#include <input/input.h>
#include <gui/elements.h>
#include "flipbip_icons.h"
#include "assets_icons.h"
#include <assets_icons.h>
struct FlipBipStartscreen {
View* view;