mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
cppcheck fixes
This commit is contained in:
parent
e550f8ccc8
commit
b3731c6003
8 changed files with 33 additions and 22 deletions
|
@ -124,7 +124,7 @@ typedef union {
|
|||
#endif
|
||||
|
||||
// typedefs and declaration of functions:
|
||||
typedef uint64_t crack_states_bitsliced_t(uint32_t, uint8_t *, statelist_t *, uint32_t *, uint64_t *, uint32_t, uint8_t *, noncelist_t *);
|
||||
typedef uint64_t crack_states_bitsliced_t(uint32_t, uint8_t *, statelist_t *, uint32_t *, uint64_t *, uint32_t, const uint8_t *, noncelist_t *);
|
||||
crack_states_bitsliced_t crack_states_bitsliced_AVX512;
|
||||
crack_states_bitsliced_t crack_states_bitsliced_AVX2;
|
||||
crack_states_bitsliced_t crack_states_bitsliced_AVX;
|
||||
|
@ -133,7 +133,7 @@ crack_states_bitsliced_t crack_states_bitsliced_MMX;
|
|||
crack_states_bitsliced_t crack_states_bitsliced_NOSIMD;
|
||||
crack_states_bitsliced_t crack_states_bitsliced_dispatch;
|
||||
|
||||
typedef void bitslice_test_nonces_t(uint32_t, uint32_t *, uint8_t *);
|
||||
typedef void bitslice_test_nonces_t(uint32_t, const uint32_t *, const uint8_t *);
|
||||
bitslice_test_nonces_t bitslice_test_nonces_AVX512;
|
||||
bitslice_test_nonces_t bitslice_test_nonces_AVX2;
|
||||
bitslice_test_nonces_t bitslice_test_nonces_AVX;
|
||||
|
@ -174,7 +174,7 @@ static bitslice_t bs_ones;
|
|||
static bitslice_t bs_zeroes;
|
||||
|
||||
|
||||
void BITSLICE_TEST_NONCES(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce, uint8_t *bf_test_nonce_par) {
|
||||
void BITSLICE_TEST_NONCES(uint32_t nonces_to_bruteforce, const uint32_t *bf_test_nonce, const uint8_t *bf_test_nonce_par) {
|
||||
|
||||
// initialize 1 and 0 vectors
|
||||
memset(bs_ones.bytes, 0xff, VECTOR_SIZE);
|
||||
|
@ -206,7 +206,9 @@ void BITSLICE_TEST_NONCES(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce
|
|||
}
|
||||
|
||||
|
||||
uint64_t CRACK_STATES_BITSLICED(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
uint64_t CRACK_STATES_BITSLICED(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found,
|
||||
uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce,
|
||||
const uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
|
||||
// Unlike aczid's implementation this doesn't roll back at all when performing bitsliced bruteforce.
|
||||
// We know that the best first byte is already shifted in. Testing with the remaining three bytes of
|
||||
|
@ -593,7 +595,10 @@ SIMDExecInstr GetSIMDInstrAuto(void) {
|
|||
}
|
||||
|
||||
// determine the available instruction set at runtime and call the correct function
|
||||
uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p,
|
||||
uint32_t *keys_found, uint64_t *num_keys_tested,
|
||||
uint32_t nonces_to_bruteforce, const uint8_t *bf_test_nonce_2nd_byte,
|
||||
noncelist_t *nonces) {
|
||||
switch (GetSIMDInstrAuto()) {
|
||||
#if defined(COMPILER_HAS_SIMD_AVX512)
|
||||
case SIMD_AVX512:
|
||||
|
@ -624,7 +629,7 @@ uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_byte
|
|||
return (*crack_states_bitsliced_function_p)(cuid, best_first_bytes, p, keys_found, num_keys_tested, nonces_to_bruteforce, bf_test_nonce_2nd_byte, nonces);
|
||||
}
|
||||
|
||||
void bitslice_test_nonces_dispatch(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce, uint8_t *bf_test_nonce_par) {
|
||||
void bitslice_test_nonces_dispatch(uint32_t nonces_to_bruteforce, const uint32_t *bf_test_nonce, const uint8_t *bf_test_nonce_par) {
|
||||
switch (GetSIMDInstrAuto()) {
|
||||
#if defined(COMPILER_HAS_SIMD_AVX512)
|
||||
case SIMD_AVX512:
|
||||
|
|
|
@ -117,7 +117,7 @@ inline uint8_t trailing_zeros(uint8_t byte) {
|
|||
}
|
||||
|
||||
|
||||
bool verify_key(uint32_t cuid, noncelist_t *nonces, uint8_t *best_first_bytes, uint32_t odd, uint32_t even) {
|
||||
bool verify_key(uint32_t cuid, noncelist_t *nonces, const uint8_t *best_first_bytes, uint32_t odd, uint32_t even) {
|
||||
struct Crypto1State pcs;
|
||||
for (uint16_t test_first_byte = 1; test_first_byte < 256; test_first_byte++) {
|
||||
noncelistentry_t *test_nonce = nonces[best_first_bytes[test_first_byte]].first;
|
||||
|
|
|
@ -57,6 +57,6 @@ void prepare_bf_test_nonces(noncelist_t *nonces, uint8_t best_first_byte);
|
|||
bool brute_force_bs(float *bf_rate, statelist_t *candidates, uint32_t cuid, uint32_t num_acquired_nonces, uint64_t maximum_states, noncelist_t *nonces, uint8_t *best_first_bytes, uint64_t *found_key);
|
||||
float brute_force_benchmark(void);
|
||||
uint8_t trailing_zeros(uint8_t byte);
|
||||
bool verify_key(uint32_t cuid, noncelist_t *nonces, uint8_t *best_first_bytes, uint32_t odd, uint32_t even);
|
||||
bool verify_key(uint32_t cuid, noncelist_t *nonces, const uint8_t *best_first_bytes, uint32_t odd, uint32_t even);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue