From ffbf033937a4a9b40aff54583682a18775017850 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 20 Feb 2025 13:16:19 +0100 Subject: [PATCH] fix #2547 - compilation error on arm-none-eabi-gcc 15.6 for error: dereferencing type-punned pointer will break strict-aliasing rules, by making a u32 we dont get that any longer --- CHANGELOG.md | 2 ++ armsrc/hitagS.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b8f34610..eb37c1199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fix compilation warning in hitagS (@iceman1001) +- Added new wiegand format H800002 (@jmichelp) - Changed `Makefile.platform.sample` file - now have clear instructions for generating images for other proxmark3 hardware (@iceman1001) - Changed `doc/magic_cards_notes.md` - now contains documentation for iKey LLC's MF4 tag (@team-orangeBlue) - Changed `hf mf cload` - now accepts MFC Ev1 sized dumps (@iceman1001) diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index 4b8b62545..932f4bcc1 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -1134,7 +1134,8 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz key_le = *(uint64_t *)packet->key; - uint64_t state = ht2_hitag2_init(REV64(key_le), REV32(tag.data.s.uid_le), REV32(*(uint32_t *)rnd)); + uint32_t le_val = MemLeToUint4byte(rnd); + uint64_t state = ht2_hitag2_init(REV64(key_le), REV32(tag.data.s.uid_le), REV32(le_val)); uint8_t auth_ks[4]; for (int i = 0; i < 4; i++) { @@ -1226,7 +1227,9 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz pwdl1 = 0; if (packet->cmd == HTSF_KEY) { - uint64_t state = ht2_hitag2_init(REV64(key_le), REV32(tag.data.s.uid_le), REV32(*(uint32_t *)rnd)); + uint32_t le_val = MemLeToUint4byte(rnd); + uint64_t state = ht2_hitag2_init(REV64(key_le), REV32(tag.data.s.uid_le), REV32(le_val)); + for (int i = 0; i < 4; i++) { ht2_hitag2_byte(&state); }