mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
make style
This commit is contained in:
parent
588f7e98f5
commit
94192d0976
44 changed files with 674 additions and 656 deletions
|
@ -34,7 +34,7 @@
|
|||
// XYZ 3D printing
|
||||
// Vinglock
|
||||
//------------------------------------
|
||||
void transform_D(uint8_t* ru) {
|
||||
void transform_D(uint8_t *ru) {
|
||||
|
||||
const uint32_t c_D[] = {
|
||||
0x6D835AFC, 0x7D15CD97, 0x0942B409, 0x32F9C923, 0xA811FB02, 0x64F121E8,
|
||||
|
@ -44,32 +44,31 @@ void transform_D(uint8_t* ru) {
|
|||
0x5728B869, 0x30726D5A
|
||||
};
|
||||
|
||||
//Transform
|
||||
uint8_t i;
|
||||
uint8_t p = 0;
|
||||
uint32_t v1 = ((ru[3] << 24) | (ru[2] << 16) | (ru[1] << 8) | ru[0]) + c_D[p++];
|
||||
uint32_t v2 = ((ru[7] << 24) | (ru[6] << 16) | (ru[5] << 8) | ru[4]) + c_D[p++];
|
||||
for (i = 0; i < 12; i += 2)
|
||||
{
|
||||
uint32_t tempA = v1 ^ v2;
|
||||
uint32_t t1 = PM3_ROTL(tempA, v2 & 0x1F) + c_D[p++];
|
||||
uint32_t tempB = v2 ^ t1;
|
||||
uint32_t t2 = PM3_ROTL(tempB, t1 & 0x1F) + c_D[p++];
|
||||
tempA = t1 ^ t2;
|
||||
v1 = PM3_ROTL(tempA, t2 & 0x1F) + c_D[p++];
|
||||
tempB = t2 ^ v1;
|
||||
v2 = PM3_ROTL(tempB, v1 & 0x1F) + c_D[p++];
|
||||
}
|
||||
//Transform
|
||||
uint8_t i;
|
||||
uint8_t p = 0;
|
||||
uint32_t v1 = ((ru[3] << 24) | (ru[2] << 16) | (ru[1] << 8) | ru[0]) + c_D[p++];
|
||||
uint32_t v2 = ((ru[7] << 24) | (ru[6] << 16) | (ru[5] << 8) | ru[4]) + c_D[p++];
|
||||
for (i = 0; i < 12; i += 2) {
|
||||
uint32_t tempA = v1 ^ v2;
|
||||
uint32_t t1 = PM3_ROTL(tempA, v2 & 0x1F) + c_D[p++];
|
||||
uint32_t tempB = v2 ^ t1;
|
||||
uint32_t t2 = PM3_ROTL(tempB, t1 & 0x1F) + c_D[p++];
|
||||
tempA = t1 ^ t2;
|
||||
v1 = PM3_ROTL(tempA, t2 & 0x1F) + c_D[p++];
|
||||
tempB = t2 ^ v1;
|
||||
v2 = PM3_ROTL(tempB, v1 & 0x1F) + c_D[p++];
|
||||
}
|
||||
|
||||
//Re-use ru
|
||||
ru[0] = v1 & 0xFF;
|
||||
ru[1] = (v1 >> 8) & 0xFF;
|
||||
ru[2] = (v1 >> 16) & 0xFF;
|
||||
ru[3] = (v1 >> 24) & 0xFF;
|
||||
ru[4] = v2 & 0xFF;
|
||||
ru[5] = (v2 >> 8) & 0xFF;
|
||||
ru[6] = (v2 >> 16) & 0xFF;
|
||||
ru[7] = (v2 >> 24) & 0xFF;
|
||||
//Re-use ru
|
||||
ru[0] = v1 & 0xFF;
|
||||
ru[1] = (v1 >> 8) & 0xFF;
|
||||
ru[2] = (v1 >> 16) & 0xFF;
|
||||
ru[3] = (v1 >> 24) & 0xFF;
|
||||
ru[4] = v2 & 0xFF;
|
||||
ru[5] = (v2 >> 8) & 0xFF;
|
||||
ru[6] = (v2 >> 16) & 0xFF;
|
||||
ru[7] = (v2 >> 24) & 0xFF;
|
||||
}
|
||||
|
||||
// Transport system (IT) pwd generation algo nickname A.
|
||||
|
@ -136,16 +135,16 @@ uint32_t ul_ev1_pwdgenD(uint8_t *uid) {
|
|||
uint8_t r = (uid[1] + uid[3] + uid[5]) & 7;
|
||||
|
||||
// rotated UID
|
||||
uint8_t ru[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
uint8_t ru[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
for (i = 0; i < 7; i++)
|
||||
ru[(i + r) & 7] = uid[i];
|
||||
|
||||
transform_D(ru);
|
||||
|
||||
// offset
|
||||
// offset
|
||||
r = (ru[0] + ru[2] + ru[4] + ru[6]) & 3;
|
||||
|
||||
// calc key
|
||||
// calc key
|
||||
uint32_t pwd = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
pwd = ru[i + r] + (pwd << 8);
|
||||
|
@ -429,28 +428,28 @@ int generator_selftest() {
|
|||
uint8_t uid1[] = {0x04, 0x11, 0x12, 0x11, 0x12, 0x11, 0x10};
|
||||
uint32_t pwd1 = ul_ev1_pwdgenA(uid1);
|
||||
success = (pwd1 == 0x8432EB17);
|
||||
if (success)
|
||||
if (success)
|
||||
testresult++;
|
||||
PrintAndLogEx(success ? SUCCESS : WARNING, "UID | %s | %08X - %s", sprint_hex(uid1, 7), pwd1, success ? "OK" : "->8432EB17<-");
|
||||
|
||||
uint8_t uid2[] = {0x04, 0x1f, 0x98, 0xea, 0x1e, 0x3e, 0x81};
|
||||
uint32_t pwd2 = ul_ev1_pwdgenB(uid2);
|
||||
success = (pwd2 == 0x5fd37eca);
|
||||
if (success)
|
||||
if (success)
|
||||
testresult++;
|
||||
PrintAndLogEx(success ? SUCCESS : WARNING, "UID | %s | %08X - %s", sprint_hex(uid2, 7), pwd2, success ? "OK" : "->5fd37eca<--");
|
||||
|
||||
uint8_t uid3[] = {0x04, 0x62, 0xB6, 0x8A, 0xB4, 0x42, 0x80};
|
||||
uint32_t pwd3 = ul_ev1_pwdgenC(uid3);
|
||||
success = (pwd3 == 0x5a349515);
|
||||
if (success)
|
||||
if (success)
|
||||
testresult++;
|
||||
PrintAndLogEx(success ? SUCCESS : WARNING, "UID | %s | %08X - %s", sprint_hex(uid3, 7), pwd3, success ? "OK" : "->5a349515<--");
|
||||
|
||||
uint8_t uid4[] = {0x04, 0xC5, 0xDF, 0x4A, 0x6D, 0x51, 0x80};
|
||||
uint32_t pwd4 = ul_ev1_pwdgenD(uid4);
|
||||
success = (pwd4 == 0x72B1EC61);
|
||||
if (success)
|
||||
if (success)
|
||||
testresult++;
|
||||
PrintAndLogEx(success ? SUCCESS : WARNING, "UID | %s | %08X - %s", sprint_hex(uid4, 7), pwd4, success ? "OK" : "->72B1EC61<--");
|
||||
|
||||
|
@ -463,7 +462,7 @@ int generator_selftest() {
|
|||
uint64_t key6 = 0;
|
||||
mfc_algo_sky_one(uid6, 15, 0, &key6);
|
||||
success = (key6 == 0x82c7e64bc565);
|
||||
if (success)
|
||||
if (success)
|
||||
testresult++;
|
||||
PrintAndLogEx(success ? SUCCESS : WARNING, "UID | %s | %"PRIx64" - %s", sprint_hex(uid6, 4), key6, success ? "OK" : "->82C7E64BC565<--");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue