mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
cppchecker
This commit is contained in:
parent
4ab382065a
commit
72ff81c80f
2 changed files with 22 additions and 33 deletions
|
@ -186,16 +186,13 @@ static lookup_entry lookup_right[0x8000];
|
|||
static uint8_t left_addition[0x100000];
|
||||
|
||||
static inline void init_lookup_left() {
|
||||
uint8_t b3, b6, temp;
|
||||
int i, index;
|
||||
|
||||
for (i = 0; i < 0x400; i++) {
|
||||
b6 = i & 0x1f;
|
||||
b3 = (i >> 5) & 0x1f;
|
||||
index = (b3 << 15) | b6;
|
||||
for (int i = 0; i < 0x400; i++) {
|
||||
int b6 = i & 0x1f;
|
||||
int b3 = (i >> 5) & 0x1f;
|
||||
int index = (b3 << 15) | b6;
|
||||
b6 = bit_rotate_l(b6, 5);
|
||||
|
||||
temp = mod(b3 + b6, 0x1f);
|
||||
int temp = mod(b3 + b6, 0x1f);
|
||||
left_addition[index] = temp;
|
||||
lookup_left[index].addition = temp;
|
||||
lookup_left[index].out = ((temp ^ b3) & 0x0f);
|
||||
|
@ -203,15 +200,12 @@ static inline void init_lookup_left() {
|
|||
}
|
||||
|
||||
static inline void init_lookup_right() {
|
||||
uint8_t b16, b18, temp;
|
||||
int i, index;
|
||||
for (int i = 0; i < 0x400; i++) {
|
||||
int b18 = i & 0x1f;
|
||||
int b16 = (i >> 5) & 0x1f;
|
||||
int index = (b16 << 10) | b18;
|
||||
|
||||
for (i = 0; i < 0x400; i++) {
|
||||
b18 = i & 0x1f;
|
||||
b16 = (i >> 5) & 0x1f;
|
||||
index = (b16 << 10) | b18;
|
||||
|
||||
temp = mod(b18 + b16, 0x1f);
|
||||
int temp = mod(b18 + b16, 0x1f);
|
||||
lookup_right[index].addition = temp;
|
||||
lookup_right[index].out = ((temp ^ b16) & 0x0f);
|
||||
}
|
||||
|
@ -422,7 +416,7 @@ static inline void previous_all_input(vector<cs_t> *pcstates, uint32_t gc_byte_i
|
|||
uint8_t btGc, in;
|
||||
vector<cs_t> ncstates;
|
||||
vector<cs_t> prev_ncstates;
|
||||
vector<cs_t>::iterator it, itnew;
|
||||
vector<cs_t>::iterator itnew;
|
||||
|
||||
// Loop through the complete entryphy of 5 bits for each candidate
|
||||
// We ignore zero (xor 0x00) to avoid duplicates
|
||||
|
@ -707,13 +701,11 @@ void combine_valid_left_right_states(vector<cs_t> *plcstates, vector<cs_t> *prcs
|
|||
int main(int argc, const char *argv[]) {
|
||||
size_t pos;
|
||||
crypto_state_t ostate;
|
||||
uint64_t rstate_before_gc, rstate_after_gc;
|
||||
uint64_t lstate_before_gc;
|
||||
vector<uint64_t> rstates, lstates_after_gc, pgc_candidates;
|
||||
uint64_t rstate_before_gc, lstate_before_gc;
|
||||
vector<uint64_t> rstates, pgc_candidates;
|
||||
vector<uint64_t>::iterator itrstates, itgc;
|
||||
vector<cs_t> crstates;
|
||||
vector<cs_t> clcandidates, clstates;
|
||||
vector<cs_t>::iterator it;
|
||||
vector<cs_t> clstates;
|
||||
uint32_t rbits;
|
||||
|
||||
// uint8_t Gc[ 8] = {0x4f,0x79,0x4a,0x46,0x3f,0xf8,0x1d,0x81};
|
||||
|
@ -822,7 +814,7 @@ int main(int argc, const char *argv[]) {
|
|||
}
|
||||
|
||||
for (itrstates = rstates.begin(); itrstates != rstates.end(); ++itrstates) {
|
||||
rstate_after_gc = *itrstates;
|
||||
uint64_t rstate_after_gc = *itrstates;
|
||||
sm_left_mask(ks, mask, rstate_after_gc);
|
||||
printf("Using the state from the top-right bin: " _YELLOW_("0x%07" PRIx64)"\n", rstate_after_gc);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue