@@ -384,7 +384,7 @@ bool seader_credential_save_agnostic(SeaderCredential* cred, const char* name) {
384
384
385
385
bool seader_credential_save_picopass (SeaderCredential * cred , const char * name ) {
386
386
uint8_t zero [PICOPASS_BLOCK_LEN ] = {0 };
387
- uint8_t csn [PICOPASS_BLOCK_LEN ] = {0x7a , 0xf5 , 0x31 , 0x13 , 0xfe , 0xff , 0x12 , 0xe0 };
387
+ uint8_t fake_csn [PICOPASS_BLOCK_LEN ] = {0x7a , 0xf5 , 0x31 , 0x13 , 0xfe , 0xff , 0x12 , 0xe0 };
388
388
uint8_t cfg [PICOPASS_BLOCK_LEN ] = {0x12 , 0xff , 0xff , 0xff , 0x7f , 0x1f , 0xff , 0x3c };
389
389
uint8_t epurse [PICOPASS_BLOCK_LEN ] = {0xff , 0xff , 0xff , 0xff , 0xe3 , 0xff , 0xff , 0xff };
390
390
uint8_t debit_key [PICOPASS_BLOCK_LEN ] = {0xe3 , 0xf3 , 0x07 , 0x84 , 0x4a , 0x0b , 0x62 , 0x04 };
@@ -421,18 +421,18 @@ bool seader_credential_save_picopass(SeaderCredential* cred, const char* name) {
421
421
furi_string_printf (temp_str , "Block %d" , i );
422
422
switch (i ) {
423
423
case CSN_INDEX :
424
- // TODO: Is there any practical difference here? If so, document.
425
- if ( withSIO ) {
424
+ if ( memcmp ( cred -> diversifier , zero , PICOPASS_BLOCK_LEN ) == 0 ) {
425
+ // when doing a downgrade from a non-picopass, we need to use a fake csn
426
426
if (!flipper_format_write_hex (
427
- file ,
428
- furi_string_get_cstr (temp_str ),
429
- cred -> diversifier ,
430
- PICOPASS_BLOCK_LEN )) {
427
+ file , furi_string_get_cstr (temp_str ), fake_csn , sizeof (fake_csn ))) {
431
428
block_saved = false;
432
429
}
433
430
} else {
434
431
if (!flipper_format_write_hex (
435
- file , furi_string_get_cstr (temp_str ), csn , sizeof (csn ))) {
432
+ file ,
433
+ furi_string_get_cstr (temp_str ),
434
+ cred -> diversifier ,
435
+ PICOPASS_BLOCK_LEN )) {
436
436
block_saved = false;
437
437
}
438
438
}
0 commit comments