mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
cppcheck fix const
This commit is contained in:
parent
72f2682544
commit
deb48d2311
10 changed files with 34 additions and 29 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue