Skip to content

Commit

Permalink
Merge branch 'skorp/flip_tdi_v_0_1' of https://github.com/flipperdevi…
Browse files Browse the repository at this point in the history
…ces/flipperzero-good-faps into skorp/flip_tdi_v_0_1
  • Loading branch information
Skorpionm committed Sep 18, 2024
2 parents e1e8783 + 6802ab5 commit 4606112
Show file tree
Hide file tree
Showing 37 changed files with 176 additions and 150 deletions.
2 changes: 2 additions & 0 deletions air_mouse/.catalog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.3
- Removed call to legacy SDK API
## 1.2
- Migration to new BLE profile
## 1.1
Expand Down
1 change: 0 additions & 1 deletion air_mouse/air_mouse_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ static AirMouseApp* air_mouse_alloc(void) {

app->gui = furi_record_open(RECORD_GUI);
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);

app->air_mouse_view = air_mouse_view_alloc(air_mouse_hid_deinit, app);
Expand Down
2 changes: 1 addition & 1 deletion air_mouse/application.fam
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
App(
appid="vgm_air_mouse",
name="Air Mouse",
fap_version="1.2",
fap_version="1.3",
fap_description="Turn Flipper Zero with the Video Game Module into an air mouse",
apptype=FlipperAppType.EXTERNAL,
entry_point="air_mouse_app",
Expand Down
2 changes: 2 additions & 0 deletions avr_isp_programmer/.catalog/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.4
- Removed call to legacy SDK API
## 1.3
- Update API v60.3
## 1.2
Expand Down
2 changes: 1 addition & 1 deletion avr_isp_programmer/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ App(
requires=["gui"],
stack_size=4 * 1024,
fap_description="Application for flashing AVR microcontrollers",
fap_version="1.3",
fap_version="1.4",
fap_icon="avr_app_icon_10px.png",
fap_category="GPIO",
fap_icon_assets="images",
Expand Down
1 change: 0 additions & 1 deletion avr_isp_programmer/avr_isp_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ AvrIspApp* avr_isp_app_alloc() {
// View Dispatcher
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&avr_isp_scene_handlers, app);
view_dispatcher_enable_queue(app->view_dispatcher);

view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
view_dispatcher_set_custom_event_callback(
Expand Down
2 changes: 1 addition & 1 deletion dap_link/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ App(
],
stack_size=4 * 1024,
fap_description="Enables use of Flipper as a debug probe for ARM devices, implements the CMSIS-DAP protocol",
fap_version="1.2",
fap_version="1.3",
fap_icon="dap_link.png",
fap_category="GPIO",
fap_private_libs=[
Expand Down
1 change: 0 additions & 1 deletion dap_link/gui/dap_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ DapGuiApp* dap_gui_alloc() {
app->gui = furi_record_open(RECORD_GUI);
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&dap_scene_handlers, app);
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);

view_dispatcher_set_custom_event_callback(app->view_dispatcher, dap_gui_custom_event_callback);
Expand Down
3 changes: 3 additions & 0 deletions mass_storage/.catalog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v.1.4
Removed call to legacy SDK API

## v.1.3

Minimal changes for recent API updates
Expand Down
2 changes: 1 addition & 1 deletion mass_storage/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ App(
],
stack_size=2 * 1024,
fap_description="Implements a mass storage device over USB for disk images",
fap_version="1.3",
fap_version="1.4",
fap_icon="assets/mass_storage_10px.png",
fap_icon_assets="assets",
fap_category="USB",
Expand Down
1 change: 0 additions & 1 deletion mass_storage/mass_storage_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ MassStorageApp* mass_storage_app_alloc(char* arg) {
app->dialogs = furi_record_open(RECORD_DIALOGS);

app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);

app->scene_manager = scene_manager_alloc(&mass_storage_scene_handlers, app);

Expand Down
2 changes: 2 additions & 0 deletions mfkey/.catalog/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.7
- Mfkey32 recovery is 30% faster, fix UI and slowdown bugs
## 2.6
- Version bump for catalog build system
## 2.5
Expand Down
2 changes: 1 addition & 1 deletion mfkey/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ App(
fap_icon_assets="images",
fap_weburl="https://github.com/noproto/FlipperMfkey",
fap_description="MIFARE Classic key recovery tool",
fap_version="2.6",
fap_version="2.7",
)

App(
Expand Down
2 changes: 1 addition & 1 deletion mfkey/crypto1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ void crypto1_get_lfsr(struct Crypto1State* state, MfClassicKey* lfsr) {
for(i = 0; i < 6; ++i) {
lfsr->data[i] = (lfsr_value >> ((5 - i) * 8)) & 0xFF;
}
}
}
61 changes: 56 additions & 5 deletions mfkey/crypto1.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include "mfkey.h"
#include <nfc/protocols/mf_classic/mf_classic.h>

#define LF_POLY_ODD (0x29CE5C)
#define LF_POLY_ODD (0x29CE5C)
#define LF_POLY_EVEN (0x870804)
#define BIT(x, n) ((x) >> (n) & 1)
#define BEBIT(x, n) BIT(x, (n) ^ 24)
#define BIT(x, n) ((x) >> (n) & 1)
#define BEBIT(x, n) BIT(x, (n) ^ 24)
#define SWAPENDIAN(x) \
((x) = ((x) >> 8 & 0xff00ff) | ((x) & 0xff00ff) << 8, (x) = (x) >> 16 | (x) << 16)

Expand All @@ -21,6 +21,8 @@ static inline uint32_t crypt_word(struct Crypto1State* s);
static inline void crypt_word_noret(struct Crypto1State* s, uint32_t in, int x);
static inline uint32_t crypt_word_ret(struct Crypto1State* s, uint32_t in, int x);
static inline void rollback_word_noret(struct Crypto1State* s, uint32_t in, int x);
static inline uint8_t napi_lfsr_rollback_bit(struct Crypto1State* s, uint32_t in, int fb);
static inline uint32_t napi_lfsr_rollback_word(struct Crypto1State* s, uint32_t in, int fb);

static const uint8_t lookup1[256] = {
0, 0, 16, 16, 0, 16, 0, 0, 0, 16, 0, 0, 16, 16, 16, 16, 0, 0, 16, 16, 0, 16, 0, 0,
Expand Down Expand Up @@ -147,10 +149,59 @@ static inline void rollback_word_noret(struct Crypto1State* s, uint32_t in, int
return;
}

// TODO:
/*
uint32_t rollback_word(struct Crypto1State *s, uint32_t in, int x) {
uint32_t res_ret = 0;
uint8_t ret;
uint32_t feedin, t, next_in;
for (int i = 31; i >= 0; i--) {
next_in = BEBIT(in, i);
s->odd &= 0xffffff;
t = s->odd, s->odd = s->even, s->even = t;
ret = filter(s->odd);
feedin = ret & (!!x);
feedin ^= s->even & 1;
feedin ^= LF_POLY_EVEN & (s->even >>= 1);
feedin ^= LF_POLY_ODD & s->odd;
feedin ^= !!next_in;
s->even |= (evenparity32(feedin)) << 23;
res_ret |= (ret << (24 ^ i));
}
return res_ret;
}
*/

uint8_t napi_lfsr_rollback_bit(struct Crypto1State* s, uint32_t in, int fb) {
int out;
uint8_t ret;
uint32_t t;
s->odd &= 0xffffff;
t = s->odd, s->odd = s->even, s->even = t;

out = s->even & 1;
out ^= LF_POLY_EVEN & (s->even >>= 1);
out ^= LF_POLY_ODD & s->odd;
out ^= !!in;
out ^= (ret = filter(s->odd)) & !!fb;

s->even |= evenparity32(out) << 23;
return ret;
}

uint32_t napi_lfsr_rollback_word(struct Crypto1State* s, uint32_t in, int fb) {
int i;
uint32_t ret = 0;
for(i = 31; i >= 0; --i)
ret |= napi_lfsr_rollback_bit(s, BEBIT(in, i), fb) << (i ^ 24);
return ret;
}

static inline uint32_t prng_successor(uint32_t x, uint32_t n) {
SWAPENDIAN(x);
while(n--) x = x >> 1 | (x >> 16 ^ x >> 18 ^ x >> 19 ^ x >> 21) << 31;
while(n--)
x = x >> 1 | (x >> 16 ^ x >> 18 ^ x >> 19 ^ x >> 21) << 31;
return SWAPENDIAN(x);
}

#endif // CRYPTO1_H
#endif // CRYPTO1_H
28 changes: 14 additions & 14 deletions mfkey/init_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
#include <flipper_application/flipper_application.h>

// TODO: Remove defines that are not needed
#define KEYS_DICT_SYSTEM_PATH EXT_PATH("nfc/assets/mf_classic_dict.nfc")
#define KEYS_DICT_USER_PATH EXT_PATH("nfc/assets/mf_classic_dict_user.nfc")
#define MF_CLASSIC_NONCE_PATH EXT_PATH("nfc/.mfkey32.log")
#define KEYS_DICT_SYSTEM_PATH EXT_PATH("nfc/assets/mf_classic_dict.nfc")
#define KEYS_DICT_USER_PATH EXT_PATH("nfc/assets/mf_classic_dict_user.nfc")
#define MF_CLASSIC_NONCE_PATH EXT_PATH("nfc/.mfkey32.log")
#define MF_CLASSIC_NESTED_NONCE_PATH EXT_PATH("nfc/.nested")
#define TAG "MFKey"
#define MAX_NAME_LEN 32
#define MAX_PATH_LEN 64
#define TAG "MFKey"
#define MAX_NAME_LEN 32
#define MAX_PATH_LEN 64

#define LF_POLY_ODD (0x29CE5C)
#define LF_POLY_ODD (0x29CE5C)
#define LF_POLY_EVEN (0x870804)
#define CONST_M1_1 (LF_POLY_EVEN << 1 | 1)
#define CONST_M2_1 (LF_POLY_ODD << 1)
#define CONST_M1_2 (LF_POLY_ODD)
#define CONST_M2_2 (LF_POLY_EVEN << 1 | 1)
#define BIT(x, n) ((x) >> (n) & 1)
#define BEBIT(x, n) BIT(x, (n) ^ 24)
#define CONST_M1_1 (LF_POLY_EVEN << 1 | 1)
#define CONST_M2_1 (LF_POLY_ODD << 1)
#define CONST_M1_2 (LF_POLY_ODD)
#define CONST_M2_2 (LF_POLY_EVEN << 1 | 1)
#define BIT(x, n) ((x) >> (n) & 1)
#define BEBIT(x, n) BIT(x, (n) ^ 24)
#define SWAPENDIAN(x) \
((x) = ((x) >> 8 & 0xff00ff) | ((x) & 0xff00ff) << 8, (x) = (x) >> 16 | (x) << 16)

Expand Down Expand Up @@ -409,4 +409,4 @@ static const FlipperAppPluginDescriptor init_plugin_descriptor = {
/* Plugin entry point - must return a pointer to const descriptor */
const FlipperAppPluginDescriptor* init_plugin_ep() {
return &init_plugin_descriptor;
}
}
Loading

0 comments on commit 4606112

Please sign in to comment.