This commit is contained in:
iceman1001 committed 2026-05-11 14:36:17 +02:00
1 parent 9fe6f12859
commit cbb572afad
52 files changed
+895 -619

No files matched your search

+1 -1
View File
@@ -541,7 +541,7 @@ static int b64dec(const char *src, int n, char *dst) {
int len = 0;
while (src + 3 < end) {
int a = b64rev(src[0]), b = b64rev(src[1]), c = b64rev(src[2]),
d = b64rev(src[3]);
d = b64rev(src[3]);
dst[len++] = (a << 2) | (b >> 4);
if (src[2] != '=') {
dst[len++] = (b << 4) | (c >> 2);
+1 -1
View File
@@ -478,7 +478,7 @@ void SimulateSeos(seos_emulate_req_t *msg) {
uint8_t tlv_idx = 1 + offset;
dynamic_response_info.response[tlv_idx++] = 0x7C; // Tag: mutual auth
dynamic_response_info.response[tlv_idx++] = sizeof(RND_ICC) +2; // Length
dynamic_response_info.response[tlv_idx++] = sizeof(RND_ICC) + 2; // Length
dynamic_response_info.response[tlv_idx++] = 0x81; // Tag: request for RND.ICC
dynamic_response_info.response[tlv_idx++] = sizeof(RND_ICC); // Length
memcpy(dynamic_response_info.response + tlv_idx, RND_ICC, sizeof(RND_ICC));
@@ -103,7 +103,7 @@ struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_pointer check_type(T const *, T const *const *);
static Is_array check_type(void const *, void const *);
};
@@ -571,7 +571,7 @@ static bool verify_alternatives(void) {
for (uint16_t q = 0; q < ARRAY_SIZE2(verification_table); ++q) {
bool any_failures_this_table = false;
VERIFICATION_T const * vt = &verification_table[q];
VERIFICATION_T const *vt = &verification_table[q];
const char *fstr = vt->output_name;
uint16_t limit = 1u << vt->input_count;
@@ -718,7 +718,7 @@ static bool verify_lut_XX(void) {
// order of input_names is based on resulting .PLA output,
// so least significant bit is at input_names[input_count-1]
static bool generate_espresso_file(uint8_t input_count, const char * const * input_names, const char * output_name, const uint8_t * lut_table_start, FILE* f_output) {
static bool generate_espresso_file(uint8_t input_count, const char *const *input_names, const char *output_name, const uint8_t *lut_table_start, FILE *f_output) {
if (input_count > 8) {
printf("FAILURE - Cannot generate espresso file for more than 8 inputs (code would need update)\n");
}
@@ -760,10 +760,10 @@ bool generate_all_lut_espresso_files(void) {
bool any_failures = false;
for (size_t i = 0; i < ARRAY_SIZE2(verification_table); ++i) {
VERIFICATION_T const * args = &verification_table[i];
VERIFICATION_T const *args = &verification_table[i];
bool current_result = false;
FILE* file = NULL;
FILE *file = NULL;
char filename[20] = {0}; // needs: 14 for two-letter output name
// First create the filename to be written
@@ -103,7 +103,7 @@ struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_pointer check_type(T const *, T const *const *);
static Is_array check_type(void const *, void const *);
};
@@ -103,7 +103,7 @@ struct Bad_arg_to_ARRAY_SIZE2 {
class Is_pointer; /* incomplete */
class Is_array {};
template <typename T>
static Is_pointer check_type(T const *, T const * const *);
static Is_pointer check_type(T const *, T const *const *);
static Is_array check_type(void const *, void const *);
};
+6 -6
View File
@@ -73,10 +73,10 @@ main(int argc, char *argv[]) {
setbmp();
if (BMP_BIT != bmpbit || BMP_SUB != bmpsub) {
fprintf(stderr, "reveng: configuration fault. Update "
"reveng/config.h with these definitions and "
"recompile:\n"
"\t#define BMP_BIT %d\n"
"\t#define BMP_SUB %d\n",
"reveng/config.h with these definitions and "
"recompile:\n"
"\t#define BMP_BIT %d\n"
"\t#define BMP_SUB %d\n",
bmpbit, bmpsub);
exit(EXIT_FAILURE);
}
@@ -84,8 +84,8 @@ main(int argc, char *argv[]) {
/* check the bitmap constant macro */
if (~(bmp_t) 0 != ~BMP_C(0)) {
fprintf(stderr, "reveng: configuration fault. Edit "
"the definition of BMP_C() in config.h to "
"match BMP_T and recompile.\n");
"the definition of BMP_C() in config.h to "
"match BMP_T and recompile.\n");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
+229 -229
View File
@@ -137,19 +137,19 @@ static const bmp_t b40c[] = {
# else /* BMP_BIT */
static const bmp_t b40[] = {
BMP_C(0x00048200) << (BMP_BIT - 32) | BMP_C(0x04) >> (39 - BMP_BIT),
BMP_C(0x09) << (BMP_BIT * 2 - 40),
BMP_C(0x09) << (BMP_BIT * 2 - 40),
};
static const bmp_t b40a[] = {
BMP_C(0xffffffff) << (BMP_BIT - 32) | BMP_C(0x7f) >> (39 - BMP_BIT),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
};
static const bmp_t b40b[] = {
BMP_C(0xd4164fc6) << (BMP_BIT - 32) | BMP_C(0x23) >> (39 - BMP_BIT),
BMP_C(0x46) << (BMP_BIT * 2 - 40),
BMP_C(0x46) << (BMP_BIT * 2 - 40),
};
static const bmp_t b40c[] = {
BMP_C(0xc4ff8071) << (BMP_BIT - 32) | BMP_C(0x7f) >> (39 - BMP_BIT),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
BMP_C(0xff) << (BMP_BIT * 2 - 40),
};
# endif /* BMP_BIT */
@@ -187,43 +187,43 @@ static const bmp_t b64i[] = {
# else /* BMP_BIT */
static const bmp_t b64[] = {
BMP_C(0x00000000) << (BMP_BIT - 32) | BMP_C(0x0000000d) >> (63 - BMP_BIT),
BMP_C(0x0000001b) << (BMP_BIT * 2 - 64),
BMP_C(0x0000001b) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64a[] = {
BMP_C(0xffffffff) << (BMP_BIT - 32) | BMP_C(0x7fffffff) >> (63 - BMP_BIT),
BMP_C(0xffffffff) << (BMP_BIT * 2 - 64),
BMP_C(0xffffffff) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64b[] = {
BMP_C(0xb90956c7) << (BMP_BIT - 32) | BMP_C(0x3ad20800) >> (63 - BMP_BIT),
BMP_C(0x75a41001) << (BMP_BIT * 2 - 64),
BMP_C(0x75a41001) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64c[] = {
BMP_C(0x53000000) << (BMP_BIT - 32) | BMP_C(0x00000000) >> (63 - BMP_BIT),
BMP_C(0x00000000) << (BMP_BIT * 2 - 64),
BMP_C(0x00000000) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64d[] = {
BMP_C(0x42f0e1eb) << (BMP_BIT - 32) | BMP_C(0x54f51b49) >> (63 - BMP_BIT),
BMP_C(0xa9ea3693) << (BMP_BIT * 2 - 64),
BMP_C(0xa9ea3693) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64e[] = {
BMP_C(0x6c40df5f) << (BMP_BIT - 32) | BMP_C(0x05a4b9a3) >> (63 - BMP_BIT),
BMP_C(0x0b497347) << (BMP_BIT * 2 - 64),
BMP_C(0x0b497347) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64f[] = {
BMP_C(0x62ec59e3) << (BMP_BIT - 32) | BMP_C(0x78d27805) >> (63 - BMP_BIT),
BMP_C(0xf1a4f00a) << (BMP_BIT * 2 - 64),
BMP_C(0xf1a4f00a) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64g[] = {
BMP_C(0xfcacbebd) << (BMP_BIT - 32) | BMP_C(0x2c98d4c9) >> (63 - BMP_BIT),
BMP_C(0x5931a992) << (BMP_BIT * 2 - 64),
BMP_C(0x5931a992) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64h[] = {
BMP_C(0x995dc9bb) << (BMP_BIT - 32) | BMP_C(0x6f8c9cfd) >> (63 - BMP_BIT),
BMP_C(0xdf1939fa) << (BMP_BIT * 2 - 64),
BMP_C(0xdf1939fa) << (BMP_BIT * 2 - 64),
};
static const bmp_t b64i[] = {
BMP_C(0x49958c9a) << (BMP_BIT - 32) | BMP_C(0x5ebe9a9f) >> (63 - BMP_BIT),
BMP_C(0xbd7d353f) << (BMP_BIT * 2 - 64),
BMP_C(0xbd7d353f) << (BMP_BIT * 2 - 64),
};
# endif /* BMP_BIT */
@@ -237,22 +237,22 @@ static const bmp_t b82a[] = {
# elif BMP_BIT >= 41
static const bmp_t b82[] = {
BMP_C(0x01846008880) << (BMP_BIT - 41) | BMP_C(0x08a00a20208) >> (81 - BMP_BIT),
BMP_C(0x11401440411) << (BMP_BIT * 2 - 82),
BMP_C(0x11401440411) << (BMP_BIT * 2 - 82),
};
static const bmp_t b82a[] = {
BMP_C(0x04f541fb128) << (BMP_BIT - 41) | BMP_C(0x011c00feb09) >> (81 - BMP_BIT),
BMP_C(0x023801fd612) << (BMP_BIT * 2 - 82),
BMP_C(0x023801fd612) << (BMP_BIT * 2 - 82),
};
# else /* BMP_BIT */
static const bmp_t b82[] = {
BMP_C(0x0c230044) << (BMP_BIT - 32) | BMP_C(0x040) >> (40 - BMP_BIT),
BMP_C(0x40450051) << (BMP_BIT * 2 - 64) | BMP_C(0x00104) >> (80 - BMP_BIT * 2),
BMP_C(0x00411) << (BMP_BIT * 3 - 82),
BMP_C(0x40450051) << (BMP_BIT * 2 - 64) | BMP_C(0x00104) >> (80 - BMP_BIT * 2),
BMP_C(0x00411) << (BMP_BIT * 3 - 82),
};
static const bmp_t b82a[] = {
BMP_C(0x27aa0fd8) << (BMP_BIT - 32) | BMP_C(0x094) >> (40 - BMP_BIT),
BMP_C(0x9408e007) << (BMP_BIT * 2 - 64) | BMP_C(0x0f584) >> (80 - BMP_BIT * 2),
BMP_C(0x3d612) << (BMP_BIT * 3 - 82),
BMP_C(0x9408e007) << (BMP_BIT * 2 - 64) | BMP_C(0x0f584) >> (80 - BMP_BIT * 2),
BMP_C(0x3d612) << (BMP_BIT * 3 - 82),
};
# endif /* BMP_BIT */
@@ -262,215 +262,215 @@ static const bmp_t b82a[] = {
/* Array of the polynomial bitmaps used in the model table. */
static const bmp_t b32[] = {
BMP_C(0x000000af) << (BMP_BIT - 32), /* 0 -- 32,000000af */
BMP_C(0x00010000) << (BMP_BIT - 32), /* 1 -- 16, 0001 */
BMP_C(0x00020000) << (BMP_BIT - 32), /* 2 -- 15, 0001 */
BMP_C(0x00065b00) << (BMP_BIT - 32), /* 3 -- 24, 00065b */
BMP_C(0x007e0000) << (BMP_BIT - 32), /* 4 -- 16, 007e */
BMP_C(0x007f0000) << (BMP_BIT - 32), /* 5 -- 16, 007f */
BMP_C(0x03400000) << (BMP_BIT - 32), /* 6 -- 11, 01a */
BMP_C(0x0376e6e7) << (BMP_BIT - 32), /* 7 -- 32,0376e6e7 */
BMP_C(0x04c11db7) << (BMP_BIT - 32), /* 8 -- 32,04c11db7 */
BMP_C(0x05890000) << (BMP_BIT - 32), /* 9 -- 16, 0589 */
BMP_C(0x07000000) << (BMP_BIT - 32), /* 10 -- 8, 07 */
BMP_C(0x080b0000) << (BMP_BIT - 32), /* 11 -- 16, 080b */
BMP_C(0x09823b6e) << (BMP_BIT - 32), /* 12 -- 31,04c11db7 */
BMP_C(0x0b3c0000) << (BMP_BIT - 32), /* 13 -- 15, 059e */
BMP_C(0x0c000000) << (BMP_BIT - 32), /* 14 -- 6, 03 */
BMP_C(0x0c200000) << (BMP_BIT - 32), /* 15 -- 11, 061 */
BMP_C(0x0c780000) << (BMP_BIT - 32), /* 16 -- 14, 031e */
BMP_C(0x0fb30000) << (BMP_BIT - 32), /* 17 -- 16, 0fb3 */
BMP_C(0x10210000) << (BMP_BIT - 32), /* 18 -- 16, 1021 */
BMP_C(0x12000000) << (BMP_BIT - 32), /* 19 -- 7, 09 */
BMP_C(0x130d2afc) << (BMP_BIT - 32), /* 20 -- 30,04c34abf */
BMP_C(0x144e6300) << (BMP_BIT - 32), /* 21 -- 24, 144e63 */
BMP_C(0x15000000) << (BMP_BIT - 32), /* 22 -- 8, 15 */
BMP_C(0x1697d06a) << (BMP_BIT - 32), /* 23 -- 32,1697d06a */
BMP_C(0x17800000) << (BMP_BIT - 32), /* 24 -- 12, 178 */
BMP_C(0x18000000) << (BMP_BIT - 32), /* 25 -- 6, 06 */
BMP_C(0x19d3c8d8) << (BMP_BIT - 32), /* 26 -- 31,0ce9e46c */
BMP_C(0x1c000000) << (BMP_BIT - 32), /* 27 -- 6, 07 */
BMP_C(0x1d000000) << (BMP_BIT - 32), /* 28 -- 8, 1d */
BMP_C(0x1d0f0000) << (BMP_BIT - 32), /* 29 -- 16, 1d0f */
BMP_C(0x1dcf0000) << (BMP_BIT - 32), /* 30 -- 16, 1dcf */
BMP_C(0x1edc6f41) << (BMP_BIT - 32), /* 31 -- 32,1edc6f41 */
BMP_C(0x1f23b800) << (BMP_BIT - 32), /* 32 -- 24, 1f23b8 */
BMP_C(0x20000000) << (BMP_BIT - 32), /* 33 -- 4, 2 */
BMP_C(0x200fa500) << (BMP_BIT - 32), /* 34 -- 24, 200fa5 */
BMP_C(0x20140000) << (BMP_BIT - 32), /* 35 -- 14, 0805 */
BMP_C(0x20b40000) << (BMP_BIT - 32), /* 36 -- 14, 082d */
BMP_C(0x20fe0000) << (BMP_BIT - 32), /* 37 -- 16, 20fe */
BMP_C(0x21890000) << (BMP_BIT - 32), /* 38 -- 16, 2189 */
BMP_C(0x21cf0200) << (BMP_BIT - 32), /* 39 -- 24, 21cf02 */
BMP_C(0x23ef5200) << (BMP_BIT - 32), /* 40 -- 24, 23ef52 */
BMP_C(0x25000000) << (BMP_BIT - 32), /* 41 -- 8, 25 */
BMP_C(0x26000000) << (BMP_BIT - 32), /* 42 -- 8, 26 */
BMP_C(0x26b10000) << (BMP_BIT - 32), /* 43 -- 16, 26b1 */
BMP_C(0x27818000) << (BMP_BIT - 32), /* 44 -- 17, 04f03 */
BMP_C(0x27d00000) << (BMP_BIT - 32), /* 45 -- 13, 04fa */
BMP_C(0x28000000) << (BMP_BIT - 32), /* 46 -- 5, 05 */
BMP_C(0x29b10000) << (BMP_BIT - 32), /* 47 -- 16, 29b1 */
BMP_C(0x2f000000) << (BMP_BIT - 32), /* 48 -- 8, 2f */
BMP_C(0x30000000) << (BMP_BIT - 32), /* 49 -- 4, 3/ 5, 6 */
BMP_C(0x3010bf7f) << (BMP_BIT - 32), /* 50 -- 32,3010bf7f */
BMP_C(0x31000000) << (BMP_BIT - 32), /* 51 -- 8, 31 */
BMP_C(0x31800000) << (BMP_BIT - 32), /* 52 -- 10, 0c6 */
BMP_C(0x31c30000) << (BMP_BIT - 32), /* 53 -- 16, 31c3 */
BMP_C(0x328b6300) << (BMP_BIT - 32), /* 54 -- 24, 328b63 */
BMP_C(0x34000000) << (BMP_BIT - 32), /* 55 -- 6, 0d */
BMP_C(0x340bc6d9) << (BMP_BIT - 32), /* 56 -- 32,340bc6d9 */
BMP_C(0x37000000) << (BMP_BIT - 32), /* 57 -- 8, 37 */
BMP_C(0x38000000) << (BMP_BIT - 32), /* 58 -- 5, 07 */
BMP_C(0x39000000) << (BMP_BIT - 32), /* 59 -- 8, 39 */
BMP_C(0x3d650000) << (BMP_BIT - 32), /* 60 -- 16, 3d65 */
BMP_C(0x3e000000) << (BMP_BIT - 32), /* 61 -- 8, 3e */
BMP_C(0x40000000) << (BMP_BIT - 32), /* 62 -- 3, 2 */
BMP_C(0x42000000) << (BMP_BIT - 32), /* 63 -- 8, 42 */
BMP_C(0x44c20000) << (BMP_BIT - 32), /* 64 -- 16, 44c2 */
BMP_C(0x45270551) << (BMP_BIT - 32), /* 65 -- 32,45270551 */
BMP_C(0x48000000) << (BMP_BIT - 32), /* 66 -- 5, 09 */
BMP_C(0x49000000) << (BMP_BIT - 32), /* 67 -- 8, 49 */
BMP_C(0x4a800000) << (BMP_BIT - 32), /* 68 -- 10, 12a */
BMP_C(0x4acc0000) << (BMP_BIT - 32), /* 69 -- 15, 2566 */
BMP_C(0x4b000000) << (BMP_BIT - 32), /* 70 -- 8, 4b */
BMP_C(0x4b370000) << (BMP_BIT - 32), /* 71 -- 16, 4b37 */
BMP_C(0x4c000000) << (BMP_BIT - 32), /* 72 -- 6, 13 */
BMP_C(0x4c060000) << (BMP_BIT - 32), /* 73 -- 16, 4c06 */
BMP_C(0x53000000) << (BMP_BIT - 32), /* 74 -- 8, 53 */
BMP_C(0x55000000) << (BMP_BIT - 32), /* 75 -- 8, 55 */
BMP_C(0x55555500) << (BMP_BIT - 32), /* 76 -- 24, 555555 */
BMP_C(0x59350000) << (BMP_BIT - 32), /* 77 -- 16, 5935 */
BMP_C(0x5d380000) << (BMP_BIT - 32), /* 78 -- 16, 5d38 */
BMP_C(0x5d400000) << (BMP_BIT - 32), /* 79 -- 10, 175 */
BMP_C(0x5d6dcb00) << (BMP_BIT - 32), /* 80 -- 24, 5d6dcb */
BMP_C(0x60000000) << (BMP_BIT - 32), /* 81 -- 3, 3 */
BMP_C(0x60e00000) << (BMP_BIT - 32), /* 82 -- 11, 307 */
BMP_C(0x63d00000) << (BMP_BIT - 32), /* 83 -- 16, 63d0 */
BMP_C(0x64000000) << (BMP_BIT - 32), /* 84 -- 6, 19 */
BMP_C(0x66400000) << (BMP_BIT - 32), /* 85 -- 10, 199 */
BMP_C(0x66c50000) << (BMP_BIT - 32), /* 86 -- 16, 66c5 */
BMP_C(0x6f630000) << (BMP_BIT - 32), /* 87 -- 16, 6f63 */
BMP_C(0x6f910000) << (BMP_BIT - 32), /* 88 -- 16, 6f91 */
BMP_C(0x70000000) << (BMP_BIT - 32), /* 89 -- 4, 7 */
BMP_C(0x70a00000) << (BMP_BIT - 32), /* 90 -- 11, 385 */
BMP_C(0x755b0000) << (BMP_BIT - 32), /* 91 -- 16, 755b */
BMP_C(0x765e7680) << (BMP_BIT - 32), /* 92 -- 32,765e7680 */
BMP_C(0x76c20800) << (BMP_BIT - 32), /* 93 -- 32, 0ed841 */
BMP_C(0x7979bd00) << (BMP_BIT - 32), /* 94 -- 24, 7979bd */
BMP_C(0x7e000000) << (BMP_BIT - 32), /* 95 -- 8, 7e */
BMP_C(0x80000000) << (BMP_BIT - 32), /* 96 -- 3, 4 */
BMP_C(0x80006300) << (BMP_BIT - 32), /* 97 -- 24, 800063 */
BMP_C(0x80050000) << (BMP_BIT - 32), /* 98 -- 16, 8005 */
BMP_C(0x800d0000) << (BMP_BIT - 32), /* 99 -- 16, 800d */
BMP_C(0x800fe300) << (BMP_BIT - 32), /* 100 -- 24, 800fe3 */
BMP_C(0x80b40000) << (BMP_BIT - 32), /* 101 -- 14, 202d */
BMP_C(0x80c2e71c) << (BMP_BIT - 32), /* 102 -- 30,2030b9c7 */
BMP_C(0x80f00000) << (BMP_BIT - 32), /* 103 -- 12, 80f */
BMP_C(0x814141ab) << (BMP_BIT - 32), /* 104 -- 32,814141ab */
BMP_C(0x8144c800) << (BMP_BIT - 32), /* 105 -- 21, 102899 */
BMP_C(0x864cfb00) << (BMP_BIT - 32), /* 106 -- 24, 864cfb */
BMP_C(0x87315576) << (BMP_BIT - 32), /* 107 -- 32,87315576 */
BMP_C(0x89ec0000) << (BMP_BIT - 32), /* 108 -- 16, 89ec */
BMP_C(0x8a000000) << (BMP_BIT - 32), /* 109 -- 7, 45 */
BMP_C(0x8b320000) << (BMP_BIT - 32), /* 110 -- 15, 4599 */
BMP_C(0x8bb70000) << (BMP_BIT - 32), /* 111 -- 16, 8bb7 */
BMP_C(0x8cc00000) << (BMP_BIT - 32), /* 112 -- 10, 233 */
BMP_C(0x904cddbf) << (BMP_BIT - 32), /* 113 -- 32,904cddbf */
BMP_C(0x906e0000) << (BMP_BIT - 32), /* 114 -- 16, 906e */
BMP_C(0x94000000) << (BMP_BIT - 32), /* 115 -- 8, 94 */
BMP_C(0x97000000) << (BMP_BIT - 32), /* 116 -- 8, 97 */
BMP_C(0x98000000) << (BMP_BIT - 32), /* 117 -- 6, 26 */
BMP_C(0x99000000) << (BMP_BIT - 32), /* 118 -- 8, 99 */
BMP_C(0x9b000000) << (BMP_BIT - 32), /* 119 -- 8, 9b */
BMP_C(0x9c000000) << (BMP_BIT - 32), /* 120 -- 6, 27 */
BMP_C(0x9d5e4de2) << (BMP_BIT - 32), /* 121 -- 31,4eaf26f1 */
BMP_C(0x9e000000) << (BMP_BIT - 32), /* 122 -- 7, 4f */
BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 123 -- 16, 9ecf */
BMP_C(0xa0660000) << (BMP_BIT - 32), /* 124 -- 16, a066 */
BMP_C(0xa0970000) << (BMP_BIT - 32), /* 125 -- 16, a097 */
BMP_C(0xa1000000) << (BMP_BIT - 32), /* 126 -- 8, a1 */
BMP_C(0xa3660000) << (BMP_BIT - 32), /* 127 -- 16, a366 */
BMP_C(0xa6000000) << (BMP_BIT - 32), /* 128 -- 7, 53 */
BMP_C(0xa7000000) << (BMP_BIT - 32), /* 129 -- 8, a7 */
BMP_C(0xa8000000) << (BMP_BIT - 32), /* 130 -- 5, 15 */
BMP_C(0xa8190000) << (BMP_BIT - 32), /* 131 -- 16, a819 */
BMP_C(0xa833982b) << (BMP_BIT - 32), /* 132 -- 32,a833982b */
BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 133 -- 24, abcdef */
BMP_C(0xac000000) << (BMP_BIT - 32), /* 134 -- 8, ac */
BMP_C(0xaee70000) << (BMP_BIT - 32), /* 135 -- 16, aee7 */
BMP_C(0xb0000000) << (BMP_BIT - 32), /* 136 -- 4, b */
BMP_C(0xb0010000) << (BMP_BIT - 32), /* 137 -- 16, b001 */
BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 138 -- 16, b2aa */
BMP_C(0xb3400000) << (BMP_BIT - 32), /* 139 -- 12, b34 */
BMP_C(0xb42d8000) << (BMP_BIT - 32), /* 140 -- 17, 1685b */
BMP_C(0xb4600000) << (BMP_BIT - 32), /* 141 -- 11, 5a3 */
BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 142 -- 16, b4c8 */
BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 143 -- 24, b4f3e6 */
BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 144 -- 24, b704ce */
BMP_C(0xb798b438) << (BMP_BIT - 32), /* 145 -- 32,b798b438 */
BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 146 -- 16, bb3d */
BMP_C(0xbc000000) << (BMP_BIT - 32), /* 147 -- 6,2f/ 8,bc */
BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 148 -- 32,bd0be338 */
BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 149 -- 16, bdf4 */
BMP_C(0xbf050000) << (BMP_BIT - 32), /* 150 -- 16, bf05 */
BMP_C(0xc0000000) << (BMP_BIT - 32), /* 151 -- 3, 6 */
BMP_C(0xc2000000) << (BMP_BIT - 32), /* 152 -- 7, 61 */
BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 153 -- 24, c25a56 */
BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 154 -- 16, c2b7 */
BMP_C(0xc2b80000) << (BMP_BIT - 32), /* 155 -- 14, 30ae */
BMP_C(0xc4000000) << (BMP_BIT - 32), /* 156 -- 8, c4 */
BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 157 -- 16, c6c6 */
BMP_C(0xc7000000) << (BMP_BIT - 32), /* 158 -- 8, c7 */
BMP_C(0xc704dd7b) << (BMP_BIT - 32), /* 159 -- 32,c704dd7b */
BMP_C(0xc8000000) << (BMP_BIT - 32), /* 160 -- 5, 19 */
BMP_C(0xc8670000) << (BMP_BIT - 32), /* 161 -- 16, c867 */
BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 162 -- 32,cbf43926 */
BMP_C(0xcde70300) << (BMP_BIT - 32), /* 163 -- 24, cde703 */
BMP_C(0xce3c0000) << (BMP_BIT - 32), /* 164 -- 16, ce3c */
BMP_C(0xd0000000) << (BMP_BIT - 32), /* 165 -- 8, d0 */
BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 166 -- 15, 6815 */
BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 167 -- 16, d0db */
BMP_C(0xd3100000) << (BMP_BIT - 32), /* 168 -- 12, d31 */
BMP_C(0xd3be9568) << (BMP_BIT - 32), /* 169 -- 30,34efa55a */
BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 170 -- 12, d4d */
BMP_C(0xd5000000) << (BMP_BIT - 32), /* 171 -- 8, d5 */
BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 172 -- 16, d64e */
BMP_C(0xda000000) << (BMP_BIT - 32), /* 173 -- 8, da */
BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 174 -- 12, daf */
BMP_C(0xdebb20e3) << (BMP_BIT - 32), /* 175 -- 32,debb20e3 */
BMP_C(0xdf000000) << (BMP_BIT - 32), /* 176 -- 8, df */
BMP_C(0xe0000000) << (BMP_BIT - 32), /* 177 -- 3, 7 */
BMP_C(0xe3069283) << (BMP_BIT - 32), /* 178 -- 32,e3069283 */
BMP_C(0xe3940000) << (BMP_BIT - 32), /* 179 -- 16, e394 */
BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 180 -- 16, e5cc */
BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 181 -- 13, 1cf5 */
BMP_C(0xe8000000) << (BMP_BIT - 32), /* 182 -- 6, 3a */
BMP_C(0xea000000) << (BMP_BIT - 32), /* 183 -- 7, 75 */
BMP_C(0xea820000) << (BMP_BIT - 32), /* 184 -- 16, ea82 */
BMP_C(0xec000000) << (BMP_BIT - 32), /* 185 -- 6, 3b */
BMP_C(0xf0000000) << (BMP_BIT - 32), /* 186 -- 4, f */
BMP_C(0xf0b80000) << (BMP_BIT - 32), /* 187 -- 16, f0b8 */
BMP_C(0xf1300000) << (BMP_BIT - 32), /* 188 -- 12, f13 */
BMP_C(0xf4000000) << (BMP_BIT - 32), /* 189 -- 8, f4 */
BMP_C(0xf4acfb13) << (BMP_BIT - 32), /* 190 -- 32,f4acfb13 */
BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 191 -- 12, f5b */
BMP_C(0xf6400000) << (BMP_BIT - 32), /* 192 -- 10, 3d9 */
BMP_C(0xf7000000) << (BMP_BIT - 32), /* 193 -- 8, f7 */
BMP_C(0xf8000000) << (BMP_BIT - 32), /* 194 -- 5, 1f */
BMP_C(0xfc000000) << (BMP_BIT - 32), /* 195 -- 6, 3f */
BMP_C(0xfc891918) << (BMP_BIT - 32), /* 196 -- 32,fc891918 */
BMP_C(0xfd000000) << (BMP_BIT - 32), /* 197 -- 8, fd */
BMP_C(0xfe000000) << (BMP_BIT - 32), /* 198 -- 7, 7f */
BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 199 -- 24, fedcba */
BMP_C(0xfee80000) << (BMP_BIT - 32), /* 200 -- 16, fee8 */
BMP_C(0xff000000) << (BMP_BIT - 32), /* 201 -- 8, ff */
BMP_C(0xffc00000) << (BMP_BIT - 32), /* 202 -- 10, 3ff */
BMP_C(0xfff00000) << (BMP_BIT - 32), /* 203 -- 12, fff */
BMP_C(0xfffc0000) << (BMP_BIT - 32), /* 204 -- 14, 3fff */
BMP_C(0xffff0000) << (BMP_BIT - 32), /* 205 -- 16, ffff */
BMP_C(0xffffff00) << (BMP_BIT - 32), /* 206 -- 24, ffffff */
BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 207 -- 30,3fffffff */
BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 208 -- 31,7fffffff */
BMP_C(0xffffffff) << (BMP_BIT - 32), /* 209 -- 32,ffffffff */
BMP_C(0x00010000) << (BMP_BIT - 32), /* 1 -- 16, 0001 */
BMP_C(0x00020000) << (BMP_BIT - 32), /* 2 -- 15, 0001 */
BMP_C(0x00065b00) << (BMP_BIT - 32), /* 3 -- 24, 00065b */
BMP_C(0x007e0000) << (BMP_BIT - 32), /* 4 -- 16, 007e */
BMP_C(0x007f0000) << (BMP_BIT - 32), /* 5 -- 16, 007f */
BMP_C(0x03400000) << (BMP_BIT - 32), /* 6 -- 11, 01a */
BMP_C(0x0376e6e7) << (BMP_BIT - 32), /* 7 -- 32,0376e6e7 */
BMP_C(0x04c11db7) << (BMP_BIT - 32), /* 8 -- 32,04c11db7 */
BMP_C(0x05890000) << (BMP_BIT - 32), /* 9 -- 16, 0589 */
BMP_C(0x07000000) << (BMP_BIT - 32), /* 10 -- 8, 07 */
BMP_C(0x080b0000) << (BMP_BIT - 32), /* 11 -- 16, 080b */
BMP_C(0x09823b6e) << (BMP_BIT - 32), /* 12 -- 31,04c11db7 */
BMP_C(0x0b3c0000) << (BMP_BIT - 32), /* 13 -- 15, 059e */
BMP_C(0x0c000000) << (BMP_BIT - 32), /* 14 -- 6, 03 */
BMP_C(0x0c200000) << (BMP_BIT - 32), /* 15 -- 11, 061 */
BMP_C(0x0c780000) << (BMP_BIT - 32), /* 16 -- 14, 031e */
BMP_C(0x0fb30000) << (BMP_BIT - 32), /* 17 -- 16, 0fb3 */
BMP_C(0x10210000) << (BMP_BIT - 32), /* 18 -- 16, 1021 */
BMP_C(0x12000000) << (BMP_BIT - 32), /* 19 -- 7, 09 */
BMP_C(0x130d2afc) << (BMP_BIT - 32), /* 20 -- 30,04c34abf */
BMP_C(0x144e6300) << (BMP_BIT - 32), /* 21 -- 24, 144e63 */
BMP_C(0x15000000) << (BMP_BIT - 32), /* 22 -- 8, 15 */
BMP_C(0x1697d06a) << (BMP_BIT - 32), /* 23 -- 32,1697d06a */
BMP_C(0x17800000) << (BMP_BIT - 32), /* 24 -- 12, 178 */
BMP_C(0x18000000) << (BMP_BIT - 32), /* 25 -- 6, 06 */
BMP_C(0x19d3c8d8) << (BMP_BIT - 32), /* 26 -- 31,0ce9e46c */
BMP_C(0x1c000000) << (BMP_BIT - 32), /* 27 -- 6, 07 */
BMP_C(0x1d000000) << (BMP_BIT - 32), /* 28 -- 8, 1d */
BMP_C(0x1d0f0000) << (BMP_BIT - 32), /* 29 -- 16, 1d0f */
BMP_C(0x1dcf0000) << (BMP_BIT - 32), /* 30 -- 16, 1dcf */
BMP_C(0x1edc6f41) << (BMP_BIT - 32), /* 31 -- 32,1edc6f41 */
BMP_C(0x1f23b800) << (BMP_BIT - 32), /* 32 -- 24, 1f23b8 */
BMP_C(0x20000000) << (BMP_BIT - 32), /* 33 -- 4, 2 */
BMP_C(0x200fa500) << (BMP_BIT - 32), /* 34 -- 24, 200fa5 */
BMP_C(0x20140000) << (BMP_BIT - 32), /* 35 -- 14, 0805 */
BMP_C(0x20b40000) << (BMP_BIT - 32), /* 36 -- 14, 082d */
BMP_C(0x20fe0000) << (BMP_BIT - 32), /* 37 -- 16, 20fe */
BMP_C(0x21890000) << (BMP_BIT - 32), /* 38 -- 16, 2189 */
BMP_C(0x21cf0200) << (BMP_BIT - 32), /* 39 -- 24, 21cf02 */
BMP_C(0x23ef5200) << (BMP_BIT - 32), /* 40 -- 24, 23ef52 */
BMP_C(0x25000000) << (BMP_BIT - 32), /* 41 -- 8, 25 */
BMP_C(0x26000000) << (BMP_BIT - 32), /* 42 -- 8, 26 */
BMP_C(0x26b10000) << (BMP_BIT - 32), /* 43 -- 16, 26b1 */
BMP_C(0x27818000) << (BMP_BIT - 32), /* 44 -- 17, 04f03 */
BMP_C(0x27d00000) << (BMP_BIT - 32), /* 45 -- 13, 04fa */
BMP_C(0x28000000) << (BMP_BIT - 32), /* 46 -- 5, 05 */
BMP_C(0x29b10000) << (BMP_BIT - 32), /* 47 -- 16, 29b1 */
BMP_C(0x2f000000) << (BMP_BIT - 32), /* 48 -- 8, 2f */
BMP_C(0x30000000) << (BMP_BIT - 32), /* 49 -- 4, 3/ 5, 6 */
BMP_C(0x3010bf7f) << (BMP_BIT - 32), /* 50 -- 32,3010bf7f */
BMP_C(0x31000000) << (BMP_BIT - 32), /* 51 -- 8, 31 */
BMP_C(0x31800000) << (BMP_BIT - 32), /* 52 -- 10, 0c6 */
BMP_C(0x31c30000) << (BMP_BIT - 32), /* 53 -- 16, 31c3 */
BMP_C(0x328b6300) << (BMP_BIT - 32), /* 54 -- 24, 328b63 */
BMP_C(0x34000000) << (BMP_BIT - 32), /* 55 -- 6, 0d */
BMP_C(0x340bc6d9) << (BMP_BIT - 32), /* 56 -- 32,340bc6d9 */
BMP_C(0x37000000) << (BMP_BIT - 32), /* 57 -- 8, 37 */
BMP_C(0x38000000) << (BMP_BIT - 32), /* 58 -- 5, 07 */
BMP_C(0x39000000) << (BMP_BIT - 32), /* 59 -- 8, 39 */
BMP_C(0x3d650000) << (BMP_BIT - 32), /* 60 -- 16, 3d65 */
BMP_C(0x3e000000) << (BMP_BIT - 32), /* 61 -- 8, 3e */
BMP_C(0x40000000) << (BMP_BIT - 32), /* 62 -- 3, 2 */
BMP_C(0x42000000) << (BMP_BIT - 32), /* 63 -- 8, 42 */
BMP_C(0x44c20000) << (BMP_BIT - 32), /* 64 -- 16, 44c2 */
BMP_C(0x45270551) << (BMP_BIT - 32), /* 65 -- 32,45270551 */
BMP_C(0x48000000) << (BMP_BIT - 32), /* 66 -- 5, 09 */
BMP_C(0x49000000) << (BMP_BIT - 32), /* 67 -- 8, 49 */
BMP_C(0x4a800000) << (BMP_BIT - 32), /* 68 -- 10, 12a */
BMP_C(0x4acc0000) << (BMP_BIT - 32), /* 69 -- 15, 2566 */
BMP_C(0x4b000000) << (BMP_BIT - 32), /* 70 -- 8, 4b */
BMP_C(0x4b370000) << (BMP_BIT - 32), /* 71 -- 16, 4b37 */
BMP_C(0x4c000000) << (BMP_BIT - 32), /* 72 -- 6, 13 */
BMP_C(0x4c060000) << (BMP_BIT - 32), /* 73 -- 16, 4c06 */
BMP_C(0x53000000) << (BMP_BIT - 32), /* 74 -- 8, 53 */
BMP_C(0x55000000) << (BMP_BIT - 32), /* 75 -- 8, 55 */
BMP_C(0x55555500) << (BMP_BIT - 32), /* 76 -- 24, 555555 */
BMP_C(0x59350000) << (BMP_BIT - 32), /* 77 -- 16, 5935 */
BMP_C(0x5d380000) << (BMP_BIT - 32), /* 78 -- 16, 5d38 */
BMP_C(0x5d400000) << (BMP_BIT - 32), /* 79 -- 10, 175 */
BMP_C(0x5d6dcb00) << (BMP_BIT - 32), /* 80 -- 24, 5d6dcb */
BMP_C(0x60000000) << (BMP_BIT - 32), /* 81 -- 3, 3 */
BMP_C(0x60e00000) << (BMP_BIT - 32), /* 82 -- 11, 307 */
BMP_C(0x63d00000) << (BMP_BIT - 32), /* 83 -- 16, 63d0 */
BMP_C(0x64000000) << (BMP_BIT - 32), /* 84 -- 6, 19 */
BMP_C(0x66400000) << (BMP_BIT - 32), /* 85 -- 10, 199 */
BMP_C(0x66c50000) << (BMP_BIT - 32), /* 86 -- 16, 66c5 */
BMP_C(0x6f630000) << (BMP_BIT - 32), /* 87 -- 16, 6f63 */
BMP_C(0x6f910000) << (BMP_BIT - 32), /* 88 -- 16, 6f91 */
BMP_C(0x70000000) << (BMP_BIT - 32), /* 89 -- 4, 7 */
BMP_C(0x70a00000) << (BMP_BIT - 32), /* 90 -- 11, 385 */
BMP_C(0x755b0000) << (BMP_BIT - 32), /* 91 -- 16, 755b */
BMP_C(0x765e7680) << (BMP_BIT - 32), /* 92 -- 32,765e7680 */
BMP_C(0x76c20800) << (BMP_BIT - 32), /* 93 -- 32, 0ed841 */
BMP_C(0x7979bd00) << (BMP_BIT - 32), /* 94 -- 24, 7979bd */
BMP_C(0x7e000000) << (BMP_BIT - 32), /* 95 -- 8, 7e */
BMP_C(0x80000000) << (BMP_BIT - 32), /* 96 -- 3, 4 */
BMP_C(0x80006300) << (BMP_BIT - 32), /* 97 -- 24, 800063 */
BMP_C(0x80050000) << (BMP_BIT - 32), /* 98 -- 16, 8005 */
BMP_C(0x800d0000) << (BMP_BIT - 32), /* 99 -- 16, 800d */
BMP_C(0x800fe300) << (BMP_BIT - 32), /* 100 -- 24, 800fe3 */
BMP_C(0x80b40000) << (BMP_BIT - 32), /* 101 -- 14, 202d */
BMP_C(0x80c2e71c) << (BMP_BIT - 32), /* 102 -- 30,2030b9c7 */
BMP_C(0x80f00000) << (BMP_BIT - 32), /* 103 -- 12, 80f */
BMP_C(0x814141ab) << (BMP_BIT - 32), /* 104 -- 32,814141ab */
BMP_C(0x8144c800) << (BMP_BIT - 32), /* 105 -- 21, 102899 */
BMP_C(0x864cfb00) << (BMP_BIT - 32), /* 106 -- 24, 864cfb */
BMP_C(0x87315576) << (BMP_BIT - 32), /* 107 -- 32,87315576 */
BMP_C(0x89ec0000) << (BMP_BIT - 32), /* 108 -- 16, 89ec */
BMP_C(0x8a000000) << (BMP_BIT - 32), /* 109 -- 7, 45 */
BMP_C(0x8b320000) << (BMP_BIT - 32), /* 110 -- 15, 4599 */
BMP_C(0x8bb70000) << (BMP_BIT - 32), /* 111 -- 16, 8bb7 */
BMP_C(0x8cc00000) << (BMP_BIT - 32), /* 112 -- 10, 233 */
BMP_C(0x904cddbf) << (BMP_BIT - 32), /* 113 -- 32,904cddbf */
BMP_C(0x906e0000) << (BMP_BIT - 32), /* 114 -- 16, 906e */
BMP_C(0x94000000) << (BMP_BIT - 32), /* 115 -- 8, 94 */
BMP_C(0x97000000) << (BMP_BIT - 32), /* 116 -- 8, 97 */
BMP_C(0x98000000) << (BMP_BIT - 32), /* 117 -- 6, 26 */
BMP_C(0x99000000) << (BMP_BIT - 32), /* 118 -- 8, 99 */
BMP_C(0x9b000000) << (BMP_BIT - 32), /* 119 -- 8, 9b */
BMP_C(0x9c000000) << (BMP_BIT - 32), /* 120 -- 6, 27 */
BMP_C(0x9d5e4de2) << (BMP_BIT - 32), /* 121 -- 31,4eaf26f1 */
BMP_C(0x9e000000) << (BMP_BIT - 32), /* 122 -- 7, 4f */
BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 123 -- 16, 9ecf */
BMP_C(0xa0660000) << (BMP_BIT - 32), /* 124 -- 16, a066 */
BMP_C(0xa0970000) << (BMP_BIT - 32), /* 125 -- 16, a097 */
BMP_C(0xa1000000) << (BMP_BIT - 32), /* 126 -- 8, a1 */
BMP_C(0xa3660000) << (BMP_BIT - 32), /* 127 -- 16, a366 */
BMP_C(0xa6000000) << (BMP_BIT - 32), /* 128 -- 7, 53 */
BMP_C(0xa7000000) << (BMP_BIT - 32), /* 129 -- 8, a7 */
BMP_C(0xa8000000) << (BMP_BIT - 32), /* 130 -- 5, 15 */
BMP_C(0xa8190000) << (BMP_BIT - 32), /* 131 -- 16, a819 */
BMP_C(0xa833982b) << (BMP_BIT - 32), /* 132 -- 32,a833982b */
BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 133 -- 24, abcdef */
BMP_C(0xac000000) << (BMP_BIT - 32), /* 134 -- 8, ac */
BMP_C(0xaee70000) << (BMP_BIT - 32), /* 135 -- 16, aee7 */
BMP_C(0xb0000000) << (BMP_BIT - 32), /* 136 -- 4, b */
BMP_C(0xb0010000) << (BMP_BIT - 32), /* 137 -- 16, b001 */
BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 138 -- 16, b2aa */
BMP_C(0xb3400000) << (BMP_BIT - 32), /* 139 -- 12, b34 */
BMP_C(0xb42d8000) << (BMP_BIT - 32), /* 140 -- 17, 1685b */
BMP_C(0xb4600000) << (BMP_BIT - 32), /* 141 -- 11, 5a3 */
BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 142 -- 16, b4c8 */
BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 143 -- 24, b4f3e6 */
BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 144 -- 24, b704ce */
BMP_C(0xb798b438) << (BMP_BIT - 32), /* 145 -- 32,b798b438 */
BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 146 -- 16, bb3d */
BMP_C(0xbc000000) << (BMP_BIT - 32), /* 147 -- 6,2f/ 8,bc */
BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 148 -- 32,bd0be338 */
BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 149 -- 16, bdf4 */
BMP_C(0xbf050000) << (BMP_BIT - 32), /* 150 -- 16, bf05 */
BMP_C(0xc0000000) << (BMP_BIT - 32), /* 151 -- 3, 6 */
BMP_C(0xc2000000) << (BMP_BIT - 32), /* 152 -- 7, 61 */
BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 153 -- 24, c25a56 */
BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 154 -- 16, c2b7 */
BMP_C(0xc2b80000) << (BMP_BIT - 32), /* 155 -- 14, 30ae */
BMP_C(0xc4000000) << (BMP_BIT - 32), /* 156 -- 8, c4 */
BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 157 -- 16, c6c6 */
BMP_C(0xc7000000) << (BMP_BIT - 32), /* 158 -- 8, c7 */
BMP_C(0xc704dd7b) << (BMP_BIT - 32), /* 159 -- 32,c704dd7b */
BMP_C(0xc8000000) << (BMP_BIT - 32), /* 160 -- 5, 19 */
BMP_C(0xc8670000) << (BMP_BIT - 32), /* 161 -- 16, c867 */
BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 162 -- 32,cbf43926 */
BMP_C(0xcde70300) << (BMP_BIT - 32), /* 163 -- 24, cde703 */
BMP_C(0xce3c0000) << (BMP_BIT - 32), /* 164 -- 16, ce3c */
BMP_C(0xd0000000) << (BMP_BIT - 32), /* 165 -- 8, d0 */
BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 166 -- 15, 6815 */
BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 167 -- 16, d0db */
BMP_C(0xd3100000) << (BMP_BIT - 32), /* 168 -- 12, d31 */
BMP_C(0xd3be9568) << (BMP_BIT - 32), /* 169 -- 30,34efa55a */
BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 170 -- 12, d4d */
BMP_C(0xd5000000) << (BMP_BIT - 32), /* 171 -- 8, d5 */
BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 172 -- 16, d64e */
BMP_C(0xda000000) << (BMP_BIT - 32), /* 173 -- 8, da */
BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 174 -- 12, daf */
BMP_C(0xdebb20e3) << (BMP_BIT - 32), /* 175 -- 32,debb20e3 */
BMP_C(0xdf000000) << (BMP_BIT - 32), /* 176 -- 8, df */
BMP_C(0xe0000000) << (BMP_BIT - 32), /* 177 -- 3, 7 */
BMP_C(0xe3069283) << (BMP_BIT - 32), /* 178 -- 32,e3069283 */
BMP_C(0xe3940000) << (BMP_BIT - 32), /* 179 -- 16, e394 */
BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 180 -- 16, e5cc */
BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 181 -- 13, 1cf5 */
BMP_C(0xe8000000) << (BMP_BIT - 32), /* 182 -- 6, 3a */
BMP_C(0xea000000) << (BMP_BIT - 32), /* 183 -- 7, 75 */
BMP_C(0xea820000) << (BMP_BIT - 32), /* 184 -- 16, ea82 */
BMP_C(0xec000000) << (BMP_BIT - 32), /* 185 -- 6, 3b */
BMP_C(0xf0000000) << (BMP_BIT - 32), /* 186 -- 4, f */
BMP_C(0xf0b80000) << (BMP_BIT - 32), /* 187 -- 16, f0b8 */
BMP_C(0xf1300000) << (BMP_BIT - 32), /* 188 -- 12, f13 */
BMP_C(0xf4000000) << (BMP_BIT - 32), /* 189 -- 8, f4 */
BMP_C(0xf4acfb13) << (BMP_BIT - 32), /* 190 -- 32,f4acfb13 */
BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 191 -- 12, f5b */
BMP_C(0xf6400000) << (BMP_BIT - 32), /* 192 -- 10, 3d9 */
BMP_C(0xf7000000) << (BMP_BIT - 32), /* 193 -- 8, f7 */
BMP_C(0xf8000000) << (BMP_BIT - 32), /* 194 -- 5, 1f */
BMP_C(0xfc000000) << (BMP_BIT - 32), /* 195 -- 6, 3f */
BMP_C(0xfc891918) << (BMP_BIT - 32), /* 196 -- 32,fc891918 */
BMP_C(0xfd000000) << (BMP_BIT - 32), /* 197 -- 8, fd */
BMP_C(0xfe000000) << (BMP_BIT - 32), /* 198 -- 7, 7f */
BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 199 -- 24, fedcba */
BMP_C(0xfee80000) << (BMP_BIT - 32), /* 200 -- 16, fee8 */
BMP_C(0xff000000) << (BMP_BIT - 32), /* 201 -- 8, ff */
BMP_C(0xffc00000) << (BMP_BIT - 32), /* 202 -- 10, 3ff */
BMP_C(0xfff00000) << (BMP_BIT - 32), /* 203 -- 12, fff */
BMP_C(0xfffc0000) << (BMP_BIT - 32), /* 204 -- 14, 3fff */
BMP_C(0xffff0000) << (BMP_BIT - 32), /* 205 -- 16, ffff */
BMP_C(0xffffff00) << (BMP_BIT - 32), /* 206 -- 24, ffffff */
BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 207 -- 30,3fffffff */
BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 208 -- 31,7fffffff */
BMP_C(0xffffffff) << (BMP_BIT - 32), /* 209 -- 32,ffffffff */
};
static const struct malias aliases[];
+1 -1
View File
@@ -467,7 +467,7 @@ static int CmdFlashMemSpiFFSWipe(const char *Cmd) {
CLIParserInit(&ctx, "mem spiffs wipe",
_RED_("* * * Warning * * *") " \n"
_CYAN_("This command wipes all files on the device SPIFFS file system"),
"mem spiffs wipe");
"mem spiffs wipe");
void *argtable[] = {
arg_param_begin,
+2 -2
View File
@@ -3025,7 +3025,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
int16_t fsci = card.ats[1] & 0x0f;
PrintAndLogEx(INFO, " ..." _YELLOW_("%02X") "............ T0 TA1 is%s present, TB1 is%s present, "
"TC1 is%s present, FSCI is %d (FSC = %d)",
"TC1 is%s present, FSCI is %d (FSC = %d)",
card.ats[1],
(ta1 ? "" : _RED_(" NOT")),
(tb1 ? "" : _RED_(" NOT")),
@@ -3047,7 +3047,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
if (strlen(ds) != 0) ds[strlen(ds) - 2] = '\0';
if (strlen(dr) != 0) dr[strlen(dr) - 2] = '\0';
PrintAndLogEx(INFO, " ......" _YELLOW_("%02X") "......... TA1 different divisors are%s supported, "
"DR: [%s], DS: [%s]",
"DR: [%s], DS: [%s]",
card.ats[pos],
((card.ats[pos] & 0x80) ? _RED_(" NOT") : ""),
dr,
+3 -3
View File
@@ -1102,7 +1102,7 @@ static int CmdHF15Info(const char *Cmd) {
if (d[8] == 0x04) {
// NXP
// from: SL2S6002_SDS
// Bit 37 Bit 36 ICODE Type
// -------------------------
@@ -1120,14 +1120,14 @@ static int CmdHF15Info(const char *Cmd) {
// --------------------------------------
// 0 1 0 0 ICODE 3
// --> it can be mismached with a ICODE SLI, but lets assume Bit 39 & Bit 38 at 0 when ICODE SLI*/DNA...
if (d[7] == 0x01 && nxp_version == 0x08) {
PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info");
return NxpSysInfo(uid);
} else if (d[7] == 0x01 && nxp_version == 0x18) { // If it is an NTAG 5 / ICODE DNA
PrintAndLogEx(DEBUG, "NTAG 5 / ICODE DNA Detected, getting NXP System Info");
return NxpSysInfo(uid);
} else if (d[7] == 0x01 && ((d[6] & 0x78) == 0x20)) { // If it is an NTAG ICODE 3
} else if (d[7] == 0x01 && ((d[6] & 0x78) == 0x20)) { // If it is an NTAG ICODE 3
PrintAndLogEx(DEBUG, "ICODE 3 Detected, getting NXP System Info");
return NxpSysInfo(uid);
} else if ((d[7] == 0x01 || d[7] == 0x02 || d[7] == 0x03)) { // If SLI, SLIX, SLIX-l, or SLIX-S check EAS status
+3 -3
View File
@@ -1075,9 +1075,9 @@ static uint8_t calypso_icc_check_value(const uint8_t *data, size_t len) {
static bool calypso_bcd_country(const uint8_t *data, uint16_t *country_code) {
uint8_t nibbles[] = {
data[0] >> 4,
data[0] & 0x0F,
data[1] >> 4,
data[1] & 0x0F,
data[0] & 0x0F,
data[1] >> 4,
data[1] & 0x0F,
};
for (size_t i = 0; i < ARRAYLEN(nibbles); i++) {
+42 -42
View File
@@ -350,10 +350,10 @@ static void print_status_flag1_interpretation(void) {
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
PrintAndLogEx(INFO, " 00 | Indicates the successful completion of a command.");
PrintAndLogEx(INFO, " FF | If an error occurs during the processing of a command that includes no list in the command packet, \n"
" | or if an error occurs independently of any list, the card returns a response by setting FFh to Status Flag1.");
" | or if an error occurs independently of any list, the card returns a response by setting FFh to Status Flag1.");
PrintAndLogEx(INFO, " XX | If an error occurs while processing a command that includes Service Code List or Block List \n"
" | in the command packet, the card returns a response by setting a number in the list to Status Flag1,\n"
" | indicating the location of the error.");
" | in the command packet, the card returns a response by setting a number in the list to Status Flag1,\n"
" | indicating the location of the error.");
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
}
@@ -362,28 +362,28 @@ static void print_status_flag2_interpration(void) {
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
PrintAndLogEx(INFO, " 00 | Indicates the successful completion of a command.");
PrintAndLogEx(INFO, " 01 | The calculated result is either less than zero when the purse data is decremented, or exceeds 4\n"
" | Bytes when the purse data is incremented.");
" | Bytes when the purse data is incremented.");
PrintAndLogEx(INFO, " 02 | The specified data exceeds the value of cashback data at cashback of purse.");
PrintAndLogEx(INFO, " 70 | Memory error (fatal error).");
PrintAndLogEx(INFO, " 71 | The number of memory rewrites exceeds the upper limit (this is only a warning; data writing is performed as normal).\n"
" | The maximum number of rewrites can differ, depending on the product being used.\n"
" | In addition, Status Flag1 is either 00h or FFh depending on the product being used.");
" | The maximum number of rewrites can differ, depending on the product being used.\n"
" | In addition, Status Flag1 is either 00h or FFh depending on the product being used.");
PrintAndLogEx(INFO, " A1 | Illegal Number of Service| Number of Service or Number of Node specified by the command \n"
" | falls outside the range of the prescribed value.");
" | falls outside the range of the prescribed value.");
PrintAndLogEx(INFO, " A2 | Illegal command packet (specified Number of Block) : Number of Block specified by the \n"
" | command falls outside the range of the prescribed values for the product.");
" | command falls outside the range of the prescribed values for the product.");
PrintAndLogEx(INFO, " A3 | Illegal Block List (specified order of Service) : Service Code List Order specified by \n"
" | Block List Element falls outside the Number of Service specified by the command \n"
" | (or the Number of Service specified at the times of mutual authentication).");
" | Block List Element falls outside the Number of Service specified by the command \n"
" | (or the Number of Service specified at the times of mutual authentication).");
PrintAndLogEx(INFO, " A4 | Illegal Service type : Area Attribute specified by the command or Service Attribute of Service Code is incorrect.");
PrintAndLogEx(INFO, " A5 | Access is not allowed : Area or Service specified by the command cannot be accessed.\n"
" | The parameter specified by the command does not satisfy the conditions for success.");
" | The parameter specified by the command does not satisfy the conditions for success.");
PrintAndLogEx(INFO, " A6 | Illegal Service Code List : Target to be accessed, identified by Service Code List Order, specified by Block\n"
" | List Element does not exist. Or, Node specified by Node Code List does not exist.");
" | List Element does not exist. Or, Node specified by Node Code List does not exist.");
PrintAndLogEx(INFO, " A7 | Illegal Block List (Access Mode) : Access Mode specified by Block List Element is incorrect.");
PrintAndLogEx(INFO, " A8 | Illegal Block Number Block Number (access to the specified data is inhibited) :\n"
" | specified by Block List Element exceeds the number of Blocks assigned to Service.");
" | specified by Block List Element exceeds the number of Blocks assigned to Service.");
PrintAndLogEx(INFO, " A9 | Data write failure : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " AA | Key-change failure : Key change failed.");
PrintAndLogEx(INFO, " AB | Illegal Package Parity or illegal Package MAC : This is the error that occurs in issuance commands.");
@@ -391,7 +391,7 @@ static void print_status_flag2_interpration(void) {
PrintAndLogEx(INFO, " AD | Service exists already : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " AE | Illegal System Code : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " AF | Too many simultaneous cyclic write operations : Number of simultaneous write Blocks\n"
" | specified by the command to Cyclic Service exceeds the number of Blocks assigned to Service.");
" | specified by the command to Cyclic Service exceeds the number of Blocks assigned to Service.");
PrintAndLogEx(INFO, " C0 | Illegal Package Identifier : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " C1 | Discrepancy of parameters inside and outside Package : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " C2 | Command is disabled already : This is the error that occurs in issuance commands.");
@@ -415,16 +415,16 @@ static void print_number_of_service_constraints(void) {
static void print_number_of_block_constraints(void) {
PrintAndLogEx(INFO, " - Number of Block: shall be less than or equal to the maximum number of Blocks that can be read simultaneously.\n"
" The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used.\n"
" Use as default 01");
" The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used.\n"
" Use as default 01");
}
static void print_service_code_list_constraints(void) {
PrintAndLogEx(INFO, " - Service Code List: For Service Code List, only Service Code existing in the product shall be specified:");
PrintAndLogEx(INFO, " - Even when Service Code exists in the product, Service Code not referenced from Block List shall not \n"
" be specified to Service Code List.");
" be specified to Service Code List.");
PrintAndLogEx(INFO, " - For existence or nonexistence of Service in a product, please check using the Request Service \n"
" (or Request Service v2) command.");
" (or Request Service v2) command.");
}
/*
@@ -846,8 +846,8 @@ static bool felica_parse_block_list_element(const char *ble_hex, uint8_t *ble_ou
}
static size_t felica_parse_service_node_matchers(const json_t *node_json,
felica_system_service_node_matcher_t *matchers,
size_t matcher_capacity) {
felica_system_service_node_matcher_t *matchers,
size_t matcher_capacity) {
if (node_json == NULL || matchers == NULL || matcher_capacity == 0) {
return 0;
}
@@ -888,9 +888,9 @@ static size_t felica_parse_service_node_matchers(const json_t *node_json,
}
static int felica_read_service_block_for_node(uint8_t flags, const uint8_t *idm,
uint16_t node_code_le,
const uint8_t *block_list_element, uint8_t block_list_element_len,
uint8_t *block_data_out, size_t block_data_out_capacity, size_t *block_data_len_out) {
uint16_t node_code_le,
const uint8_t *block_list_element, uint8_t block_list_element_len,
uint8_t *block_data_out, size_t block_data_out_capacity, size_t *block_data_len_out) {
if (idm == NULL || block_list_element == NULL || block_data_out == NULL || block_data_len_out == NULL) {
return PM3_EINVARG;
}
@@ -934,7 +934,7 @@ static int felica_read_service_block_for_node(uint8_t flags, const uint8_t *idm,
}
static bool felica_block_number_from_block_list_element(const uint8_t *block_list_element,
uint8_t block_list_element_len, uint16_t *block_number) {
uint8_t block_list_element_len, uint16_t *block_number) {
if (block_list_element == NULL || block_number == NULL) {
return false;
}
@@ -953,7 +953,7 @@ static bool felica_block_number_from_block_list_element(const uint8_t *block_lis
}
static bool felica_service_block_data_cache_entry_matches(const felica_service_block_data_cache_entry_t *entry,
const uint8_t *idm, uint16_t service_code_le, uint16_t block_number) {
const uint8_t *idm, uint16_t service_code_le, uint16_t block_number) {
return entry && entry->valid &&
memcmp(entry->idm, idm, sizeof(entry->idm)) == 0 &&
entry->service_code_le == service_code_le &&
@@ -961,10 +961,10 @@ static bool felica_service_block_data_cache_entry_matches(const felica_service_b
}
static int felica_read_service_block_for_node_cached(uint8_t flags, const uint8_t *idm,
uint16_t service_code_le,
const uint8_t *block_list_element, uint8_t block_list_element_len,
uint8_t *block_data_out, size_t block_data_out_capacity, size_t *block_data_len_out,
felica_service_block_data_cache_t *cache) {
uint16_t service_code_le,
const uint8_t *block_list_element, uint8_t block_list_element_len,
uint8_t *block_data_out, size_t block_data_out_capacity, size_t *block_data_len_out,
felica_service_block_data_cache_t *cache) {
if (idm == NULL || block_list_element == NULL || block_data_out == NULL || block_data_len_out == NULL) {
return PM3_EINVARG;
}
@@ -977,7 +977,7 @@ static int felica_read_service_block_for_node_cached(uint8_t flags, const uint8_
uint16_t block_number = 0;
if (felica_block_number_from_block_list_element(block_list_element,
block_list_element_len, &block_number) == false) {
block_list_element_len, &block_number) == false) {
return PM3_EINVARG;
}
@@ -1021,8 +1021,8 @@ static int felica_read_service_block_for_node_cached(uint8_t flags, const uint8_
}
static bool felica_match_service_node_data(uint8_t flags, const uint8_t *idm, uint16_t node_code_le,
const felica_system_service_node_matcher_t *matchers, size_t matcher_count,
felica_service_block_data_cache_t *block_data_cache) {
const felica_system_service_node_matcher_t *matchers, size_t matcher_count,
felica_service_block_data_cache_t *block_data_cache) {
if (idm == NULL || matchers == NULL || matcher_count == 0) {
return true;
}
@@ -1056,8 +1056,8 @@ static bool felica_is_lite_assumed_node(uint16_t node_code_le) {
}
static int felica_request_service_key_versions(uint8_t flags, const uint8_t *idm,
const uint16_t *node_codes_le, size_t node_count,
uint16_t *key_versions_le_out, size_t *returned_nodes_out) {
const uint16_t *node_codes_le, size_t node_count,
uint16_t *key_versions_le_out, size_t *returned_nodes_out) {
if (idm == NULL || node_codes_le == NULL || key_versions_le_out == NULL) {
return PM3_EINVARG;
}
@@ -1115,8 +1115,8 @@ static int felica_request_service_key_versions(uint8_t flags, const uint8_t *idm
}
static void felica_info_process_system_services(int level, uint8_t flags,
uint16_t system_code, const uint8_t *idm, const json_t *system_entry,
felica_service_block_data_cache_t *block_data_cache) {
uint16_t system_code, const uint8_t *idm, const json_t *system_entry,
felica_service_block_data_cache_t *block_data_cache) {
if (idm == NULL || system_entry == NULL) {
return;
}
@@ -1173,8 +1173,8 @@ static void felica_info_process_system_services(int level, uint8_t flags,
json_t *data_json = json_object_get(node_json, "data");
const bool has_data_matchers = json_is_object(data_json) && (json_object_size(data_json) > 0);
const size_t matcher_count = felica_parse_service_node_matchers(node_json,
nodes[node_count].matchers,
ARRAYLEN(nodes[node_count].matchers));
nodes[node_count].matchers,
ARRAYLEN(nodes[node_count].matchers));
if (has_data_matchers && matcher_count == 0) {
continue;
}
@@ -1414,7 +1414,7 @@ static void felica_system_code_to_bytes(uint16_t system_code, uint8_t *system_co
}
static bool felica_add_unique_discovered_system(felica_discovered_system_t *systems, size_t *count,
uint16_t system_code, const uint8_t *idm) {
uint16_t system_code, const uint8_t *idm) {
if (systems == NULL || count == NULL) {
return false;
}
@@ -1510,9 +1510,9 @@ static int discover_systems(uint8_t flags, const uint8_t *primary_idm, bool requ
felica_syscode_response_t system_code_response;
const int request_system_code_status = send_request_system_code(flags,
sizeof(request_system_code_request), (uint8_t *)&request_system_code_request,
false, FELICA_OPTIONAL_CMD_TIMEOUT_MS, FELICA_OPTIONAL_CMD_RETRIES, false,
&system_code_response);
sizeof(request_system_code_request), (uint8_t *)&request_system_code_request,
false, FELICA_OPTIONAL_CMD_TIMEOUT_MS, FELICA_OPTIONAL_CMD_RETRIES, false,
&system_code_response);
if (request_system_code_status == PM3_SUCCESS) {
const size_t reported_systems = system_code_response.number_of_systems[0];
+9 -9
View File
@@ -381,7 +381,7 @@ static int hfgal_create_creds_app(DesfireContext_t *ctx, uint8_t *site_key, uint
// UID is required for key diversification
if (ctx->uidlen == 0) {
PM3_RET_ERR(PM3_EINVARG, "UID is required for key diversification. "
"Please fetch it before calling `hfgal_create_creds_app`");
"Please fetch it before calling `hfgal_create_creds_app`");
}
// Create application
@@ -871,11 +871,11 @@ static int hfgal_read_desfire_card(uint32_t aid, uint8_t *site_key, bool verbose
PM3_RET_IF_ERR_MAYBE_MSG(res, !quiet, "Failed reading card application credentials");
PrintAndLogEx(SUCCESS, "Gallagher (AID %06X) - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
current_aid,
'A' + creds.region_code,
'A' + creds.region_code,
creds.region_code,
creds.facility_code,
creds.card_number,
@@ -1696,10 +1696,10 @@ static int CmdGallagherDecode(const char *cmd) {
gallagher_decode_creds(data_buf, &creds);
PrintAndLogEx(SUCCESS, "Gallagher - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
'A' + creds.region_code,
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
'A' + creds.region_code,
creds.region_code,
creds.facility_code,
creds.card_number,
+33 -18
View File
@@ -8079,26 +8079,39 @@ static int sam_sc_dispatch(uint8_t flags, uint8_t scflag_in,
// A0 15 AF 13 80 01 <ver> 81 01 <kref> 82 08 <rnd_a> 83 01 <tca>
static uint16_t sam_sc_build_init_auth(uint8_t kref, const uint8_t rnd_a[8],
uint8_t out[23]) {
out[0] = 0xA0; out[1] = 0x15;
out[2] = 0xAF; out[3] = 0x13;
out[4] = 0x80; out[5] = 0x01; out[6] = 0x00; // version=0
out[7] = 0x81; out[8] = 0x01; out[9] = kref;
out[10] = 0x82; out[11] = 0x08;
out[0] = 0xA0;
out[1] = 0x15;
out[2] = 0xAF;
out[3] = 0x13;
out[4] = 0x80;
out[5] = 0x01;
out[6] = 0x00; // version=0
out[7] = 0x81;
out[8] = 0x01;
out[9] = kref;
out[10] = 0x82;
out[11] = 0x08;
memcpy(out + 12, rnd_a, 8);
out[20] = 0x83; out[21] = 0x01; out[22] = 0x00; // tca=0
out[20] = 0x83;
out[21] = 0x01;
out[22] = 0x00; // tca=0
return 23;
}
// Build the ContinueAuth SAM payload (40 bytes):
// A0 26 B0 24 80 10 <clientCryptogram> 81 10 <clientCmac>
static uint16_t sam_sc_build_continue_auth(const uint8_t client_crypto[16],
const uint8_t client_cmac[16],
uint8_t out[40]) {
out[0] = 0xA0; out[1] = 0x26;
out[2] = 0xB0; out[3] = 0x24;
out[4] = 0x80; out[5] = 0x10;
const uint8_t client_cmac[16],
uint8_t out[40]) {
out[0] = 0xA0;
out[1] = 0x26;
out[2] = 0xB0;
out[3] = 0x24;
out[4] = 0x80;
out[5] = 0x10;
memcpy(out + 6, client_crypto, 16);
out[22] = 0x81; out[23] = 0x10;
out[22] = 0x81;
out[23] = 0x10;
memcpy(out + 24, client_cmac, 16);
return 40;
}
@@ -8197,7 +8210,7 @@ static int sam_sc_peel_envelope(const uint8_t *resp, uint16_t resp_len,
char *path) {
if (resp_len < 2) return -1;
#define SAM_SC_READ_BER_LEN(buf, buflen, off, out_len) \
#define SAM_SC_READ_BER_LEN(buf, buflen, off, out_len) \
do { \
if ((off) >= (buflen)) return -1; \
uint8_t b0 = (buf)[(off)++]; \
@@ -8240,14 +8253,16 @@ static int sam_sc_peel_envelope(const uint8_t *resp, uint16_t resp_len,
*inner_len = in_len;
return 0;
#undef SAM_SC_READ_BER_LEN
#undef SAM_SC_READ_BER_LEN
}
// Encode a BER length (short form < 128, otherwise 0x81/0x82).
static uint8_t sam_sc_emit_ber_len(uint8_t *out, uint16_t len) {
if (len < 0x80) { out[0] = (uint8_t)len; return 1; }
if (len < 0x100) { out[0] = 0x81; out[1] = (uint8_t)len; return 2; }
out[0] = 0x82; out[1] = (uint8_t)(len >> 8); out[2] = (uint8_t)(len & 0xFF);
out[0] = 0x82;
out[1] = (uint8_t)(len >> 8);
out[2] = (uint8_t)(len & 0xFF);
return 3;
}
@@ -8893,7 +8908,7 @@ static int CmdHFiClassLiberate(const char *Cmd) {
memcpy(key, iClass_Key_Table[0], PICOPASS_BLOCK_SIZE);
int res = iclass_read_block_ex(key, MKF_KNOWN_BLOCK, ICLASS_DEBIT_KEYTYPE, false, false, false,
verbose, true, shallow_mod, blk18, false, false);
verbose, true, shallow_mod, blk18, false, false);
if (res == PM3_SUCCESS) {
// build 2-key 3DES key: CSN || 0570F69A06975CD8
uint8_t des_key[16] = {0};
@@ -8995,7 +9010,7 @@ static int CmdHFiClassLiberate(const char *Cmd) {
case CARD_TYPE_ICOPY_ICL:
case CARD_TYPE_ICOPY_ICS: {
// change KD from DRM key to default key (ki 0)
PrintAndLogEx(INFO, "Changing KD from iCopy-X DRM key to default");
PrintAndLogEx(INFO, "Changing KD from iCopy-X DRM key to default");
// calculate XOR div key
uint8_t xor_div_key[PICOPASS_BLOCK_SIZE] = {0};
@@ -9023,7 +9038,7 @@ static int CmdHFiClassLiberate(const char *Cmd) {
memcpy(default_key, iClass_Key_Table[0], PICOPASS_BLOCK_SIZE);
res = iclass_read_block_ex(default_key, 6, ICLASS_DEBIT_KEYTYPE, false, false, false,
verbose, true, shallow_mod, verify, false, false);
verbose, true, shallow_mod, verify, false, false);
if (res == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "Verified default key ( %s )", _GREEN_("ok"));
} else {
+2 -2
View File
@@ -262,7 +262,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff
// for printing the complete segment we need at least wrc + wrp_len + remain_seg_payload_len bytes
if ((i + wrc + wrp_len + remain_seg_payload_len) > card_size) {
PrintAndLogEx(FAILED, "Cannot read segment body, because the input buffer is too small. "
"Please check that the data is correct and properly aligned. ");
"Please check that the data is correct and properly aligned. ");
return_value = PM3_EOUTOFBOUND;
goto out;
}
@@ -346,7 +346,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff
// for printing the complete segment we need at least wrc + wrp_len + remain_seg_payload_len bytes
if ((i + wrc + wrp_len + remain_seg_payload_len) > card_size) {
PrintAndLogEx(FAILED, "Cannot read segment body, because the input buffer is too small. "
"Please check that the data is correct and properly aligned. ");
"Please check that the data is correct and properly aligned. ");
return_value = PM3_EOUTOFBOUND;
goto out;
}
+3 -3
View File
@@ -2049,7 +2049,7 @@ void annotateSeos(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is
snprintf(exp, size, "CREATE ADF");
return;
}
if (memcmp(cmd + pos, "\x00\xD4\x00\x00\x00", 5) == 0) {
snprintf(exp, size, "GET REMAINING CREDITS");
return;
@@ -2059,7 +2059,7 @@ void annotateSeos(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is
snprintf(exp, size, "GET APPLET INFO");
return;
}
if (memcmp(cmd + pos, "\xA0\xD3\x00\x00\x00", 5) == 0) {
snprintf(exp, size, "GET APPLET VERSION");
return;
@@ -2090,7 +2090,7 @@ void annotateSeos(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is
return ;
}
// CLA 0x90 Proprietary class - DESFire's "ISO 7816 wrap of native commands" indicator.
// CLA 0x90 Proprietary class - DESFire's "ISO 7816 wrap of native commands" indicator.
// Tells the card "the next byte is a DESFire native opcode, not an ISO 7816 standard INS."
// INS 0x5A DESFire native opcode SelectApplication (3-byte AID).
+1 -1
View File
@@ -5049,7 +5049,7 @@ void printKeyTableEx(size_t sectorscnt, sector_t *e_sector, uint8_t start_sector
_YELLOW_("H") ":Hardnested / "
_YELLOW_("C") ":statiCnested / "
_YELLOW_("A") ":keyA "
" )"
" )"
);
if (sectorscnt == 18) {
PrintAndLogEx(INFO, "( " _MAGENTA_("*") " ) These sectors used for signature. Lays outside of user memory");
+56 -56
View File
@@ -6387,9 +6387,9 @@ static int CmdHF14ADesClearRecordFile(const char *Cmd) {
/**
* Parse MFC blocks given on the command line
*
*
* If given for making the license, the blocks must be unique and in ascending order.
*
*
* If given for the CreateMFCMapping command, the blocks must be unique and either all data blocks or all trailer blocks.
*/
static int parse_mfc_blocks(const char *in, uint8_t blocks_out[], size_t *blocks_out_len, bool for_license) {
@@ -6398,7 +6398,7 @@ static int parse_mfc_blocks(const char *in, uint8_t blocks_out[], size_t *blocks
}
*blocks_out_len = 0;
char blk_str[512];
if (strlen(in) + 1 > sizeof (blk_str)) {
if (strlen(in) + 1 > sizeof(blk_str)) {
PrintAndLogEx(ERR, "Argument too long");
return PM3_EINVARG;
}
@@ -6520,7 +6520,7 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
PrintAndLogEx(ERR, "At most one instance of --key is required");
goto mfclicense_parsing_error;
}
if (CLIParamHexToBuf(key_arg, mac_key, sizeof (mac_key), &mac_key_len) != 0) {
if (CLIParamHexToBuf(key_arg, mac_key, sizeof(mac_key), &mac_key_len) != 0) {
goto mfclicense_parsing_error;
}
if (mac_key_len != 16) {
@@ -6529,15 +6529,15 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
}
switch (mfc_keys_arg->count) {
case 0:
use_default_keys = true;
break;
case 1:
use_default_keys = false;
break;
default:
PrintAndLogEx(ERR, "At most instance of --mfc-keys is required");
goto mfclicense_parsing_error;
case 0:
use_default_keys = true;
break;
case 1:
use_default_keys = false;
break;
default:
PrintAndLogEx(ERR, "At most instance of --mfc-keys is required");
goto mfclicense_parsing_error;
}
if (raw_arg->count + blk_str_arg->count != 1) {
@@ -6546,7 +6546,7 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
}
if (has_raw) {
if (CLIParamHexToBuf(raw_arg, license, sizeof (license), &license_len) != 0) {
if (CLIParamHexToBuf(raw_arg, license, sizeof(license), &license_len) != 0) {
goto mfclicense_parsing_error;
}
if (allow_key_a_update || allow_key_b_update || allow_restrict || allow_map || allow_ac) {
@@ -6565,8 +6565,8 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
int last_block = -1;
for (int i = 0; i < num_blocks; i++) {
uint8_t block_nr = license[1 + 2*i];
uint8_t permissions = license[1 + 2*i + 1];
uint8_t block_nr = license[1 + 2 * i];
uint8_t permissions = license[1 + 2 * i + 1];
if (block_nr / 4 != last_sector) {
num_sectors++;
@@ -6584,8 +6584,8 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
goto mfclicense_parsing_error;
}
if ( (((block_nr + 1) % 4 == 0) && (permissions & ~MFDES_EV3C_ALLOWED_TRAILER_PERMISSIONS)) ||
(((block_nr + 1) % 4 != 0) && (permissions & ~MFDES_EV3C_ALLOWED_DATA_PERMISSIONS))) {
if ((((block_nr + 1) % 4 == 0) && (permissions & ~MFDES_EV3C_ALLOWED_TRAILER_PERMISSIONS)) ||
(((block_nr + 1) % 4 != 0) && (permissions & ~MFDES_EV3C_ALLOWED_DATA_PERMISSIONS))) {
PrintAndLogEx(ERR, "Invalid permissions %02X", permissions);
goto mfclicense_parsing_error;
}
@@ -6637,17 +6637,17 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
last_sector = blocks[i] / 4;
}
license[1 + 2*i] = blocks[i];
license[1 + 2 * i] = blocks[i];
if ((blocks[i] + 1) % 4 == 0) {
// mapping a trailer block
license[1 + 2*i + 1] = trailer_permissions;
license[1 + 2 * i + 1] = trailer_permissions;
} else {
// mapping a data block
license[1 + 2*i + 1] = data_permissions;
license[1 + 2 * i + 1] = data_permissions;
}
PrintAndLogEx(loglevel, "[%d] Block %d: permissions %02X", i, license[1 + 2*i], license[1 + 2*i + 1]);
PrintAndLogEx(loglevel, "[%d] Block %d: permissions %02X", i, license[1 + 2 * i], license[1 + 2 * i + 1]);
}
license_len = 1 + 2*num_blocks;
license_len = 1 + 2 * num_blocks;
}
PrintAndLogEx(loglevel, "Covering %lu sector%s in total", num_sectors, num_sectors != 1 ? "s" : "");
@@ -6657,7 +6657,7 @@ static int CmdHF14ADesMakeMFCLicense(const char *Cmd) {
memset(mfc_keys, '\xFF', 6 * num_sectors);
mfc_keys_len = 6 * num_sectors;
} else {
if (CLIParamHexToBuf(mfc_keys_arg, mfc_keys, sizeof (mfc_keys), &mfc_keys_len) != 0) {
if (CLIParamHexToBuf(mfc_keys_arg, mfc_keys, sizeof(mfc_keys), &mfc_keys_len) != 0) {
goto mfclicense_parsing_error;
}
if (mfc_keys_len % 6 != 0) {
@@ -7940,8 +7940,8 @@ static int MfdSelectionSelectApplication(DesfireContext_t *dctx, const mfd_app_s
// Assumes the application is already selected.
// On PM3_SUCCESS: out_card_random[DUOX_INTAUTH_CHALLENGE_LEN] and out_sig_rs[DUOX_INTAUTH_SIG_LEN] are filled.
static int duox_intauth_exchange(bool apdu_logging, bool verbose, uint8_t keynum,
const uint8_t *challenge,
uint8_t *out_card_random, uint8_t *out_sig_rs) {
const uint8_t *challenge,
uint8_t *out_card_random, uint8_t *out_sig_rs) {
// Build ISO Internal Authenticate APDU
//
// Data field:
@@ -8062,8 +8062,8 @@ static int duox_intauth_exchange(bool apdu_logging, bool verbose, uint8_t keynum
// Build the Internal Authenticate verify message (F0F0 || OptsA || RndB || RndA)
// and verify the ECDSA-P256-SHA256 signature. Returns PM3_SUCCESS if valid.
static int duox_intauth_verify_sig(bool verbose, const uint8_t *pubkey_point,
const uint8_t *challenge, const uint8_t *card_random,
const uint8_t *sig_rs) {
const uint8_t *challenge, const uint8_t *card_random,
const uint8_t *sig_rs) {
// Message = F0F0 || OptsA TLV || RndB (card random) || RndA (our challenge)
static const uint8_t optsa_tlv[] = {DUOX_TAG_OPTSA, 0x00};
uint8_t message[2 + 2 + DUOX_INTAUTH_CHALLENGE_LEN + DUOX_INTAUTH_CHALLENGE_LEN];
@@ -8075,16 +8075,16 @@ static int duox_intauth_verify_sig(bool verbose, const uint8_t *pubkey_point,
if (verbose)
PrintAndLogEx(INFO, "Verify msg... %s", sprint_hex_inrow(message, sizeof(message)));
return ecdsa_signature_r_s_verify(
MBEDTLS_ECP_DP_SECP256R1,
(uint8_t *)pubkey_point,
message,
(int)sizeof(message),
(uint8_t *)sig_rs,
DUOX_INTAUTH_SIG_LEN,
true // hash message with SHA-256 before verifying
);
MBEDTLS_ECP_DP_SECP256R1,
(uint8_t *)pubkey_point,
message,
(int)sizeof(message),
(uint8_t *)sig_rs,
DUOX_INTAUTH_SIG_LEN,
true // hash message with SHA-256 before verifying
);
}
static int CmdHF14ADesIntAuth(const char *Cmd) {
@@ -8356,14 +8356,14 @@ static int CmdHF14ADesVdeSign(const char *Cmd) {
PrintAndLogEx(INFO, "Verify msg... %s", sprint_hex_inrow(challenge, sizeof(challenge)));
int sig_res = ecdsa_signature_r_s_verify(
MBEDTLS_ECP_DP_BP256R1,
pubkey_point,
challenge,
(int)sizeof(challenge),
signature_rs,
sizeof(signature_rs),
true
);
MBEDTLS_ECP_DP_BP256R1,
pubkey_point,
challenge,
(int)sizeof(challenge),
signature_rs,
sizeof(signature_rs),
true
);
if (sig_res == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "ECDSA signature " _GREEN_("verified"));
@@ -8704,9 +8704,9 @@ static int mfdes_verify_certificate_variants(const uint8_t *data, size_t data_le
bool verbose, mfdes_verified_cert_t *out, size_t *matched_index) {
duox_cert_info_t cert = {0};
int res = duox_parse_or_verify_certificate_variants(data, data_len,
ca_anchors, ca_anchor_count,
verify_signature,
verbose, &cert, matched_index);
ca_anchors, ca_anchor_count,
verify_signature,
verbose, &cert, matched_index);
if (res == PM3_SUCCESS || res == PM3_ECRYPTO) {
mfdes_cert_info_from_duox(&cert, out);
}
@@ -9170,11 +9170,11 @@ static int CmdHF14ADesVerifyCert(const char *Cmd) {
DesfireContext_t dctx = {0};
int securechann = defaultSecureChannel;
res = CmdDesGetSessionParameters(ctx, &dctx,
4, 5, 6, 7, 8, 9, 10, 11,
0, 0, 0,
&securechann,
force_auth ? DCMMACed : DCMPlain,
NULL, NULL);
4, 5, 6, 7, 8, 9, 10, 11,
0, 0, 0,
&securechann,
force_auth ? DCMMACed : DCMPlain,
NULL, NULL);
if (res) {
CLIParserFree(ctx);
return res;
@@ -9284,7 +9284,7 @@ static int CmdHF14ADesVerifyCert(const char *Cmd) {
DesfireSetKeyNoClear(&aes_dctx, aes_dctx.keyNum, T_AES, zero_key);
cert_buf_len = 0;
int read_res = mfdes_read_cert_file_desfire(&aes_dctx, (DesfireSecureChannel)securechann, cert_fid,
false, true, verbose, cert_buf, &cert_buf_len);
false, true, verbose, cert_buf, &cert_buf_len);
if (read_res == PM3_SUCCESS && cert_buf_len > 0) {
if (verbose) {
PrintAndLogEx(INFO, " retry file size....: " _YELLOW_("%zu bytes"), cert_buf_len);
@@ -9338,8 +9338,8 @@ static int CmdHF14ADesVerifyCert(const char *Cmd) {
}
res = mfdes_run_key_possession_verification(APDULogging, verbose, validate_methods,
validate_method_count, validate_method_forced,
&key_select, keyidx, &cert_info);
validate_method_count, validate_method_forced,
&key_select, keyidx, &cert_info);
if (res != PM3_SUCCESS) {
retval = res;
goto out;
+17 -17
View File
@@ -867,7 +867,7 @@ static bool ndef_detect_message(const uint8_t *d, uint16_t n) {
// start at OTP block and detect a CC container instead
const uint8_t *p = d + (3 * MFU_BLOCK_SIZE);
// no NDEF capability container
if (p[0] != 0xE1 && p[0] != 0xF1) {
return false;
@@ -3451,22 +3451,22 @@ void mfu_print_dump(mfu_dump_t *card, uint16_t pages, uint8_t startpage, bool de
if (i == 3) {
// otp block
PrintAndLogEx(INFO, "%3d/0x%02X | " _CYAN_("%s")"| %s | %s"
, i + startpage
, i + startpage
, sprint_hex(data + i * 4, 4)
, lckbitchar
, sprint_ascii(data + i * 4, 4)
);
, i + startpage
, i + startpage
, sprint_hex(data + i * 4, 4)
, lckbitchar
, sprint_ascii(data + i * 4, 4)
);
} else {
// normal block
PrintAndLogEx(INFO, "%3d/0x%02X | %s| %s | %s"
, i + startpage
, i + startpage
, sprint_hex(data + i * 4, 4)
, lckbitchar
, sprint_ascii(data + i * 4, 4)
);
, i + startpage
, i + startpage
, sprint_hex(data + i * 4, 4)
, lckbitchar
, sprint_ascii(data + i * 4, 4)
);
}
}
}
@@ -5935,7 +5935,7 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t *)&payload, sizeof(payload));
if (WaitForResponseTimeout(CMD_HF_MFU_COUNTER_TEAROFF, &resp, 2000) == false) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "\nTear off command failed");
@@ -6057,7 +6057,7 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t *)&payload, sizeof(payload));
if (WaitForResponseTimeout(CMD_HF_MFU_COUNTER_TEAROFF, &resp, 2000) == false) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "\nTear off command failed");
@@ -6146,7 +6146,7 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t *)&payload, sizeof(payload));
if (WaitForResponseTimeout(CMD_HF_MFU_COUNTER_TEAROFF, &resp, 2000) == false) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "\nTear off command failed");
@@ -6168,7 +6168,7 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) {
memcpy(payload.value, (uint8_t[]) {0x00, 0x00, 0x00}, sizeof(payload.value));
clearCommandBuffer();
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t *)&payload, sizeof(payload));
if (WaitForResponseTimeout(CMD_HF_MFU_COUNTER_TEAROFF, &resp, 2000) == false) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "\nTear off command failed");
+2 -2
View File
@@ -723,8 +723,8 @@ static int ntag424_authenticate_ev2_first(uint8_t keyno, uint8_t *key, ntag424_s
if (memcmp(response.rnd_a, &rnd_a_clear[1], 15) != 0 ||
response.rnd_a[15] != rnd_a_clear[0]) {
PrintAndLogEx(ERR, "Incorrect response from card\n"
"expected: %s\n"
"got: %s"
"expected: %s\n"
"got: %s"
, sprint_hex(rnd_a_clear, 16),
sprint_hex(response.rnd_a, 16));
return PM3_ESOFT;
+3 -3
View File
@@ -323,7 +323,7 @@ static inline uint16_t _get_saflok_mfc_card_creation_year_impl(const saflok_mfc_
return creation_year;
}
static inline bool _set_saflok_mfc_card_creation_year_impl(saflok_mfc_data_t *data, uint16_t year) {
if (year < 1980u || year > (1980u+0x7Fu)) {
if (year < 1980u || year > (1980u + 0x7Fu)) {
PrintAndLogEx(ERR, _RED_("ERROR:") " year out of range (%u)", year);
return false;
}
@@ -375,7 +375,7 @@ static inline bool _set_saflok_mfc_card_creation_minute_impl(saflok_mfc_data_t *
static inline bool is_saflok_mfc_datetime_valid(const saflok_mfc_datetime_t *date) {
bool result = true;
if ((date->year < 1980) || (date->year > (1980u+0xFFu))) {
if ((date->year < 1980) || (date->year > (1980u + 0xFFu))) {
PrintAndLogEx(WARNING, "year out of range (%d)", date->year);
result = false;
}
@@ -415,7 +415,7 @@ static inline saflok_mfc_datetime_t get_saflok_mfc_card_creation_datetime(
}
return date;
}
static inline bool set_saflok_mfc_card_creation_datetime(saflok_mfc_data_t * data, const saflok_mfc_datetime_t * date) {
static inline bool set_saflok_mfc_card_creation_datetime(saflok_mfc_data_t *data, const saflok_mfc_datetime_t *date) {
if (!is_saflok_mfc_datetime_valid(date)) {
PrintAndLogEx(ERR, _RED_("ERROR:") " creation date is invalid");
return false;
+5 -5
View File
@@ -476,11 +476,11 @@ static int CmdHFHIDConfigSim(const char *Cmd) {
strncpy(uid_str, sprint_hex_inrow(uid, uidlen), sizeof(uid_str) - 1);
uid_str[sizeof(uid_str) - 1] = '\0';
PrintAndLogEx(INFO, "HID Config Card sim:"
" UID " _YELLOW_("%s")
" AID " _YELLOW_("%s")
" ATS len " _YELLOW_("%d")
" APDU overrides " _YELLOW_("%u")
" default resp " _YELLOW_("%s"),
" UID " _YELLOW_("%s")
" AID " _YELLOW_("%s")
" ATS len " _YELLOW_("%d")
" APDU overrides " _YELLOW_("%u")
" default resp " _YELLOW_("%s"),
uid_str, aid_str, ats_len, apdu_count,
has_default_resp ? sprint_hex_inrow(default_resp, default_resp_len_sz) : "9000 (builtin)");
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to abort simulation");
+2 -2
View File
@@ -1854,7 +1854,7 @@ static int CmdHfSeosWrite(const char *Cmd) {
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
int data_tag_len = 0;
int data_tag_len = 0;
uint8_t data_tag[16] = {0xff, 0x00};
CLIGetHexWithReturn(ctx, 1, data_tag, &data_tag_len);
@@ -2129,7 +2129,7 @@ static int CmdHfSeosSim(const char *Cmd) {
PacketResponseNG resp;
clearCommandBuffer();
SendCommandNG(CMD_HF_SEOS_SIMULATE, (uint8_t*)&request, sizeof(request));
SendCommandNG(CMD_HF_SEOS_SIMULATE, (uint8_t *)&request, sizeof(request));
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to abort simulation");
while (WaitForResponseTimeout(CMD_HF_SEOS_SIMULATE, &resp, 1000) == false) {
+4 -4
View File
@@ -1829,11 +1829,11 @@ int CmdLFRelay(const char *Cmd) {
" --rdr : Reading device, act as IP client and reads LF tag and sends data\n"
" --tag : Simulation device, act as IP server and simulates relayed data\n",
_WHITE_("Device A, reading LF tag, client") "\n"
"lf relay --rdr --ip 192.168.1.141 -> Client, connect to IP 192.168.1.141:8000\n"
"lf relay --rdr --ip 192.168.1.141 -p 18111 -> Client, connect to IP 192.168.1.141:18111 \n\n"
"lf relay --rdr --ip 192.168.1.141 -> Client, connect to IP 192.168.1.141:8000\n"
"lf relay --rdr --ip 192.168.1.141 -p 18111 -> Client, connect to IP 192.168.1.141:18111 \n\n"
_WHITE_("Device B, simulate LF tag, server") "\n"
"lf relay --tag -p 8111 -> Server listening port 8111, recv 40000 samples\n"
"lf relay --tag -s 10000 -> Server listening port 8000, recv 10000 samples\n"
"lf relay --tag -p 8111 -> Server listening port 8111, recv 40000 samples\n"
"lf relay --tag -s 10000 -> Server listening port 8000, recv 10000 samples\n"
);
void *argtable[] = {
+3 -3
View File
@@ -948,9 +948,9 @@ static int CmdT55xxReadBlock(const char *Cmd) {
_CYAN_("Use of read with password on a tag not configured") "\n"
_CYAN_("for a password can damage the tag") "\n"
_RED_(" * * * * * * * * * *"),
"lf t55xx read -b 0 --> read data from block 0\n"
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
"lf t55xx read -b 0 --> read data from block 0\n"
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
);
// 1 (help) + 4(four user specified params) + (5 T55XX_DLMODE_SINGLE)
+1 -1
View File
@@ -1498,7 +1498,7 @@ int CmdTraceList(const char *Cmd) {
if (protocol == LEGIC)
PrintAndLogEx(INFO, _YELLOW_("LEGIC") " - Reader Mode: Timings are in ticks (1us == 1.5ticks)\n"
" Tag Mode: Timings are in sub carrier periods (1/212 kHz == 4.7us)");
" Tag Mode: Timings are in sub carrier periods (1/212 kHz == 4.7us)");
if (protocol == ISO_14443B || protocol == PROTO_CRYPTORF) {
if (use_us)
+18 -18
View File
@@ -151,7 +151,7 @@ static int duox_load_x509_certificate_input(const char *input, mbedtls_x509_crt
}
static int duox_load_certificate_anchor_from_certificate_input(const char *input, const char *name_hint,
const char *source, duox_certificate_anchor_t *anchor) {
const char *source, duox_certificate_anchor_t *anchor) {
if (input == NULL || anchor == NULL) {
return PM3_EINVARG;
}
@@ -713,12 +713,12 @@ static int duox_verify_gp_vde_signature(const uint8_t *signed_data, size_t signe
tried[i] = true;
int res = ecdsa_signature_r_s_verify(MBEDTLS_ECP_DP_BP256R1,
(uint8_t *)pubkey,
(uint8_t *)signed_data,
(int)signed_data_len,
(uint8_t *)signature_rs,
DUOX_VDE_SIG_LEN,
true);
(uint8_t *)pubkey,
(uint8_t *)signed_data,
(int)signed_data_len,
(uint8_t *)signature_rs,
DUOX_VDE_SIG_LEN,
true);
if (res == PM3_SUCCESS) {
if (matched_index != NULL) {
*matched_index = i;
@@ -864,8 +864,8 @@ static int duox_parse_or_verify_x509_payload(const uint8_t *data, size_t data_le
bool verbose, duox_cert_info_t *out, size_t *matched_index) {
return verify_signature
? duox_verify_x509_certificate_with_anchors(data, data_len,
ca_anchors, ca_anchor_count,
verbose, out, matched_index)
ca_anchors, ca_anchor_count,
verbose, out, matched_index)
: duox_parse_x509_certificate(data, data_len, verbose, out);
}
@@ -915,9 +915,9 @@ static int duox_verify_x509_certificate_variants(const uint8_t *data, size_t dat
PrintAndLogEx(INFO, "Trying zero-padded X.509 payload (%zu bytes)", payload_len);
}
return duox_parse_or_verify_x509_payload(data, payload_len,
ca_anchors, ca_anchor_count,
verify_signature,
verbose, out, matched_index);
ca_anchors, ca_anchor_count,
verify_signature,
verbose, out, matched_index);
}
return PM3_ENODATA;
@@ -928,17 +928,17 @@ int duox_parse_or_verify_certificate_variants(const uint8_t *data, size_t data_l
bool verify_signature,
bool verbose, duox_cert_info_t *out, size_t *matched_index) {
int x509_res = duox_verify_x509_certificate_variants(data, data_len,
ca_anchors, ca_anchor_count,
verify_signature,
verbose, out, matched_index);
ca_anchors, ca_anchor_count,
verify_signature,
verbose, out, matched_index);
if (x509_res != PM3_ENODATA) {
return x509_res;
}
int gp_res = duox_parse_gp_vde_certificate(data, data_len,
ca_anchors, ca_anchor_count,
verify_signature,
verbose, out, matched_index);
ca_anchors, ca_anchor_count,
verify_signature,
verbose, out, matched_index);
if (gp_res != PM3_ENODATA) {
return gp_res;
}
+6 -2
View File
@@ -440,7 +440,9 @@ static int pcrypto_decompress_ec_point(const uint8_t *compressed, size_t comp_le
// Solve y = sqrt(x^3 + ax + b) mod p, using y = rhs^((p+1)/4) mod p (valid for p ≡ 3 mod 4).
// Factor as: r = x(x^2 + a) + b to save one multiplication.
mbedtls_mpi r, x, n;
mbedtls_mpi_init(&r); mbedtls_mpi_init(&x); mbedtls_mpi_init(&n);
mbedtls_mpi_init(&r);
mbedtls_mpi_init(&x);
mbedtls_mpi_init(&n);
// Copy X coordinate and output prefix
memcpy(out, compressed, comp_len);
@@ -471,7 +473,9 @@ static int pcrypto_decompress_ec_point(const uint8_t *compressed, size_t comp_le
// Write Y coordinate
ok = ok && (mbedtls_mpi_write_binary(&r, out + 1 + coord_len, coord_len) == 0);
mbedtls_mpi_free(&r); mbedtls_mpi_free(&x); mbedtls_mpi_free(&n);
mbedtls_mpi_free(&r);
mbedtls_mpi_free(&x);
mbedtls_mpi_free(&n);
return ok ? PM3_SUCCESS : PM3_ESOFT;
}
+1 -1
View File
@@ -124,7 +124,7 @@ static int build_segs_from_phdrs(flash_file_t *ctx, uint32_t flash_size) {
offset);
if (filesz != memsz) {
PrintAndLogEx(ERR, "Error: PHDR file size does not equal memory size\n"
"(DATA+BSS PHDRs do not make sense on ROM platforms!)");
"(DATA+BSS PHDRs do not make sense on ROM platforms!)");
return PM3_EFILE;
}
if (paddr < last_end) {
+56 -16
View File
@@ -58,13 +58,31 @@ static inline void bs_tick(uint64_t *t, uint64_t *b, uint64_t *l, uint64_t *r, c
const uint64_t new_b = Bt ^ cr7;
// Shift t (bit 0 drops out, new_t goes in at bit 15) and b similarly.
t[0] = t[1]; t[1] = t[2]; t[2] = t[3]; t[3] = t[4];
t[4] = t[5]; t[5] = t[6]; t[6] = t[7]; t[7] = t[8];
t[8] = t[9]; t[9] = t[10]; t[10] = t[11]; t[11] = t[12];
t[12] = t[13]; t[13] = t[14]; t[14] = t[15]; t[15] = new_t;
t[0] = t[1];
t[1] = t[2];
t[2] = t[3];
t[3] = t[4];
t[4] = t[5];
t[5] = t[6];
t[6] = t[7];
t[7] = t[8];
t[8] = t[9];
t[9] = t[10];
t[10] = t[11];
t[11] = t[12];
t[12] = t[13];
t[13] = t[14];
t[14] = t[15];
t[15] = new_t;
b[0] = b[1]; b[1] = b[2]; b[2] = b[3]; b[3] = b[4];
b[4] = b[5]; b[5] = b[6]; b[6] = b[7]; b[7] = new_b;
b[0] = b[1];
b[1] = b[2];
b[2] = b[3];
b[3] = b[4];
b[4] = b[5];
b[5] = b[6];
b[6] = b[7];
b[7] = new_b;
const uint64_t ncr3 = ~cr3;
const uint64_t ncr5 = ~cr5;
@@ -84,8 +102,14 @@ static inline void bs_tick(uint64_t *t, uint64_t *b, uint64_t *l, uint64_t *r, c
kb[6 * 8 + bit], kb[7 * 8 + bit]);
}
val[0] ^= b[0]; val[1] ^= b[1]; val[2] ^= b[2]; val[3] ^= b[3];
val[4] ^= b[4]; val[5] ^= b[5]; val[6] ^= b[6]; val[7] ^= b[7];
val[0] ^= b[0];
val[1] ^= b[1];
val[2] ^= b[2];
val[3] ^= b[3];
val[4] ^= b[4];
val[5] ^= b[5];
val[6] ^= b[6];
val[7] ^= b[7];
uint64_t old_r[8];
for (int i = 0; i < 8; i++) {
@@ -192,19 +216,35 @@ static inline void bs_init_state(const uint64_t kb[64], uint64_t l[8], uint64_t
bs_add8(k0xor, x21, r);
// b = 0x4C → 0,0,1,1,0,0,1,0 (LSB first)
b[0] = 0; b[1] = 0;
b[2] = BS_ALL_ONES; b[3] = BS_ALL_ONES;
b[4] = 0; b[5] = 0;
b[6] = BS_ALL_ONES; b[7] = 0;
b[0] = 0;
b[1] = 0;
b[2] = BS_ALL_ONES;
b[3] = BS_ALL_ONES;
b[4] = 0;
b[5] = 0;
b[6] = BS_ALL_ONES;
b[7] = 0;
// t = 0xE012 → LSB-first across 16 bits:
// 0xE012 = 0b1110_0000_0001_0010
// bit0=0 bit1=1 bit2=0 bit3=0 bit4=1 bit5=0 bit6=0 bit7=0
// bit8=0 bit9=0 bit10=0 bit11=0 bit12=0 bit13=1 bit14=1 bit15=1
t[ 0] = 0; t[ 1] = BS_ALL_ONES; t[ 2] = 0; t[ 3] = 0;
t[ 4] = BS_ALL_ONES; t[ 5] = 0; t[ 6] = 0; t[ 7] = 0;
t[ 8] = 0; t[ 9] = 0; t[10] = 0; t[11] = 0;
t[12] = 0; t[13] = BS_ALL_ONES; t[14] = BS_ALL_ONES; t[15] = BS_ALL_ONES;
t[ 0] = 0;
t[ 1] = BS_ALL_ONES;
t[ 2] = 0;
t[ 3] = 0;
t[ 4] = BS_ALL_ONES;
t[ 5] = 0;
t[ 6] = 0;
t[ 7] = 0;
t[ 8] = 0;
t[ 9] = 0;
t[10] = 0;
t[11] = 0;
t[12] = 0;
t[13] = BS_ALL_ONES;
t[14] = BS_ALL_ONES;
t[15] = BS_ALL_ONES;
}
uint64_t doMAC_brute_match64(const uint64_t y_bits_bs[96], const uint64_t kb[64], const uint64_t target_mac_bs[32]) {
+30 -12
View File
@@ -54,7 +54,7 @@ static inline void bs_tick(__m256i *t, __m256i *b, __m256i *l, __m256i *r,
const __m256i *kb, __m256i y_bs) {
const __m256i Tt = _mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(
_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(t[15], t[14]), t[10]), t[8]), t[5]), t[4]), t[1]), t[0]);
_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(t[15], t[14]), t[10]), t[8]), t[5]), t[4]), t[1]), t[0]);
const __m256i Bt = _mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(b[6], b[5]), b[4]), b[0]);
const __m256i cr0 = r[7], cr1 = r[6], cr2 = r[5], cr3 = r[4];
@@ -77,7 +77,7 @@ static inline void bs_tick(__m256i *t, __m256i *b, __m256i *l, __m256i *r,
const __m256i ncr5 = bs_not(cr5);
const __m256i z0 = _mm256_xor_si256(_mm256_xor_si256(_mm256_and_si256(cr0, cr2), _mm256_and_si256(cr1, ncr3)), _mm256_or_si256(cr2, cr4));
const __m256i z1 = _mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256( _mm256_or_si256(cr0, cr2), _mm256_or_si256(cr5, cr7)), cr1), cr6), Tt), y_bs);
const __m256i z1 = _mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_or_si256(cr0, cr2), _mm256_or_si256(cr5, cr7)), cr1), cr6), Tt), y_bs);
const __m256i z2 = _mm256_xor_si256(_mm256_xor_si256(_mm256_xor_si256(_mm256_and_si256(cr3, ncr5), _mm256_and_si256(cr4, cr6)), cr7), Tt);
const __m256i nz0 = bs_not(z0);
@@ -145,14 +145,32 @@ static inline void bs_init_state(const __m256i kb[64], __m256i l[8], __m256i r[8
bs_add8(k0xor, x21, r);
// b = 0x4C LSB-first: 0,0,1,1,0,0,1,0
b[0] = BS_ZERO; b[1] = BS_ZERO; b[2] = BS_ONES; b[3] = BS_ONES;
b[4] = BS_ZERO; b[5] = BS_ZERO; b[6] = BS_ONES; b[7] = BS_ZERO;
b[0] = BS_ZERO;
b[1] = BS_ZERO;
b[2] = BS_ONES;
b[3] = BS_ONES;
b[4] = BS_ZERO;
b[5] = BS_ZERO;
b[6] = BS_ONES;
b[7] = BS_ZERO;
// t = 0xE012 LSB-first: 0,1,0,0,1,0,0,0, 0,0,0,0,0,1,1,1
t[ 0] = BS_ZERO; t[ 1] = BS_ONES; t[ 2] = BS_ZERO; t[ 3] = BS_ZERO;
t[ 4] = BS_ONES; t[ 5] = BS_ZERO; t[ 6] = BS_ZERO; t[ 7] = BS_ZERO;
t[ 8] = BS_ZERO; t[ 9] = BS_ZERO; t[10] = BS_ZERO; t[11] = BS_ZERO;
t[12] = BS_ZERO; t[13] = BS_ONES; t[14] = BS_ONES; t[15] = BS_ONES;
t[ 0] = BS_ZERO;
t[ 1] = BS_ONES;
t[ 2] = BS_ZERO;
t[ 3] = BS_ZERO;
t[ 4] = BS_ONES;
t[ 5] = BS_ZERO;
t[ 6] = BS_ZERO;
t[ 7] = BS_ZERO;
t[ 8] = BS_ZERO;
t[ 9] = BS_ZERO;
t[10] = BS_ZERO;
t[11] = BS_ZERO;
t[12] = BS_ZERO;
t[13] = BS_ONES;
t[14] = BS_ONES;
t[15] = BS_ONES;
}
void prepare_ccnr_bits_bs256(const uint8_t *cc_nr, uint64_t y_bits_bs[96 * BS256_WORDS]) {
@@ -275,16 +293,16 @@ void prepare_target_mac_bs256(const uint8_t target_mac[4], uint64_t target_mac_b
(void)target_mac_bs;
}
void build_bitslice_key_256(const uint8_t partial_key[8], uint64_t index_start, uint64_t kb[64 * BS256_WORDS]) {
(void)partial_key;
(void)index_start;
(void)partial_key;
(void)index_start;
(void)kb;
}
void doMAC_brute_match256(const uint64_t y_bits_bs[96 * BS256_WORDS],
const uint64_t kb[64 * BS256_WORDS],
const uint64_t target_mac_bs[32 * BS256_WORDS],
uint64_t match_out[BS256_WORDS]) {
(void)y_bits_bs;
(void)kb;
(void)y_bits_bs;
(void)kb;
(void)target_mac_bs;
for (int i = 0; i < BS256_WORDS; i++) {
match_out[i] = 0;
+71 -35
View File
@@ -27,7 +27,7 @@
#define BS_ZERO _mm512_setzero_si512()
#define BS_ONES _mm512_set1_epi64(-1)
static inline __m512i bs_not(__m512i v) {
static inline __m512i bs_not(__m512i v) {
return _mm512_xor_si512(v, BS_ONES);
}
@@ -57,7 +57,7 @@ static inline void bs_tick(__m512i *t, __m512i *b, __m512i *l, __m512i *r,
const __m512i *kb, __m512i y_bs) {
const __m512i Tt = _mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(
_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(t[15], t[14]), t[10]), t[8]), t[5]), t[4]), t[1]), t[0]);
_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(t[15], t[14]), t[10]), t[8]), t[5]), t[4]), t[1]), t[0]);
const __m512i Bt = _mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(b[6], b[5]), b[4]), b[0]);
const __m512i cr0 = r[7], cr1 = r[6], cr2 = r[5], cr3 = r[4];
@@ -82,7 +82,7 @@ static inline void bs_tick(__m512i *t, __m512i *b, __m512i *l, __m512i *r,
const __m512i ncr5 = bs_not(cr5);
const __m512i z0 = _mm512_xor_si512(_mm512_xor_si512(_mm512_and_si512(cr0, cr2), _mm512_and_si512(cr1, ncr3)), _mm512_or_si512(cr2, cr4));
const __m512i z1 = _mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512( _mm512_or_si512(cr0, cr2), _mm512_or_si512(cr5, cr7)), cr1), cr6), Tt), y_bs);
const __m512i z1 = _mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_or_si512(cr0, cr2), _mm512_or_si512(cr5, cr7)), cr1), cr6), Tt), y_bs);
const __m512i z2 = _mm512_xor_si512(_mm512_xor_si512(_mm512_xor_si512(_mm512_and_si512(cr3, ncr5), _mm512_and_si512(cr4, cr6)), cr7), Tt);
const __m512i nz0 = bs_not(z0);
@@ -115,27 +115,45 @@ static inline void bs_tick(__m512i *t, __m512i *b, __m512i *l, __m512i *r,
// w*64 .. w*64+63, bit b of word w = lane w*64+b).
static const uint64_t LANE_BITS_512_RAW[9][BS512_WORDS] = {
// k=0..5 are the same in-word pattern repeated across all 8 words.
{0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL,
0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL}, // k=0
{0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL,
0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL}, // k=1
{0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL,
0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL}, // k=2
{0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL,
0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL}, // k=3
{0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL,
0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL}, // k=4
{0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL,
0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL}, // k=5
{
0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL,
0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL
}, // k=0
{
0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL,
0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL
}, // k=1
{
0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL,
0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL
}, // k=2
{
0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL,
0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL
}, // k=3
{
0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL,
0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL
}, // k=4
{
0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL,
0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL, 0xFFFFFFFF00000000ULL
}, // k=5
// k=6: alternate zero/all-ones per word.
{0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL,
0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL}, // k=6
{
0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL,
0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL
}, // k=6
// k=7: 00110011 across words.
{0x0000000000000000ULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
0x0000000000000000ULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL}, // k=7
{
0x0000000000000000ULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
0x0000000000000000ULL, 0x0000000000000000ULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL
}, // k=7
// k=8: low half zero, high half all-ones.
{0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL,
0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL}, // k=8
{
0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL,
0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL
}, // k=8
};
static inline __m512i lane_bits_512(int k) {
@@ -162,13 +180,31 @@ static inline void bs_init_state(const __m512i kb[64],
bs_add8(k0xor, ec, l);
bs_add8(k0xor, x21, r);
b[0] = BS_ZERO; b[1] = BS_ZERO; b[2] = BS_ONES; b[3] = BS_ONES;
b[4] = BS_ZERO; b[5] = BS_ZERO; b[6] = BS_ONES; b[7] = BS_ZERO;
b[0] = BS_ZERO;
b[1] = BS_ZERO;
b[2] = BS_ONES;
b[3] = BS_ONES;
b[4] = BS_ZERO;
b[5] = BS_ZERO;
b[6] = BS_ONES;
b[7] = BS_ZERO;
t[ 0] = BS_ZERO; t[ 1] = BS_ONES; t[ 2] = BS_ZERO; t[ 3] = BS_ZERO;
t[ 4] = BS_ONES; t[ 5] = BS_ZERO; t[ 6] = BS_ZERO; t[ 7] = BS_ZERO;
t[ 8] = BS_ZERO; t[ 9] = BS_ZERO; t[10] = BS_ZERO; t[11] = BS_ZERO;
t[12] = BS_ZERO; t[13] = BS_ONES; t[14] = BS_ONES; t[15] = BS_ONES;
t[ 0] = BS_ZERO;
t[ 1] = BS_ONES;
t[ 2] = BS_ZERO;
t[ 3] = BS_ZERO;
t[ 4] = BS_ONES;
t[ 5] = BS_ZERO;
t[ 6] = BS_ZERO;
t[ 7] = BS_ZERO;
t[ 8] = BS_ZERO;
t[ 9] = BS_ZERO;
t[10] = BS_ZERO;
t[11] = BS_ZERO;
t[12] = BS_ZERO;
t[13] = BS_ONES;
t[14] = BS_ONES;
t[15] = BS_ONES;
}
void prepare_ccnr_bits_bs512(const uint8_t *cc_nr, uint64_t y_bits_bs[96 * BS512_WORDS]) {
@@ -277,27 +313,27 @@ bool bs_avx512_supported(void) {
bool bs_avx512_supported(void) { return false; }
void prepare_ccnr_bits_bs512(const uint8_t *cc_nr, uint64_t y_bits_bs[96 * BS512_WORDS]) {
(void)cc_nr;
(void)cc_nr;
(void)y_bits_bs;
}
void prepare_target_mac_bs512(const uint8_t target_mac[4], uint64_t target_mac_bs[32 * BS512_WORDS]) {
(void)target_mac;
(void)target_mac;
(void)target_mac_bs;
}
void build_bitslice_key_512(const uint8_t partial_key[8], uint64_t index_start, uint64_t kb[64 * BS512_WORDS]) {
(void)partial_key;
(void)index_start;
(void)partial_key;
(void)index_start;
(void)kb;
}
void doMAC_brute_match512(const uint64_t y_bits_bs[96 * BS512_WORDS],
const uint64_t kb[64 * BS512_WORDS],
const uint64_t target_mac_bs[32 * BS512_WORDS],
uint64_t match_out[BS512_WORDS]) {
(void)y_bits_bs;
(void)kb;
(void)y_bits_bs;
(void)kb;
(void)target_mac_bs;
for (int i = 0; i < BS512_WORDS; i++) {
match_out[i] = 0;
}
+33 -15
View File
@@ -61,7 +61,7 @@ static inline void bs_tick(uint64x2_t *t, uint64x2_t *b, uint64x2_t *l, uint64x2
t[i] = t[i + 1];
}
t[15] = new_t;
for (int i = 0; i < 7; i++) {
b[i] = b[i + 1];
}
@@ -134,13 +134,31 @@ static inline void bs_init_state(const uint64x2_t kb[64], uint64x2_t l[8], uint6
bs_add8(k0xor, ec, l);
bs_add8(k0xor, x21, r);
b[0] = BS_ZERO; b[1] = BS_ZERO; b[2] = BS_ONES; b[3] = BS_ONES;
b[4] = BS_ZERO; b[5] = BS_ZERO; b[6] = BS_ONES; b[7] = BS_ZERO;
b[0] = BS_ZERO;
b[1] = BS_ZERO;
b[2] = BS_ONES;
b[3] = BS_ONES;
b[4] = BS_ZERO;
b[5] = BS_ZERO;
b[6] = BS_ONES;
b[7] = BS_ZERO;
t[ 0] = BS_ZERO; t[ 1] = BS_ONES; t[ 2] = BS_ZERO; t[ 3] = BS_ZERO;
t[ 4] = BS_ONES; t[ 5] = BS_ZERO; t[ 6] = BS_ZERO; t[ 7] = BS_ZERO;
t[ 8] = BS_ZERO; t[ 9] = BS_ZERO; t[10] = BS_ZERO; t[11] = BS_ZERO;
t[12] = BS_ZERO; t[13] = BS_ONES; t[14] = BS_ONES; t[15] = BS_ONES;
t[ 0] = BS_ZERO;
t[ 1] = BS_ONES;
t[ 2] = BS_ZERO;
t[ 3] = BS_ZERO;
t[ 4] = BS_ONES;
t[ 5] = BS_ZERO;
t[ 6] = BS_ZERO;
t[ 7] = BS_ZERO;
t[ 8] = BS_ZERO;
t[ 9] = BS_ZERO;
t[10] = BS_ZERO;
t[11] = BS_ZERO;
t[12] = BS_ZERO;
t[13] = BS_ONES;
t[14] = BS_ONES;
t[15] = BS_ONES;
}
void prepare_ccnr_bits_bs128(const uint8_t *cc_nr, uint64_t y_bits_bs[96 * BS128_WORDS]) {
@@ -156,7 +174,7 @@ void prepare_ccnr_bits_bs128(const uint8_t *cc_nr, uint64_t y_bits_bs[96 * BS128
void prepare_target_mac_bs128(const uint8_t target_mac[4], uint64_t target_mac_bs[32 * BS128_WORDS]) {
for (int i = 0; i < 4; i++) {
const uint8_t byte = target_mac[i];
for (int bit = 0; bit < 8; bit++) {
vst1q_u64(&target_mac_bs[(i * 8 + bit) * BS128_WORDS], ((byte >> bit) & 1) ? BS_ONES : BS_ZERO);
@@ -219,7 +237,7 @@ void doMAC_brute_match128(const uint64_t y_bits_bs[96 * BS128_WORDS],
mac_match = vbicq_u64(mac_match, diff);
if ((tick == 7 || tick == 15 || tick == 23) && bs128_all_zero(mac_match)) {
match_out[0] = 0;
match_out[0] = 0;
match_out[1] = 0;
return;
}
@@ -239,24 +257,24 @@ bool bs_neon_supported(void) { return true; }
bool bs_neon_supported(void) { return false; }
void prepare_ccnr_bits_bs128(const uint8_t *cc_nr, uint64_t y_bits_bs[96 * BS128_WORDS]) {
(void)cc_nr;
(void)cc_nr;
(void)y_bits_bs;
}
void prepare_target_mac_bs128(const uint8_t target_mac[4], uint64_t target_mac_bs[32 * BS128_WORDS]) {
(void)target_mac;
(void)target_mac;
(void)target_mac_bs;
}
void build_bitslice_key_128(const uint8_t partial_key[8], uint64_t index_start, uint64_t kb[64 * BS128_WORDS]) {
(void)partial_key;
(void)index_start;
(void)partial_key;
(void)index_start;
(void)kb;
}
void doMAC_brute_match128(const uint64_t y_bits_bs[96 * BS128_WORDS],
const uint64_t kb[64 * BS128_WORDS],
const uint64_t target_mac_bs[32 * BS128_WORDS],
uint64_t match_out[BS128_WORDS]) {
(void)y_bits_bs;
(void)kb;
(void)y_bits_bs;
(void)kb;
(void)target_mac_bs;
for (int i = 0; i < BS128_WORDS; i++) {
match_out[i] = 0;
+4 -4
View File
@@ -300,10 +300,10 @@ void print_gallagher_creds(GallagherCredentials_t *creds) {
return;
}
PrintAndLogEx(SUCCESS, "Gallagher - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
'A' + creds->region_code,
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
'A' + creds->region_code,
creds->region_code,
creds->facility_code,
creds->card_number,
+1 -1
View File
@@ -533,7 +533,7 @@ int mfpReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *data
DropField();
return 6;
}
// Encrypted mode is always used. Doing an if to check will waste instructions
mfp_data_crypt(&_session, &data[1], &data[1], true);
+3 -3
View File
@@ -2756,9 +2756,9 @@ static int _wrap_new_pm3(lua_State *L) {
}
SWIG_Lua_pusherrstring(L, "Wrong arguments for overloaded function 'new_pm3'\n"
" Possible C/C++ prototypes are:\n"
" pm3::pm3()\n"
" pm3::pm3(char *)\n");
" Possible C/C++ prototypes are:\n"
" pm3::pm3()\n"
" pm3::pm3(char *)\n");
lua_error(L);
return 0;
}
+1 -1
View File
@@ -854,7 +854,7 @@ static int dumpmem_pm3(char *serial_port_name, const char *filename, uint32_t ad
PrintAndLogEx(INFO, "Device is running the bootloader.");
} else {
PrintAndLogEx(ERR, "Device is running the bootloader, but the bootloader"
" doesn't understand the READ MEM command.");
" doesn't understand the READ MEM command.");
goto finish2;
}
}
+2 -2
View File
@@ -63,8 +63,8 @@ typedef struct {
uint64_t current_key; // Use 64 bit and truncate when needed.
uint8_t mode;
uint8_t charset[
BF_CHARSET_DIGITS_SIZE
+ BF_CHARSET_UPPERCASE_SIZE
BF_CHARSET_DIGITS_SIZE
+ BF_CHARSET_UPPERCASE_SIZE
];
uint8_t charset_length;
+12 -12
View File
@@ -73,14 +73,14 @@
static const int Iso15693FrameSOF[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, -1, -1, -1,
-1, -1, -1, -1,
1, 1, 1, 1,
1, 1, 1, 1
};
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, -1, -1, -1,
-1, -1, -1, -1,
1, 1, 1, 1,
1, 1, 1, 1
};
static const int Iso15693Logic0[] = {
1, 1, 1, 1,
1, 1, 1, 1,
@@ -89,10 +89,10 @@ static const int Iso15693Logic0[] = {
};
static const int Iso15693Logic1[] = {
-1, -1, -1, -1,
-1, -1, -1, -1,
1, 1, 1, 1,
1, 1, 1, 1
};
-1, -1, -1, -1,
1, 1, 1, 1,
1, 1, 1, 1
};
// EOF defined as
// 1) logic '0' (8 pulses of 423.75kHz followed by unmodulated for 18.88us)
+13 -13
View File
@@ -254,7 +254,7 @@ void mbedtls_aesni_inverse_key(unsigned char *invkey,
for (fk -= 16, ik += 16; fk > fwdkey; fk -= 16, ik += 16)
asm("movdqu (%0), %%xmm0 \n\t"
AESIMC xmm0_xmm0 "\n\t"
"movdqu %%xmm0, (%1) \n\t"
"movdqu %%xmm0, (%1) \n\t"
:
: "r"(fk), "r"(ik)
: "memory", "xmm0");
@@ -403,23 +403,23 @@ static void aesni_setkey_enc_256(unsigned char *rk,
/* Set xmm2 to stuff:Y:stuff:stuff with Y = subword( r11 )
* and proceed to generate next round key from there */
AESKEYGENA xmm0_xmm2 ",0x00 \n\t"
"pshufd $0xaa, %%xmm2, %%xmm2 \n\t"
"pxor %%xmm1, %%xmm2 \n\t"
"pslldq $4, %%xmm1 \n\t"
"pxor %%xmm1, %%xmm2 \n\t"
"pslldq $4, %%xmm1 \n\t"
"pxor %%xmm1, %%xmm2 \n\t"
"pslldq $4, %%xmm1 \n\t"
"pxor %%xmm2, %%xmm1 \n\t"
"add $16, %0 \n\t"
"movdqu %%xmm1, (%0) \n\t"
"ret \n\t"
"pshufd $0xaa, %%xmm2, %%xmm2 \n\t"
"pxor %%xmm1, %%xmm2 \n\t"
"pslldq $4, %%xmm1 \n\t"
"pxor %%xmm1, %%xmm2 \n\t"
"pslldq $4, %%xmm1 \n\t"
"pxor %%xmm1, %%xmm2 \n\t"
"pslldq $4, %%xmm1 \n\t"
"pxor %%xmm2, %%xmm1 \n\t"
"add $16, %0 \n\t"
"movdqu %%xmm1, (%0) \n\t"
"ret \n\t"
/*
* Main "loop" - Generating one more key than necessary,
* see definition of mbedtls_aes_context.buf
*/
"2: \n\t"
"2: \n\t"
AESKEYGENA xmm1_xmm2 ",0x01 \n\tcall 1b \n\t"
AESKEYGENA xmm1_xmm2 ",0x02 \n\tcall 1b \n\t"
AESKEYGENA xmm1_xmm2 ",0x04 \n\tcall 1b \n\t"
+8 -8
View File
@@ -215,16 +215,16 @@ static const signed char indexes[2][4][20] = {
}, /* KL -> RK */
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
}, /* KR -> RK */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
}, /* KR -> RK */
{
4, 5, 6, 7, 12, 13, 14, 15, 16, 17,
18, 19, -1, 24, 25, -1, 31, 28, 29, 30
}, /* KA -> RK */
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
} /* KB -> RK */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
} /* KB -> RK */
},
{
{
@@ -233,12 +233,12 @@ static const signed char indexes[2][4][20] = {
}, /* KL -> RK */
{
-1, -1, -1, -1, 8, 9, 10, 11, 16, 17,
18, 19, -1, -1, -1, -1, 39, 36, 37, 38
}, /* KR -> RK */
18, 19, -1, -1, -1, -1, 39, 36, 37, 38
}, /* KR -> RK */
{
-1, -1, -1, -1, 12, 13, 14, 15, 58, 59,
56, 57, 31, 28, 29, 30, -1, -1, -1, -1
}, /* KA -> RK */
56, 57, 31, 28, 29, 30, -1, -1, -1, -1
}, /* KA -> RK */
{
4, 5, 6, 7, 65, 66, 67, 64, 20, 21,
22, 23, -1, -1, -1, -1, 43, 40, 41, 42
+1 -1
View File
@@ -119,7 +119,7 @@ void mbedtls_ctr_drbg_set_reseed_interval(mbedtls_ctr_drbg_context *ctx,
static int block_cipher_df(unsigned char *output,
const unsigned char *data, size_t data_len) {
unsigned char buf[MBEDTLS_CTR_DRBG_MAX_SEED_INPUT +
MBEDTLS_CTR_DRBG_BLOCKSIZE + 16];
MBEDTLS_CTR_DRBG_BLOCKSIZE + 16];
unsigned char tmp[MBEDTLS_CTR_DRBG_SEEDLEN];
unsigned char key[MBEDTLS_CTR_DRBG_KEYSIZE];
unsigned char chain[MBEDTLS_CTR_DRBG_BLOCKSIZE];
+8 -8
View File
@@ -86,7 +86,7 @@ static void debug_header(memory_header *hdr) {
#endif
mbedtls_fprintf(stderr, "HDR: PTR(%10zu), PREV(%10zu), NEXT(%10zu), "
"ALLOC(%zu), SIZE(%10zu)\n",
"ALLOC(%zu), SIZE(%10zu)\n",
(size_t) hdr, (size_t) hdr->prev, (size_t) hdr->next,
hdr->alloc, hdr->size);
mbedtls_fprintf(stderr, " FPREV(%10zu), FNEXT(%10zu)\n",
@@ -164,7 +164,7 @@ static int verify_chain(void) {
if (prv == NULL || verify_header(prv) != 0) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: verification of first header "
"failed\n");
"failed\n");
#endif
return (1);
}
@@ -172,7 +172,7 @@ static int verify_chain(void) {
if (heap.first->prev != NULL) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: verification failed: "
"first->prev != NULL\n");
"first->prev != NULL\n");
#endif
return (1);
}
@@ -183,7 +183,7 @@ static int verify_chain(void) {
if (verify_header(cur) != 0) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: verification of header "
"failed\n");
"failed\n");
#endif
return (1);
}
@@ -191,7 +191,7 @@ static int verify_chain(void) {
if (cur->prev != prv) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: verification failed: "
"cur->prev != prv\n");
"cur->prev != prv\n");
#endif
return (1);
}
@@ -243,7 +243,7 @@ static void *buffer_alloc_calloc(size_t n, size_t size) {
if (cur->alloc != 0) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: block in free_list but allocated "
"data\n");
"data\n");
#endif
mbedtls_exit(1);
}
@@ -359,7 +359,7 @@ static void buffer_alloc_free(void *ptr) {
if (p < heap.buf || p >= heap.buf + heap.len) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: mbedtls_free() outside of managed "
"space\n");
"space\n");
#endif
mbedtls_exit(1);
}
@@ -373,7 +373,7 @@ static void buffer_alloc_free(void *ptr) {
if (hdr->alloc != 1) {
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf(stderr, "FATAL: mbedtls_free() on unallocated "
"data\n");
"data\n");
#endif
mbedtls_exit(1);
}
+2 -2
View File
@@ -445,14 +445,14 @@ union mbedtls_ssl_premaster_secret {
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
+1 -1
View File
@@ -804,7 +804,7 @@ static int ssl_write_use_srtp_ext(mbedtls_ssl_context *ssl,
*/
MBEDTLS_SSL_DEBUG_MSG(3,
("client hello, "
"illegal DTLS-SRTP protection profile %d",
"illegal DTLS-SRTP protection profile %d",
ssl->conf->dtls_srtp_profile_list[protection_profiles_index]
));
return (MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED);
+1 -1
View File
@@ -3954,7 +3954,7 @@ static int ssl_buffer_message(mbedtls_ssl_context *ssl) {
/* Silently ignore -- message too far in the future */
MBEDTLS_SSL_DEBUG_MSG(2,
("Ignore future HS message with sequence number %u, "
"buffering window %u - %u",
"buffering window %u - %u",
recv_msg_seq, ssl->handshake->in_msg_seq,
ssl->handshake->in_msg_seq + MBEDTLS_SSL_MAX_BUFFERED_HS - 1));
+1 -1
View File
@@ -2101,7 +2101,7 @@ int mbedtls_x509_crt_verify_info(char *buf, size_t size, const char *prefix,
if (flags != 0) {
ret = mbedtls_snprintf(p, n, "%sUnknown reason "
"(this should not happen)\n", prefix);
"(this should not happen)\n", prefix);
MBEDTLS_X509_SAFE_SNPRINTF;
}
+167 -38
View File
@@ -1455,7 +1455,7 @@
"-u, --uid <hex> <4|7|10> hex bytes UID",
"-r, --ats <hex> <0-20> hex bytes ATS",
"-a, --aid <hex> <0-30> hex bytes for AID to respond to (Default: A000000000000000000000)",
"-e, --selectaid_response <hex> <0-100> hex bytes for APDU Response to AID Select (Default: 9000)",
"-e, --selectaid_response <hex> <0-256> hex bytes for APDU Response to AID Select (Default: 9000)",
"-p, --getdata_response <hex> <0-100> hex bytes for APDU Response to Get Data request after AID (Default: 9000)",
"-x, --enumerate Enumerate all AID values via returning Not Found and print them to console"
],
@@ -2287,6 +2287,62 @@
],
"usage": "hf aliro read [-ha] [-k <hex>] -g <hex> [-s <hex>] -p <pem|der-b64|der-hex|scalar-b64|scalar-hex|path> [-t <hex>] [-e <hex>] [-f <step-up|standard|fast>] [--step-up-scopes <scope1,scope2>]"
},
"hf calypso dump": {
"command": "hf calypso dump",
"description": "Dump readable files and records from Calypso DFs",
"notes": [
"hf calypso dump",
"hf calypso dump --aid 315449432E494341",
"hf calypso dump -f my-calypso-dump",
"hf calypso dump --ns -v"
],
"offline": false,
"options": [
"-h, --help This help",
"--aid <hex> Calypso application AID or AID prefix (5..16 bytes)",
"-f, --file <fn> Specify a filename for JSON dump file",
"--ns no save to file",
"-v, --verbose verbose output"
],
"usage": "hf calypso dump [-hv] [--aid <hex>] [-f <fn>] [--ns]"
},
"hf calypso help": {
"command": "hf calypso help",
"description": "help This help list List Calypso history --------------------------------------------------------------------------------------- hf calypso info available offline: no Tag information for Calypso cards",
"notes": [
"hf calypso info",
"hf calypso info -v",
"hf calypso info --aid 315449432E494341"
],
"offline": true,
"options": [
"-h, --help This help",
"--aid <hex> Calypso application AID or AID prefix (5..16 bytes)",
"-v, --verbose verbose output"
],
"usage": "hf calypso info [-hv] [--aid <hex>]"
},
"hf calypso list": {
"command": "hf calypso list",
"description": "Alias of `trace list -t calypso` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
"notes": [
"hf calypso list --frame -> show frame delay times",
"hf calypso list -1 -> use trace buffer"
],
"offline": true,
"options": [
"-h, --help This help",
"-1, --buffer use data from trace buffer",
"--frame show frame delay times",
"-c mark CRC bytes",
"-r show relative times (gap and duration)",
"-u display times in microseconds instead of clock cycles",
"-x show hexdump to convert to pcap(ng)",
"or to import into Wireshark using encapsulation type \"ISO 14443\"",
"-f, --file <fn> filename of dictionary"
],
"usage": "hf calypso list [-h1crux] [--frame] [-f <fn>]"
},
"hf cipurse aread": {
"command": "hf cipurse aread",
"description": "Read file attributes by file ID with key ID and key. If no key is supplied, default key of 737373...7373 will be used",
@@ -3465,7 +3521,7 @@
},
"hf help": {
"command": "hf help",
"description": "-------- ----------------------- High Frequency ----------------------- 14a { ISO14443A RFIDs... } 14b { ISO14443B RFIDs... } 15 { ISO15693 RFIDs... } aliro { ALIRO digital access credentials... } cipurse { Cipurse transport Cards... } epa { German Identification Card... } emrtd { Machine Readable Travel Document... } felica { ISO18092 / FeliCa RFIDs... } fido { FIDO and FIDO2 authenticators... } fudan { Fudan RFIDs... } gallagher { Gallagher DESFire RFIDs... } gst { Google Smart Tap passes... } secc { iClass SE Config Card Emulator... } iclass { ICLASS RFIDs... } ict { ICT MFC/DESfire RFIDs... } jooki { Jooki RFIDs... } ksx6924 { KS X 6924 (T-Money, Snapper+) RFIDs } legic { LEGIC RFIDs... } lto { LTO Cartridge Memory RFIDs... } mf { MIFARE RFIDs... } mfp { MIFARE Plus RFIDs... } mfu { MIFARE Ultralight RFIDs... } mfdes { MIFARE Desfire RFIDs... } ntag424 { NXP NTAG 4242 DNA RFIDs... } saflok { Saflok MFC RFIDs... } seos { SEOS RFIDs... } st25ta { ST25TA RFIDs... } tesla { TESLA Cards... } texkom { Texkom RFIDs... } thinfilm { Thinfilm RFIDs... } topaz { TOPAZ (NFC Type 1) RFIDs... } vas { Apple Value Added Service... } waveshare { Waveshare NFC ePaper... } xerox { Fuji/Xerox cartridge RFIDs... } ----------- --------------------- General --------------------- help This help list List protocol data in trace buffer search Search for known HF tags --------------------------------------------------------------------------------------- hf list available offline: yes Alias of `trace list -t raw` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
"description": "-------- ----------------------- High Frequency ----------------------- 14a { ISO14443A RFIDs... } 14b { ISO14443B RFIDs... } 15 { ISO15693 RFIDs... } aliro { ALIRO digital access credentials... } calypso { Calypso transport cards... } cipurse { Cipurse transport Cards... } epa { German Identification Card... } emrtd { Machine Readable Travel Document... } felica { ISO18092 / FeliCa RFIDs... } fido { FIDO and FIDO2 authenticators... } fudan { Fudan RFIDs... } gallagher { Gallagher DESFire RFIDs... } gst { Google Smart Tap passes... } secc { iClass SE Config Card Emulator... } iclass { ICLASS RFIDs... } ict { ICT MFC/DESfire RFIDs... } jooki { Jooki RFIDs... } ksx6924 { KS X 6924 (T-Money, Snapper+) RFIDs } legic { LEGIC RFIDs... } lto { LTO Cartridge Memory RFIDs... } mf { MIFARE RFIDs... } mfp { MIFARE Plus RFIDs... } mfu { MIFARE Ultralight RFIDs... } mfdes { MIFARE Desfire RFIDs... } ntag424 { NXP NTAG 4242 DNA RFIDs... } saflok { Saflok MFC RFIDs... } seos { SEOS RFIDs... } st25ta { ST25TA RFIDs... } tesla { TESLA Cards... } texkom { Texkom RFIDs... } thinfilm { Thinfilm RFIDs... } topaz { TOPAZ (NFC Type 1) RFIDs... } vas { Apple Value Added Service... } waveshare { Waveshare NFC ePaper... } xerox { Fuji/Xerox cartridge RFIDs... } ----------- --------------------- General --------------------- help This help list List protocol data in trace buffer search Search for known HF tags --------------------------------------------------------------------------------------- hf list available offline: yes Alias of `trace list -t raw` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
"notes": [
"hf list --frame -> show frame delay times",
"hf list -1 -> use trace buffer"
@@ -3979,29 +4035,16 @@
},
"hf iclass sam": {
"command": "hf iclass sam",
"description": "Extract PACS via a HID SAM",
"description": "hf iclass sam - HID SAM operations Secure-channel subcommands: Legacy PACS-extraction flags (no subcommand, applied to hf iclass sam directly): --info get SAM version + serial number (also warms up the SAM) -d, --data <hex> DER-encoded SAMCommand to send (raw, no SC) -s, --snmp --data is in SNMP format without the A0/94 headers -p, --prevent fake the e-purse update during PACS extraction --break stop tag interaction at nr-mac (for SIO extract) -f, --file <fn> emulate from a dump file instead of a real card -n, --nodetect skip card detect + SetDetectedCardInfo -k, --keep keep the field active after the command -t, --tlv decode the response as TLV --shallow shallow modulation -v, --verbose verbose output Examples: hf iclass sam extract PACS via SAM (defaults) hf iclass sam --info get SAM version + serial (warmup ping) hf iclass sam scopen open Artemis secure channel hf iclass sam scsend --payload 8200 send wrapped SAMCommand hf iclass sam scclose terminate the SC session ======================================================================================= hf ict { ICT MFC/DESfire RFIDs... } --------------------------------------------------------------------------------------- hf ict help available offline: yes help This help list List ICT history reader Act like an IS14443-a reader --------------------------------------------------------------------------------------- hf ict credential available offline: no Read ICT sector from tag and decode",
"notes": [
"hf iclass sam",
"hf iclass sam -p -d a005a103800104 -> get PACS data, prevent epurse update",
"hf iclass sam --break -> get Nr-MAC for extracting encrypted SIO",
"hf iclass sam -f hf-iclass-dump.bin -> emulate card from dump file to SAM"
"hf ict credential"
],
"offline": false,
"options": [
"-h, --help This help",
"-v, --verbose verbose output",
"-k, --keep keep the field active after command executed",
"-n, --nodetect skip selecting the card and sending card details to SAM",
"-t, --tlv decode TLV",
"--break stop tag interaction on nr-mac",
"-p, --prevent fake epurse update",
"--shallow shallow mod",
"-d, --data <hex> DER encoded command to send to SAM",
"-s, --snmp data is in snmp format without headers",
"--info get SAM infos (version, serial number)",
"-f, --file <fn> dump file to emulate to SAM instead of a real card"
"-v, --verbose verbose output"
],
"usage": "hf iclass sam [-hvkntps] [--break] [--shallow] [-d <hex>]... [--info] [-f <fn>]"
"usage": "hf ict credential [-hv]"
},
"hf iclass sim": {
"command": "hf iclass sim",
@@ -4157,19 +4200,6 @@
],
"usage": "hf iclass wrbl [-hv@] [-k <hex>] [--ki <dec>] --blk <dec> -d <hex> [-m <hex>] [--credit] [--elite] [--raw] [--nr] [--shallow]"
},
"hf ict help": {
"command": "hf ict help",
"description": "help This help list List ICT history reader Act like an IS14443-a reader --------------------------------------------------------------------------------------- hf ict credential available offline: no Read ICT sector from tag and decode",
"notes": [
"hf ict credential"
],
"offline": true,
"options": [
"-h, --help This help",
"-v, --verbose verbose output"
],
"usage": "hf ict credential [-hv]"
},
"hf ict info": {
"command": "hf ict info",
"description": "Get info from ICT encoded credential tags (MIFARE Classic / DESfire)",
@@ -6932,7 +6962,7 @@
},
"hf mfdes help": {
"command": "hf mfdes help",
"description": "help This help list List DESFire (ISO 14443A) history test Regression crypto tests --------------------------------------------------------------------------------------- hf mfdes list available offline: yes Alias of `trace list -t des -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
"description": "help This help list List DESFire (ISO 14443A) history makemfclicense Generate a Mifare Classic license for DESFire EV3C test Regression crypto tests --------------------------------------------------------------------------------------- hf mfdes list available offline: yes Alias of `trace list -t des -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
"notes": [
"hf mfdes list --frame -> show frame delay times",
"hf mfdes list -1 -> use trace buffer"
@@ -6969,6 +6999,7 @@
"notes": [
"hf mfdes intauth -> authenticate with default AID (000000), random challenge",
"hf mfdes intauth --aid D61CF5 -> explicit AID",
"hf mfdes intauth --isoid DF01 -> select by ISO DF FID",
"hf mfdes intauth --dfname D2760000850100 -> select by DF name",
"hf mfdes intauth -d 00112233445566778899AABBCCDDEEFF -> explicit 16-byte challenge",
"hf mfdes intauth -p 04AABB... -> verify signature with given EC public key (hex, PEM, DER, file path)",
@@ -6983,9 +7014,10 @@
"-p, --pubkey <hex|pem|der|path> EC public key for signature verification",
"--aid <hex> Application ID (3 bytes, default 000000)",
"-n, --keynum <dec> Key number (P2, default 0)",
"--dfname <hex> Application ISO DF Name (1-16 hex bytes)"
"--dfname <hex> Application ISO DF Name (1-16 hex bytes)",
"--isoid <hex> Application ISO ID / ISO DF FID (2 bytes)"
],
"usage": "hf mfdes intauth [-hav] [-d <hex>] [-p <hex|pem|der|path>] [--aid <hex>] [-n <dec>] [--dfname <hex>]"
"usage": "hf mfdes intauth [-hav] [-d <hex>] [-p <hex|pem|der|path>] [--aid <hex>] [-n <dec>] [--dfname <hex>] [--isoid <hex>]"
},
"hf mfdes lsapp": {
"command": "hf mfdes lsapp",
@@ -7072,6 +7104,31 @@
],
"usage": "hf mfdes mad [-hav] [-n <dec>] [-t <DES|2TDEA|3TDEA|AES>] [-k <hex>] [--kdf <none|AN10922|gallagher>] [-i <hex>] [-m <plain|mac|encrypt>] [-c <native|niso|iso>] [--schann <d40|ev1|ev2|lrp>] [--aid <hex>] [--auth]"
},
"hf mfdes makemfclicense": {
"command": "hf mfdes makemfclicense",
"description": "Create a Mifare Classic license for DESFire EV3C, as well as a license MAC. The MFC license MAC key must have the same value as PICC level key 50. The permissions are a bitwise-or combination of: 0x01: allow mapping block 0x02: allow updating key B (only for trailers) 0x04: allow updating ACs (only for trailers) 0x08: allow updating key A (only for trailers) 0x10: allow the DESFire RestrictMFCUpdate command",
"notes": [
"hf mfdes makemfclicense -b 4,5,6,8,9,10 --mfc-keys FFFFFFFFFFFF111111111111222222222222",
"-> Create a license for blocks 4, 5, 6, 8, 9, 10 where sector 1 has key A = FFFFFFFFFFFF and key B readable,",
"-> and sector 2 has key A = 111111111111, key B = 222222222222 with key B non readable"
],
"offline": true,
"options": [
"-h, --help This help",
"-v, --verbose Show more output",
"-k, --key <hex> Key for computing the MAC, must be HEX 16(AES)",
"-b, --blk <num>[,<num>[,...]] The MFC blocks to map, must be given in ascending order (use the special value 'all' for all blocks)",
"--key-a Allow updating key A from inside sector trailers mapped to DESFire files",
"--key-b Allow updating key B from inside sector trailers mapped to DESFire files",
"--restrict Allow the restriction of data updates by the MFC side",
"--map Allow mapping the blocks to DESFire files",
"--access-conditions Allow updating the access conditions from inside sector trailers mapped to DESFire files",
"-r, --raw <hex> Raw license in case not all blocks should have the same permissions, of the form num_blocks||block1nr||block1perm||block2nr||block2perm||...",
"--mfc-keys <hex> The concatenated MFC sector keys, one (if key B is readable) or two per sector",
"-s, --save Save the license and license MAC for the next commands in this session"
],
"usage": "hf mfdes makemfclicense [-hvs] [-k <hex>] [-b <num>[,<num>[,...]]] [--key-a] [--key-b] [--restrict] [--map] [--access-conditions] [-r <hex>] [--mfc-keys <hex>]"
},
"hf mfdes pc": {
"command": "hf mfdes pc",
"description": "Perform DESFire proximity check flow (Prepare_PC -> Proximity_Check -> Verify_PC). This command uses plain communication with a dedicated 16-byte AES proximity key.",
@@ -7272,6 +7329,76 @@
],
"usage": "hf mfdes value [-hav] [-n <dec>] [-t <DES|2TDEA|3TDEA|AES>] [-k <hex>] [--kdf <none|AN10922|gallagher>] [-i <hex>] [-m <plain|mac|encrypt>] [-c <native|niso|iso>] [--schann <d40|ev1|ev2|lrp>] [--aid <hex>] [--isoid <hex>] [--fid <hex>] [-o <get/credit/limcredit/debit/clear>] [-d <hex>] [--no-auth]"
},
"hf mfdes vdesign": {
"command": "hf mfdes vdesign",
"description": "Perform VDE_ECDSASign on MIFARE DUOX EV charging application. Card signs a 32-byte challenge with the EV charging key (KeyNo 0x00). Optionally verifies the returned ECDSA signature with a BrainpoolP256r1 public key.",
"notes": [
"hf mfdes vdesign -> sign random 32-byte challenge using default EV DF name",
"hf mfdes vdesign --aid 1010F6 -> select EV app by native AID",
"hf mfdes vdesign --isoid 00DF -> select EV app by ISO DF FID",
"hf mfdes vdesign --dfname A0000008450000000000000000000001 -> select EV app by ISO DF name",
"hf mfdes vdesign -d 00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF -> explicit 32-byte challenge",
"hf mfdes vdesign -p 04A7C6... -> verify signature with given EC public key (hex, PEM, DER, file path)"
],
"offline": false,
"options": [
"-h, --help This help",
"-a, --apdu Show APDU requests and responses",
"-v, --verbose Verbose output",
"-d, --challenge <hex> Challenge to sign (32 bytes, random if omitted)",
"-p, --pubkey <hex|pem|der|path> BrainpoolP256r1 public key for signature verification",
"--aid <hex> Application ID (3 bytes, native DESFire select)",
"--isoid <hex> Application ISO ID / ISO DF FID (2 bytes)",
"--dfname <hex> Application ISO DF Name (1-16 hex bytes, default EV DF name)"
],
"usage": "hf mfdes vdesign [-hav] [-d <hex>] [-p <hex|pem|der|path>] [--aid <hex>] [--isoid <hex>] [--dfname <hex>]"
},
"hf mfdes verifycert": {
"command": "hf mfdes verifycert",
"description": "Read a certificate from DESFire file, validate it against root CA keys, extract device public key, then verify key possession with ISO Internal Authenticate or VDE_ECDSASign.",
"notes": [
"hf mfdes verifycert leaf",
"hf mfdes verifycert vde",
"hf mfdes verifycert orig",
"hf mfdes verifycert picc",
"hf mfdes verifycert --fid 01",
"hf mfdes verifycert leaf --aid D61CF5 --keyidx 0",
"hf mfdes verifycert vde --dfname A0000008450000000000000000000001 --aid F61010",
"hf mfdes verifycert orig --ca nxp-orig-e200",
"hf mfdes verifycert vde --ca skip",
"hf mfdes verifycert --fid 01 --ca ./rootca.pem --ca ./backup_root.der",
"hf mfdes verifycert --fid 01 --ca 04AABB... (public key)",
"hf mfdes verifycert --fid 01 --keyaid 123456 --keyidx 2"
],
"offline": false,
"options": [
"-h, --help This help",
"<profile> Profile: leaf, vde, orig, originality, picc",
"-a, --apdu Show APDU requests and responses",
"-v, --verbose Verbose output",
"-n, --keyno <dec> Key number for DESFire authentication",
"-t, --algo <DES|2TDEA|3TDEA|AES> DESFire auth crypt algo",
"-k, --key <hex> DESFire authentication key",
"--kdf <none|AN10922|gallagher> Key Derivation Function (KDF)",
"-i, --kdfi <hex> KDF input (1-31 hex bytes)",
"-m, --cmode <plain|mac|encrypt> Communication mode",
"-c, --ccset <native|niso|iso> Communication command set",
"--schann <ev2> Secure channel (verifycert supports only ev2 for auth)",
"--aid <hex> Certificate application ID (3 bytes)",
"--isoid <hex> Certificate application ISO DF ID (2 bytes)",
"--dfname <hex> Certificate application DF name (1-16 bytes)",
"--fid <hex> Certificate file ID (1 byte)",
"--no-auth Read certificate file without authentication",
"--ca <name|cert|pubkey|path|skip> CA input, or `skip` to skip certificate signature validation. Repeat --ca for multiple entries",
"--keyaid <hex> Key application ID (default: cert app)",
"--keyisoid <hex> Key application ISO DF ID (2 bytes)",
"--keydfname <hex> Key application DF name (default: cert app)",
"--keyidx <dec> Key index for possession verification (profile default)",
"--validatemethod <auto|intauth|vde|skip> Key possession verification method (default: profile/auto)",
"--readmethod <auto|desfire> Certificate read method (reserved for future methods)"
],
"usage": "hf mfdes verifycert [-hav] [<profile>] [-n <dec>] [-t <DES|2TDEA|3TDEA|AES>] [-k <hex>] [--kdf <none|AN10922|gallagher>] [-i <hex>] [-m <plain|mac|encrypt>] [-c <native|niso|iso>] [--schann <ev2>] [--aid <hex>] [--isoid <hex>] [--dfname <hex>] [--fid <hex>] [--no-auth] [--ca <name|cert|pubkey|path|skip>]... [--keyaid <hex>] [--keyisoid <hex>] [--keydfname <hex>] [--keyidx <dec>] [--validatemethod <auto|intauth|vde|skip>] [--readmethod <auto|desfire>]"
},
"hf mfdes write": {
"command": "hf mfdes write",
"description": "Write data from file. Key needs to be provided or flag --no-auth set (depend on file settings).",
@@ -8687,13 +8814,14 @@
"offline": false,
"options": [
"-h, --help This help",
"-t, --tag <hex> <0-100> hex bytes for tag to read (Default: FF00)",
"-o, --oid <hex> <0-100> hex bytes for OID (Default: 2B0601040181E438010102011801010202)",
"--privacy-key <idx> Privacy key slot index. The selected slot provides both privacy encryption and MAC subkeys and is sent as the privacy slot identifier",
"--auth-key <idx> Auth key slot index. The selected slot provides the auth key and is sent as the auth slot identifier",
"--aid <hex> Use a custom SEOS AID",
"-d, --data <hex> <0-128> hex bytes for data (Must be valid BER-TLV)"
],
"usage": "hf seos write [-h] [-o <hex>] [--privacy-key <idx>] [--auth-key <idx>] [--aid <hex>] [-d <hex>]"
"usage": "hf seos write [-h] [-t <hex>] [-o <hex>] [--privacy-key <idx>] [--auth-key <idx>] [--aid <hex>] [-d <hex>]"
},
"hf sniff": {
"command": "hf sniff",
@@ -14248,6 +14376,7 @@
"trace list -t 14b -> interpret as ISO14443-B",
"trace list -t 15 -> interpret as ISO15693",
"trace list -t 7816 -> interpret as ISO7816-4",
"trace list -t calypso -> interpret as Calypso",
"trace list -t cryptorf -> interpret as CryptoRF",
"trace list -t des -> interpret as MIFARE DESFire",
"trace list -t felica -> interpret as ISO18092 / FeliCa",
@@ -14476,8 +14605,8 @@
}
},
"metadata": {
"commands_extracted": 822,
"commands_extracted": 825,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2026-04-21T04:12:30"
"extracted_on": "2026-05-11T12:35:32"
}
}
+16 -1
View File
@@ -288,6 +288,18 @@ Check column "offline" for their availability.
|`hf aliro read `|N |`Run SELECT-AUTH0-AUTH1 and optional step-up document retrieval`
### hf calypso
{ Calypso transport cards... }
|command |offline |description
|------- |------- |-----------
|`hf calypso help `|Y |`This help`
|`hf calypso info `|N |`Tag information`
|`hf calypso dump `|N |`Dump readable files and records`
|`hf calypso list `|Y |`List Calypso history`
### hf cipurse
{ Cipurse transport Cards... }
@@ -474,7 +486,7 @@ Check column "offline" for their availability.
|`hf iclass decrypt `|Y |`Decrypt given block data or tag dump file`
|`hf iclass managekeys `|Y |`Manage keys to use with iclass commands`
|`hf iclass permutekey `|Y |`Permute function from 'heart of darkness' paper`
|`hf iclass sam `|N |`SAM tests`
|`hf iclass sam `|N |`SAM ops: PACS extract + secure channel (scopen/scsend/scclose)`
### hf ict
@@ -742,7 +754,10 @@ Check column "offline" for their availability.
|`hf mfdes write `|N |`Write data to standard/backup/record/value file`
|`hf mfdes value `|N |`Operations with value file (get/credit/limited credit/debit/clear)`
|`hf mfdes clearrecfile `|N |`Clear record File`
|`hf mfdes makemfclicense`|Y |`Generate a Mifare Classic license for DESFire EV3C`
|`hf mfdes verifycert `|N |`Validate cert from file and verify key possession`
|`hf mfdes intauth `|N |`ISO Internal Authenticate (ECDSA challenge-response)`
|`hf mfdes vdesign `|N |`VDE ECDSASign (EV charging signature over 32-byte challenge)`
|`hf mfdes test `|Y |`Regression crypto tests`
+2 -1
View File
@@ -331,7 +331,8 @@ typedef struct {
typedef struct {
// 64KB SRAM -> 524288 bits(max sample num) < 2^30
uint32_t samples : LF_SAMPLES_BITS;
uint32_t samples :
LF_SAMPLES_BITS;
bool realtime : 1;
bool verbose : 1;
} PACKED lf_sample_payload_t;
+1 -1
View File
@@ -71,7 +71,7 @@ static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs,
offset);
if (filesz != memsz) {
fprintf(stderr, "Error: PHDR file size does not equal memory size\n"
"(DATA+BSS PHDRs do not make sense on ROM platforms!)\n");
"(DATA+BSS PHDRs do not make sense on ROM platforms!)\n");
return -1;
}
if (paddr < last_end) {