Commit Graph
41 Commits
Author SHA1 Message Date
iceman1001 1a3f64960a OLD/MIX convert to NG: Phase C 2026-08-29 13:50:49 +02:00
iceman1001 bbc8cc25b2 OLD/MIX convert to NG, Phase B 2026-08-29 13:30:07 +02:00
iceman1001 74f2dcc52c fix warning of comparision of narrow type ... in loop 2026-08-22 10:03:49 +02:00
iceman1001 2c6e607110 style 2026-07-15 16:39:15 +02:00
iceman1001 fd6dd10806 fix coverity #910783 2026-07-01 22:40:29 +02:00
iceman1001 7af8674b22 fix saflok test output and add it to test script 2026-06-30 02:22:56 +02:00
iceman1001 cbb572afad style 2026-05-11 14:36:17 +02:00
kormax fa08075ded Add ISO14A_CLEARTRACE param to explicitly clear 14a trace 2026-03-24 23:24:22 +02:00
Philippe Teuwen 28ebaf529f shadowed var/fct 2026-02-06 14:28:58 +01:00
Philippe Teuwen c00e4801b7 make style 2026-02-06 13:43:41 +01:00
Aaron Tulino (Aaronjamt) d7c9094cad More hex conversion cleanup
Found a few more places that can easily be switched to use `sprint_hex_inrow`
2025-12-20 13:49:05 -07:00
Henry Gabryjelski 7fd1179c9a one more api ... even if silly... 2025-11-17 17:13:14 -08:00
Henry Gabryjelski c0bc988e91 saflok - more self-test capabilities 2025-11-17 17:05:55 -08:00
Henry Gabryjelski af7ec87092 fix typo 2025-11-17 15:42:20 -08:00
Henry Gabryjelski 35afc30e2f saflok - remove trailing \n from calls to PrintAndLogEx() 2025-11-17 15:38:30 -08:00
Henry Gabryjelski 4c10238707 saflok - removal of assert() per iceman request 2025-11-17 14:35:30 -08:00
Henry Gabryjelski 559d63cc35 Fix regression in expiration date handling 2025-11-17 14:30:03 -08:00
Henry Gabryjelski b95a9cf8b6 Saflok: Comment the two assert()s for why they are programmer errors that must cause client to exit. 2025-11-17 03:51:47 -08:00
Henry Gabryjelski 4cb20bde5f saflok selftest -- get_/set_bitfield 2025-11-17 03:18:03 -08:00
Henry Gabryjelski c5cec7ba51 Implement significant portions of saflok selftest 2025-11-17 03:02:37 -08:00
Henry Gabryjelski c98bf9ad3a Fix a few bugs
Discovered by github copilot.
Verified actual bugs by a human.
Fixed by a human.
2025-11-17 02:34:28 -08:00
Henry Gabryjelski 87a144c46a Comments, improved function names, use of common get_days_in_month() function. 2025-11-17 02:02:19 -08:00
Henry Gabryjelski 02056c9515 Saflok - creation year is limited to 7 bits 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 3bf51b1fd4 Migrate more fields to type-safe getter / setter routines 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 444e19212e more use of type-safe routines for getting properties. 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 3d0fe23c17 improved messaging for cards w/o variable keys 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 700a109a8e Saflok: remove redundant CLIParserFreE(ctx) 2025-11-17 01:27:32 -08:00
Henry Gabryjelski dcf7c2dd33 side-by-side check of new vs. old decoding
run `hf saflok decode` twice ... and it will run old decoder one time, and new decoder the other time.   Makes it easy to compare side-by-side in this interrim build.
2025-11-17 01:27:32 -08:00
Henry Gabryjelski 11eaa017d4 Saflok: Fix datetime math helpers 2025-11-17 01:27:32 -08:00
Henry Gabryjelski a535bdb0e7 list of needed self-test 2025-11-17 01:27:32 -08:00
Henry Gabryjelski cb4ba660ab framework for saflok selftest 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 319339b4cd UNTESTED: Add lots of helper functions to get data into / out of saflok formats
* Small, testable functions
* `set_` functions return boolean so they can indicate out-of-bounds values and similar failures.
* const-correctness for all helper functions

Note: The new functions are NOT used extensively yet ... they still need testing.   But they should make the code more self-documenting / readable (if somewhat verbose).
2025-11-17 01:27:32 -08:00
Henry Gabryjelski 4ce34c6c1e More type and bufferlen safety, and validation in bit manipulation routines.
Again, these should have zero impact on resulting
instructions.   At the same time, this will enable
static analysis to more accurately validate a buffer
(here `saflock_mfc_data_t`)  points to sufficiently
large allocated memory.

Additional validation for `extract_bits()` and
`insert_bits()` will prevent accidental corruptions
(and assert, if assertions are enabled).

These changes also makes the code easier to follow.
2025-11-17 01:27:32 -08:00
Henry Gabryjelski c60c15e184 self-document expr --> expiration 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 5fc6f5275a More type safety for encrypt/decrypt 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 72cf97c622 prevent buffer overrun ... assert with clear message instead. 2025-11-17 01:27:32 -08:00
Henry Gabryjelski 9579a2f4b9 change functions using UID and Key to use structs
This should have zero effect on an optimized build,
as there are effectively zero changes to the instructions.

Rather, this provides greater clarity as to the size of buffers
being passed to various functions, which improves the
long-term maintainability of code, especially when
maintained by someone other than the original author.
2025-11-17 01:27:32 -08:00
Iceman 334a0b1bc4 Merge pull request #2985 from STIEBELJOSHUA/hf-saflok
fixed typo in modify
2025-09-21 23:03:46 +02:00
Josh Stiebel 1623c61a5a fixed typo in modify 2025-09-21 02:08:21 -04:00
iceman1001 d6aeda7075 style 2025-08-29 14:01:34 +02:00
Josh Stiebel c98319a7e7 cmd saflok added 2025-08-28 04:06:57 -04:00