forked from bettse/seader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcredential_sio_label.c
More file actions
36 lines (31 loc) · 820 Bytes
/
credential_sio_label.c
File metadata and controls
36 lines (31 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "credential_sio_label.h"
#include <stdio.h>
bool seader_sio_label_format(
bool has_sio,
bool is_picopass_sio_context,
uint8_t sio_start_block,
char* out,
size_t out_size) {
if(out && out_size > 0U) {
out[0] = '\0';
}
if(!out || out_size == 0U || !has_sio) {
return false;
}
if(!is_picopass_sio_context) {
snprintf(out, out_size, "+SIO");
return true;
}
/* Picopass/iClass-only SIO labeling. DESFire/other media do not use block-derived SR/SE labels. */
switch(sio_start_block) {
case 6:
snprintf(out, out_size, "+SIO(SE)");
return true;
case 10:
snprintf(out, out_size, "+SIO(SR)");
return true;
default:
snprintf(out, out_size, "+SIO(?)");
return true;
}
}