Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lf hitag hts: use correct byteorder for authentication #2580

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

n0emis
Copy link
Contributor

@n0emis n0emis commented Oct 19, 2024

tested with a hitagS transponder.

one could also reverse rnd when initializing the state, but this way it is in the same order as previously

Copy link

You are welcome to add an entry to the CHANGELOG.md as well

@iceman1001
Copy link
Collaborator

Nice,
now @douniwan5788 just need to verify it and we can merge

@douniwan5788
Copy link
Contributor

douniwan5788 commented Oct 20, 2024

It is indeed in the same order as previously, except for rnd. Please reverse the init value of rnd instead to maintain the exact same ks as before.

static uint8_t rnd[] = {0x74, 0x12, 0x44, 0x85}; // random number

Wait, it seems I forgot to swap the key as well...

@douniwan5788
Copy link
Contributor

@n0emis Indeed, you're correct. I overswapped the byte order. In addition to swapping the rnd byte order. What do you think about modifying all calls to ht2_hitag2_init to match this pattern instead?
state = ht2_hitag2_init(REV64(tag.data.s.key_le), REV32(tag.data.s.uid_le), REV32(*(uint32_t *)rx));

@n0emis
Copy link
Contributor Author

n0emis commented Oct 26, 2024

@douniwan5788 done.

works with a normal hitagS tag and in simulation mode (though a further patch is needed for that: #2591)

@douniwan5788
Copy link
Contributor

LGTM

@iceman1001 iceman1001 merged commit 1229d7f into RfidResearchGroup:master Oct 28, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants