@@ -305,31 +305,34 @@ static NfcCommand mf_ultralight_poller_handler_get_feature_set(MfUltralightPolle
305305}
306306
307307static NfcCommand mf_ultralight_poller_handler_read_signature (MfUltralightPoller * instance ) {
308- MfUltralightPollerState next_state = MfUltralightPollerStateAuth ;
308+ bool signature_read_ok = false;
309+
309310 if (mf_ultralight_support_feature (
310311 instance -> feature_set , MfUltralightFeatureSupportReadSignature )) {
311312 FURI_LOG_D (TAG , "Reading signature" );
312313 instance -> error =
313314 mf_ultralight_poller_read_signature (instance , & instance -> data -> signature );
314- if (instance -> error != MfUltralightErrorNone ) {
315+ if (instance -> error == MfUltralightErrorNone ) {
316+ signature_read_ok = true;
317+ } else {
315318 FURI_LOG_D (TAG , "Read signature failed, continuing without signature" );
316319 memset (
317320 instance -> data -> signature .data ,
318321 0 ,
319322 sizeof (instance -> data -> signature .data ));
320- /* Signature is optional; continue read so pages and other data can be read */
321- if (mf_ultralight_support_feature (
322- instance -> feature_set , MfUltralightFeatureSupportAuthenticate )) {
323- next_state = MfUltralightPollerStateAuthMfulC ;
324- }
325- /* else next_state remains Auth */
326323 }
327324 } else {
328325 FURI_LOG_D (TAG , "Skip reading signature" );
329- if (mf_ultralight_support_feature (
330- instance -> feature_set , MfUltralightFeatureSupportAuthenticate )) {
331- next_state = MfUltralightPollerStateAuthMfulC ;
332- }
326+ }
327+
328+ MfUltralightPollerState next_state ;
329+ if (signature_read_ok ) {
330+ next_state = MfUltralightPollerStateAuth ;
331+ } else if (mf_ultralight_support_feature (
332+ instance -> feature_set , MfUltralightFeatureSupportAuthenticate )) {
333+ next_state = MfUltralightPollerStateAuthMfulC ;
334+ } else {
335+ next_state = MfUltralightPollerStateAuth ;
333336 }
334337 instance -> state = next_state ;
335338
0 commit comments