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

Move and Rename Static Mifare Classic Write Block Function #2626

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

pingu2211
Copy link
Contributor

src/mifare/mifarehost.[c/h] implements mfReadBlock and mfReadSector so I was expecting to also find mfWriteBlock and mfWriteSector, but they don't exist. Looking a little further and cmdhfmf.c used a static function static bool mf_write_block for this.
As I want to use it in a hf gallagher extension I'd like it to not be static.

The other similar functions mentioned above return a PM3 status enum rather than bool's, so I also lightly refactored the uses of mfWriteSector to check for PM3_SUCCESS or similar.

I did read

Function names should be separated_with_underscores(), except for standard functions (memcpy, etc.). It may make sense to break this rule for very common, generic functions that look like library functions (e.g. dprintf()).

However the other functions within src/mifare/mifarehost.[c/h] don't follow this convention, and I didn't want this to turn into a major refactor.

Copy link

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

@iceman1001
Copy link
Collaborator

Nice,
The current code style is to use all lower case and underscore. I know that the project is filled will all kinds of code styles, but we change it slowly.

So feel free to rename the functions in mifarehost.c accordingly. We will run a make style later once you finished with all your modifications to sort out white space etc.

@iceman1001 iceman1001 merged commit e676f15 into RfidResearchGroup:master Nov 10, 2024
1 check passed
@iceman1001
Copy link
Collaborator

your sector write function will fail if called with a sector number of a MIFARE Classic 4K card.

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.

2 participants