summer restructuring:
* .h include only the strict minimum for their own parsing * this forces all files to include explicitment their needs and not count on far streched dependencies * this helps Makefile to rebuild only the minimum * according to this rule, most standalone .h are now gone * big app.h is gone * remove seldom __cplusplus, if c++ happens, everything will have to be done properly anyway * all unrequired include were removed * split common/ into common/ (client+arm) and common_arm/ (os+bootloader) * bring zlib to common/ * bring stuff not really/not yet used in common back to armsrc/ or client/ * bring liblua into client/ * bring uart into client/ * move some portions of code around (dbprint, protocols,...) * rename unused files into *_disabled.[ch] to make it explicit * rename soft Uarts between 14a, 14b and iclass, so a standalone could use several without clash * remove PrintAndLogDevice * move deprecated-hid-flasher from client to tools * Makefiles * treat deps in armsrc/ as in client/ * client: stop on warning (-Werror), same as for armsrc/ Tested on: * all standalone modes * Linux
This commit is contained in:
@@ -34,12 +34,15 @@
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "cipherutils.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "commonutil.h" // ARRAYLEN
|
||||
|
||||
#include "fileutils.h"
|
||||
#include "cipherutils.h"
|
||||
/**
|
||||
*
|
||||
* @brief Return and remove the first bit (x0) in the stream : <x0 x1 x2 x3 ... xn >
|
||||
@@ -152,7 +155,7 @@ void printarr(const char *name, uint8_t *arr, int len) {
|
||||
cx += snprintf(output + cx, outsize - cx, "0x%02x,", *(arr + i)); //5 bytes per byte
|
||||
}
|
||||
snprintf(output + cx, outsize - cx, "};");
|
||||
PrintAndLogDevice(NORMAL, output);
|
||||
PrintAndLogEx(NORMAL, output);
|
||||
free(output);
|
||||
}
|
||||
|
||||
@@ -165,7 +168,7 @@ void printvar(const char *name, uint8_t *arr, int len) {
|
||||
cx += snprintf(output + cx, outsize - cx, "%02x", *(arr + i)); //2 bytes per byte
|
||||
}
|
||||
|
||||
PrintAndLogDevice(NORMAL, output);
|
||||
PrintAndLogEx(NORMAL, output);
|
||||
free(output);
|
||||
}
|
||||
|
||||
@@ -179,7 +182,7 @@ void printarr_human_readable(const char *title, uint8_t *arr, int len) {
|
||||
cx += snprintf(output + cx, outsize - cx, "\n%02x| ", i);
|
||||
cx += snprintf(output + cx, outsize - cx, "%02x ", *(arr + i));
|
||||
}
|
||||
PrintAndLogDevice(NORMAL, output);
|
||||
PrintAndLogEx(NORMAL, output);
|
||||
free(output);
|
||||
}
|
||||
|
||||
@@ -201,12 +204,12 @@ static int testBitStream() {
|
||||
}
|
||||
|
||||
if (memcmp(input, output, sizeof(input)) == 0) {
|
||||
PrintAndLogDevice(SUCCESS, " Bitstream test 1 ok");
|
||||
PrintAndLogEx(SUCCESS, " Bitstream test 1 ok");
|
||||
} else {
|
||||
PrintAndLogDevice(FAILED, " Bitstream test 1 failed");
|
||||
PrintAndLogEx(FAILED, " Bitstream test 1 failed");
|
||||
uint8_t i;
|
||||
for (i = 0 ; i < ARRAYLEN(input) ; i++) {
|
||||
PrintAndLogDevice(NORMAL, " IN %02x, OUT %02x", input[i], output[i]);
|
||||
PrintAndLogEx(NORMAL, " IN %02x, OUT %02x", input[i], output[i]);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -231,12 +234,12 @@ static int testReversedBitstream() {
|
||||
}
|
||||
|
||||
if (memcmp(input, output, sizeof(input)) == 0) {
|
||||
PrintAndLogDevice(SUCCESS, " Bitstream test 2 ok");
|
||||
PrintAndLogEx(SUCCESS, " Bitstream test 2 ok");
|
||||
} else {
|
||||
PrintAndLogDevice(FAILED, " Bitstream test 2 failed");
|
||||
PrintAndLogEx(FAILED, " Bitstream test 2 failed");
|
||||
uint8_t i;
|
||||
for (i = 0 ; i < ARRAYLEN(input) ; i++) {
|
||||
PrintAndLogDevice(NORMAL, " IN %02x, MIDDLE: %02x, OUT %02x", input[i], reverse[i], output[i]);
|
||||
PrintAndLogEx(NORMAL, " IN %02x, MIDDLE: %02x, OUT %02x", input[i], reverse[i], output[i]);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -245,7 +248,7 @@ static int testReversedBitstream() {
|
||||
|
||||
|
||||
int testCipherUtils(void) {
|
||||
PrintAndLogDevice(INFO, "Testing some internals...");
|
||||
PrintAndLogEx(INFO, "Testing some internals...");
|
||||
int retval = 0;
|
||||
retval |= testBitStream();
|
||||
retval |= testReversedBitstream();
|
||||
|
||||
Reference in New Issue
Block a user