[FL-3857] NFC Ultralight Original write support (#3718)

* mf ultralight: rename ultralight unknown to origin
* nfc app: add write to origin support for origin ultralights
* mf ultralight: add orig write support on lib level
* targets: bump major API version
This commit is contained in:
gornekich 2024-06-17 15:20:35 +01:00 committed by GitHub
parent 039faf02f1
commit 729db7fa98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 19 deletions

View file

@ -192,7 +192,7 @@ static void nfc_scene_read_and_saved_menu_on_enter_mf_ultralight(NfcApp* instanc
} else if(
data->type == MfUltralightTypeNTAG213 || data->type == MfUltralightTypeNTAG215 ||
data->type == MfUltralightTypeNTAG216 || data->type == MfUltralightTypeUL11 ||
data->type == MfUltralightTypeUL21) {
data->type == MfUltralightTypeUL21 || data->type == MfUltralightTypeOrigin) {
submenu_add_item(
submenu,
"Write",

View file

@ -49,7 +49,7 @@ static void nfc_generate_mf_ul_orig(NfcDevice* nfc_device) {
MfUltralightData* mfu_data = mf_ultralight_alloc();
nfc_generate_mf_ul_common(mfu_data);
mfu_data->type = MfUltralightTypeUnknown;
mfu_data->type = MfUltralightTypeOrigin;
mfu_data->pages_total = 16;
mfu_data->pages_read = 16;
memset(&mfu_data->page[4], 0xff, sizeof(MfUltralightPage));

View file

@ -26,7 +26,7 @@ typedef struct {
static const uint32_t mf_ultralight_data_format_version = 2;
static const MfUltralightFeatures mf_ultralight_features[MfUltralightTypeNum] = {
[MfUltralightTypeUnknown] =
[MfUltralightTypeOrigin] =
{
.device_name = "Mifare Ultralight",
.total_pages = 16,
@ -215,7 +215,7 @@ static const char*
mf_ultralight_get_device_name_by_type(MfUltralightType type, NfcDeviceNameType name_type) {
if(name_type == NfcDeviceNameTypeShort &&
(type == MfUltralightTypeUL11 || type == MfUltralightTypeUL21)) {
type = MfUltralightTypeUnknown;
type = MfUltralightTypeOrigin;
}
return mf_ultralight_features[type].device_name;
@ -512,7 +512,7 @@ Iso14443_3aData* mf_ultralight_get_base_data(const MfUltralightData* data) {
MfUltralightType mf_ultralight_get_type_by_version(MfUltralightVersion* version) {
furi_check(version);
MfUltralightType type = MfUltralightTypeUnknown;
MfUltralightType type = MfUltralightTypeOrigin;
if(version->storage_size == 0x0B || version->storage_size == 0x00) {
type = MfUltralightTypeUL11;
@ -575,12 +575,14 @@ uint8_t mf_ultralight_get_write_end_page(MfUltralightType type) {
furi_assert(
type == MfUltralightTypeUL11 || type == MfUltralightTypeUL21 ||
type == MfUltralightTypeNTAG213 || type == MfUltralightTypeNTAG215 ||
type == MfUltralightTypeNTAG216);
type == MfUltralightTypeNTAG216 || type == MfUltralightTypeOrigin);
uint8_t end_page = mf_ultralight_get_config_page_num(type);
if(type == MfUltralightTypeNTAG213 || type == MfUltralightTypeNTAG215 ||
type == MfUltralightTypeNTAG216) {
end_page -= 1;
} else if(type == MfUltralightTypeOrigin) {
end_page = mf_ultralight_features[type].total_pages;
}
return end_page;

View file

@ -48,7 +48,7 @@ typedef enum {
} MfUltralightError;
typedef enum {
MfUltralightTypeUnknown,
MfUltralightTypeOrigin,
MfUltralightTypeNTAG203,
MfUltralightTypeMfulC,
MfUltralightTypeUL11,

View file

@ -281,12 +281,7 @@ static NfcCommand mf_ultralight_poller_handler_check_ntag_203(MfUltralightPoller
} else {
FURI_LOG_D(TAG, "Original Ultralight detected");
iso14443_3a_poller_halt(instance->iso14443_3a_poller);
instance->data->type = MfUltralightTypeUnknown;
if(instance->mode == MfUltralightPollerModeWrite) {
instance->mfu_event.type = MfUltralightPollerEventTypeCardMismatch;
instance->callback(instance->general_event, instance->context);
next_state = MfUltralightPollerStateWriteFail;
}
instance->data->type = MfUltralightTypeOrigin;
}
instance->state = next_state;
@ -575,10 +570,12 @@ static NfcCommand mf_ultralight_poller_handler_request_write_data(MfUltralightPo
break;
}
if(!instance->auth_context.auth_success) {
FURI_LOG_D(TAG, "Unknown password");
instance->mfu_event.type = MfUltralightPollerEventTypeCardLocked;
break;
if(mf_ultralight_support_feature(features, MfUltralightFeatureSupportPasswordAuth)) {
if(!instance->auth_context.auth_success) {
FURI_LOG_D(TAG, "Unknown password");
instance->mfu_event.type = MfUltralightPollerEventTypeCardLocked;
break;
}
}
const MfUltralightPage staticlock_page = tag_data->page[2];

View file

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,65.0,,
Version,+,66.0,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
Header,+,applications/services/cli/cli.h,,

1 entry status name type params
2 Version + 65.0 66.0
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/bt/bt_service/bt_keys_storage.h
5 Header + applications/services/cli/cli.h

View file

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,65.0,,
Version,+,66.0,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,

1 entry status name type params
2 Version + 65.0 66.0
3 Header + applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h
4 Header + applications/services/bt/bt_service/bt.h
5 Header + applications/services/bt/bt_service/bt_keys_storage.h