mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-01 18:45:10 +08:00
cppcheck fix const
This commit is contained in:
parent
72f2682544
commit
deb48d2311
10 changed files with 34 additions and 29 deletions
|
@ -73,7 +73,7 @@ static void transform_D(uint8_t *ru) {
|
|||
}
|
||||
|
||||
// Transport system (IT) pwd generation algo nickname A.
|
||||
uint32_t ul_ev1_pwdgenA(uint8_t *uid) {
|
||||
uint32_t ul_ev1_pwdgenA(const uint8_t *uid) {
|
||||
|
||||
uint8_t pos = (uid[3] ^ uid[4] ^ uid[5] ^ uid[6]) % 32;
|
||||
|
||||
|
@ -98,7 +98,7 @@ uint32_t ul_ev1_pwdgenA(uint8_t *uid) {
|
|||
}
|
||||
|
||||
// Amiibo pwd generation algo nickname B. (very simple)
|
||||
uint32_t ul_ev1_pwdgenB(uint8_t *uid) {
|
||||
uint32_t ul_ev1_pwdgenB(const uint8_t *uid) {
|
||||
|
||||
uint8_t pwd[] = {0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
|
@ -128,7 +128,7 @@ uint32_t ul_ev1_pwdgenC(uint8_t *uid) {
|
|||
}
|
||||
|
||||
// XYZ 3d printing pwd generation algo nickname D.
|
||||
uint32_t ul_ev1_pwdgenD(uint8_t *uid) {
|
||||
uint32_t ul_ev1_pwdgenD(const uint8_t *uid) {
|
||||
|
||||
uint8_t i;
|
||||
// rotation offset
|
||||
|
@ -153,7 +153,7 @@ uint32_t ul_ev1_pwdgenD(uint8_t *uid) {
|
|||
}
|
||||
|
||||
// pack generation for algo 1-3
|
||||
uint16_t ul_ev1_packgenA(uint8_t *uid) {
|
||||
uint16_t ul_ev1_packgenA(const uint8_t *uid) {
|
||||
uint16_t pack = (uid[0] ^ uid[1] ^ uid[2]) << 8 | (uid[2] ^ 8);
|
||||
return pack;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ uint16_t ul_ev1_packgenB(uint8_t *uid) {
|
|||
uint16_t ul_ev1_packgenC(uint8_t *uid) {
|
||||
return 0xaa55;
|
||||
}
|
||||
uint16_t ul_ev1_packgenD(uint8_t *uid) {
|
||||
uint16_t ul_ev1_packgenD(const uint8_t *uid) {
|
||||
uint8_t i;
|
||||
//Rotate
|
||||
uint8_t r = (uid[2] + uid[5]) & 7; //Rotation offset
|
||||
|
@ -260,7 +260,7 @@ int mfc_algo_saflok_all(uint8_t *uid, uint8_t *keys) {
|
|||
}
|
||||
|
||||
// MIZIP algo
|
||||
int mfc_algo_mizip_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key) {
|
||||
int mfc_algo_mizip_one(const uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key) {
|
||||
if (sector > 4) return PM3_EINVARG;
|
||||
if (key == NULL) return PM3_EINVARG;
|
||||
if (keytype > 2) return PM3_EINVARG;
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
#include "common.h"
|
||||
|
||||
uint32_t ul_ev1_pwdgen_def(uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenA(uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenB(uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenA(const uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenB(const uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenC(uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenD(uint8_t *uid);
|
||||
uint32_t ul_ev1_pwdgenD(const uint8_t *uid);
|
||||
|
||||
uint16_t ul_ev1_packgen_def(uint8_t *uid);
|
||||
uint16_t ul_ev1_packgenA(uint8_t *uid);
|
||||
uint16_t ul_ev1_packgenA(const uint8_t *uid);
|
||||
uint16_t ul_ev1_packgenB(uint8_t *uid);
|
||||
uint16_t ul_ev1_packgenC(uint8_t *uid);
|
||||
uint16_t ul_ev1_packgenD(uint8_t *uid);
|
||||
uint16_t ul_ev1_packgenD(const uint8_t *uid);
|
||||
|
||||
int mfc_algo_ving_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
||||
int mfc_algo_ving_all(uint8_t *uid, uint8_t *keys);
|
||||
|
@ -34,7 +34,7 @@ int mfc_algo_yale_all(uint8_t *uid, uint8_t *keys);
|
|||
int mfc_algo_saflok_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
||||
int mfc_algo_saflok_all(uint8_t *uid, uint8_t *keys);
|
||||
|
||||
int mfc_algo_mizip_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
||||
int mfc_algo_mizip_one(const uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
||||
int mfc_algo_mizip_all(uint8_t *uid, uint8_t *keys);
|
||||
|
||||
int mfc_algo_di_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
||||
|
|
|
@ -511,7 +511,7 @@ static inline void search_gc_candidates_right(const uint64_t rstate_before_gc, c
|
|||
}
|
||||
}
|
||||
|
||||
static inline void sm_left(const uint8_t *ks, uint8_t *mask, vector<cs_t> *pcstates) {
|
||||
static inline void sm_left(const uint8_t *ks, const uint8_t *mask, vector<cs_t> *pcstates) {
|
||||
map<uint64_t, cs_t> bincstates;
|
||||
map<uint64_t, cs_t>::iterator it;
|
||||
uint64_t counter, lstate;
|
||||
|
|
|
@ -481,7 +481,7 @@ static void ice_sm_left_thread(
|
|||
uint8_t skips,
|
||||
const uint8_t *ks,
|
||||
map<uint64_t, cs_t> *bincstates,
|
||||
uint8_t *mask
|
||||
const uint8_t *mask
|
||||
) {
|
||||
|
||||
size_t pos, bits;
|
||||
|
@ -741,7 +741,7 @@ static inline void search_gc_candidates_right(const uint64_t rstate_before_gc, c
|
|||
}
|
||||
}
|
||||
|
||||
static inline void sm_left(const uint8_t *ks, uint8_t *mask, vector<cs_t> *pcstates) {
|
||||
static inline void sm_left(const uint8_t *ks, const uint8_t *mask, vector<cs_t> *pcstates) {
|
||||
map<uint64_t, cs_t> bincstates;
|
||||
map<uint64_t, cs_t>::iterator it;
|
||||
uint64_t counter, lstate;
|
||||
|
|
|
@ -34,7 +34,7 @@ void shexdump(unsigned char *data, int data_len) {
|
|||
|
||||
|
||||
|
||||
void printbin(unsigned char *c) {
|
||||
void printbin(const unsigned char *c) {
|
||||
if (!c) {
|
||||
printf("printbin: invalid params\n");
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
void writebuf(unsigned char *buf, uint64_t val, uint16_t len);
|
||||
void shexdump(unsigned char *data, int data_len);
|
||||
void printbin(unsigned char *c);
|
||||
void printbin(const unsigned char *c);
|
||||
void printbin2(uint64_t val, unsigned int size);
|
||||
void printstate(Hitag_State *hstate);
|
||||
unsigned char hex2bin(unsigned char c);
|
||||
|
|
|
@ -14,8 +14,6 @@ struct rngdata {
|
|||
int len;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int datacmp(const void *p1, const void *p2) {
|
||||
unsigned char *d1 = (unsigned char *)p1;
|
||||
unsigned char *d2 = (unsigned char *)p2;
|
||||
|
@ -116,7 +114,7 @@ static int makecand(unsigned char *c, struct rngdata *r, int bitoffset) {
|
|||
|
||||
|
||||
// test the candidate against the next or previous rng data
|
||||
static int testcand(unsigned char *f, unsigned char *rt, int fwd) {
|
||||
static int testcand(const unsigned char *f, unsigned char *rt, int fwd) {
|
||||
Hitag_State hstate;
|
||||
int i;
|
||||
uint32_t ks1;
|
||||
|
@ -273,10 +271,7 @@ static int findmatch(struct rngdata *r, unsigned char *outmatch, unsigned char *
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void rollbackrng(Hitag_State *hstate, unsigned char *s, int offset) {
|
||||
static void rollbackrng(Hitag_State *hstate, const unsigned char *s, int offset) {
|
||||
int i;
|
||||
|
||||
if (!s) {
|
||||
|
|
|
@ -24,7 +24,8 @@ License: GNU General Public License v3 or any later version (see LICENSE.txt)
|
|||
|
||||
#include "opencl.h"
|
||||
|
||||
bool plat_dev_enabled(unsigned int id, unsigned int *sel, unsigned int cnt, unsigned int cur_type, unsigned int allow_type) {
|
||||
bool plat_dev_enabled(unsigned int id, const unsigned int *sel,
|
||||
unsigned int cnt, unsigned int cur_type, unsigned int allow_type) {
|
||||
// usefulonly with devices
|
||||
if (allow_type != CL_DEVICE_TYPE_ALL) {
|
||||
if (cur_type != allow_type) return false;
|
||||
|
@ -67,7 +68,11 @@ unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_pla
|
|||
return profile;
|
||||
}
|
||||
|
||||
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int dev_cnt, bool verbose, bool show) {
|
||||
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected,
|
||||
cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt,
|
||||
size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx,
|
||||
unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel,
|
||||
unsigned int dev_cnt, bool verbose, bool show) {
|
||||
int err = 0;
|
||||
unsigned int ocl_platform_max = MAX_OPENCL_DEVICES; // 16
|
||||
cl_uint ocl_platform_cnt;
|
||||
|
|
|
@ -121,9 +121,14 @@ typedef struct opencl_ctx {
|
|||
|
||||
} opencl_ctx_t;
|
||||
|
||||
bool plat_dev_enabled(unsigned int id, unsigned int *sel, unsigned int cnt, unsigned int cur_type, unsigned int allow_type);
|
||||
bool plat_dev_enabled(unsigned int id, const unsigned int *sel,
|
||||
unsigned int cnt, unsigned int cur_type, unsigned int allow_type);
|
||||
unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_platform_cnt);
|
||||
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int dev_cnt, bool verbose, bool show);
|
||||
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected,
|
||||
cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt,
|
||||
size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx,
|
||||
unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel,
|
||||
unsigned int dev_cnt, bool verbose, bool show);
|
||||
int runKernel(opencl_ctx_t *ctx, uint32_t cand_base, uint64_t *matches, uint32_t *matches_found, size_t id);
|
||||
|
||||
#endif // OPENCL_H
|
||||
|
|
|
@ -463,7 +463,7 @@ static void *brute_thread(void *arguments) {
|
|||
static void *brute_key_thread(void *arguments) {
|
||||
|
||||
struct thread_key_args *args = (struct thread_key_args *) arguments;
|
||||
uint64_t key = args->part_key;
|
||||
uint64_t key;
|
||||
uint8_t local_enc[args->enc_len];
|
||||
memcpy(local_enc, args->enc, args->enc_len);
|
||||
|
||||
|
|
Loading…
Reference in a new issue