cppcheck fixes const
This commit is contained in:
1 parent
0d8971916f
commit
a8ccba77d6
7 files changed
+35
-34
No files matched your search
@@ -169,7 +169,7 @@ static uint8_t _select(bool x, bool y, uint8_t r) {
|
||||
* @param s - state
|
||||
* @param k - array containing 8 bytes
|
||||
**/
|
||||
static State_t successor(uint8_t *k, State_t s, bool y) {
|
||||
static State_t successor(const uint8_t *k, State_t s, bool y) {
|
||||
bool r0 = s.r >> 7 & 0x1;
|
||||
bool r4 = s.r >> 3 & 0x1;
|
||||
bool r7 = s.r & 0x1;
|
||||
@@ -227,7 +227,7 @@ static void output(uint8_t *k, State_t s, BitstreamIn_t *in, BitstreamOut_t *ou
|
||||
* key k ∈ (F 82 ) 8 and outputs the initial cipher state s =< l, r, t, b >
|
||||
**/
|
||||
|
||||
static State_t init(uint8_t *k) {
|
||||
static State_t init(const uint8_t *k) {
|
||||
State_t s = {
|
||||
((k[0] ^ 0x4c) + 0xEC) & 0xFF,// l
|
||||
((k[0] ^ 0x4c) + 0x21) & 0xFF,// r
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
* @param key
|
||||
* @param dest
|
||||
*/
|
||||
void permutekey(uint8_t key[8], uint8_t dest[8]) {
|
||||
void permutekey(const uint8_t key[8], uint8_t dest[8]) {
|
||||
for (uint8_t i = 0 ; i < 8 ; i++) {
|
||||
dest[i] = (((key[7] & (0x80 >> i)) >> (7 - i)) << 7) |
|
||||
(((key[6] & (0x80 >> i)) >> (7 - i)) << 6) |
|
||||
@@ -88,7 +88,7 @@ void permutekey(uint8_t key[8], uint8_t dest[8]) {
|
||||
* @param key
|
||||
* @param dest
|
||||
*/
|
||||
void permutekey_rev(uint8_t key[8], uint8_t dest[8]) {
|
||||
void permutekey_rev(const uint8_t key[8], uint8_t dest[8]) {
|
||||
int i;
|
||||
for (i = 0 ; i < 8 ; i++) {
|
||||
dest[7 - i] = (((key[0] & (0x80 >> i)) >> (7 - i)) << 7) |
|
||||
@@ -138,7 +138,7 @@ static inline uint8_t swap(uint8_t val) {
|
||||
* @param csn the CSN used
|
||||
* @param k output
|
||||
*/
|
||||
void hash1(uint8_t csn[], uint8_t k[]) {
|
||||
void hash1(const uint8_t csn[], uint8_t k[]) {
|
||||
k[0] = csn[0] ^ csn[1] ^ csn[2] ^ csn[3] ^ csn[4] ^ csn[5] ^ csn[6] ^ csn[7];
|
||||
k[1] = csn[0] + csn[1] + csn[2] + csn[3] + csn[4] + csn[5] + csn[6] + csn[7];
|
||||
k[2] = rr(swap(csn[2] + k[1]));
|
||||
|
||||
@@ -54,14 +54,14 @@ typedef struct {
|
||||
} loclass_dumpdata_t;
|
||||
|
||||
|
||||
void permutekey(uint8_t key[8], uint8_t dest[8]);
|
||||
void permutekey(const uint8_t key[8], uint8_t dest[8]);
|
||||
/**
|
||||
* Permutes a key from iclass specific format to NIST format
|
||||
* @brief permutekey_rev
|
||||
* @param key
|
||||
* @param dest
|
||||
*/
|
||||
void permutekey_rev(uint8_t key[8], uint8_t dest[8]);
|
||||
void permutekey_rev(const uint8_t key[8], uint8_t dest[8]);
|
||||
|
||||
/**
|
||||
* Perform a bruteforce against a file which has been saved by pm3
|
||||
@@ -107,7 +107,7 @@ int bruteforceItem(loclass_dumpdata_t item, uint16_t keytable[]);
|
||||
* @param csn the CSN used
|
||||
* @param k output
|
||||
*/
|
||||
void hash1(uint8_t *csn, uint8_t *k);
|
||||
void hash1(const uint8_t *csn, uint8_t *k);
|
||||
void hash2(uint8_t *key64, uint8_t *outp_keytable);
|
||||
/**
|
||||
* From dismantling iclass-paper:
|
||||
|
||||
Reference in new issue
Block a user