mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-14 02:26:59 -07:00
some @iceman1001 s coverty scan fixes
great work!
This commit is contained in:
parent
3975d477e1
commit
c4c3af7c16
7 changed files with 20 additions and 3 deletions
|
@ -58,6 +58,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
|
|||
}
|
||||
// print nonce
|
||||
PrintAndLog("Length: %d, Nonce: %s", nonce_length, nonce);
|
||||
free(nonce);
|
||||
}
|
||||
if (i < n - 1) {
|
||||
sleep(d);
|
||||
|
|
|
@ -406,7 +406,7 @@ int CmdHFiClassDecrypt(const char *Cmd) {
|
|||
fclose(f);
|
||||
|
||||
saveFile(outfilename,"bin", decrypted, blocknum*8);
|
||||
|
||||
free(decrypted);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,7 @@ void printarr(char * name, uint8_t* arr, int len)
|
|||
}
|
||||
cx += snprintf(output+cx,outsize-cx,"};");
|
||||
prnlog(output);
|
||||
free(output);
|
||||
}
|
||||
|
||||
void printvar(char * name, uint8_t* arr, int len)
|
||||
|
@ -188,6 +189,7 @@ void printvar(char * name, uint8_t* arr, int len)
|
|||
}
|
||||
|
||||
prnlog(output);
|
||||
free(output);
|
||||
}
|
||||
|
||||
void printarr_human_readable(char * title, uint8_t* arr, int len)
|
||||
|
|
|
@ -497,3 +497,13 @@ void xor(unsigned char *dst, unsigned char *src, size_t len) {
|
|||
int32_t le24toh (uint8_t data[3]) {
|
||||
return (data[2] << 16) | (data[1] << 8) | data[0];
|
||||
}
|
||||
|
||||
// RotateLeft - Ultralight, Desfire, works on byte level
|
||||
// 00-01-02 >> 01-02-00
|
||||
void rol(uint8_t *data, const size_t len){
|
||||
uint8_t first = data[0];
|
||||
for (size_t i = 0; i < len-1; i++) {
|
||||
data[i] = data[i+1];
|
||||
}
|
||||
data[len-1] = first;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include <time.h>
|
||||
#include "data.h"
|
||||
|
||||
#ifndef ROTR
|
||||
# define ROTR(x,n) (((uintmax_t)(x) >> (n)) | ((uintmax_t)(x) << ((sizeof(x) * 8) - (n))))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
@ -68,3 +71,4 @@ void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length);
|
|||
|
||||
void xor(unsigned char *dst, unsigned char *src, size_t len);
|
||||
int32_t le24toh(uint8_t data[3]);
|
||||
void rol(uint8_t *data, const size_t len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue