kvv test added

This commit is contained in:
merlokk 2021-06-23 18:43:57 +03:00
parent 8aee946895
commit fb9d19e43a

View file

@ -10,7 +10,44 @@
#include "cipursetest.h"
bool CIPURSETest(bool verbose) {
#include <unistd.h>
#include <string.h> // memcpy memset
#include "fileutils.h"
#include "cipurse/cipursecrypto.h"
#include "cipurse/cipursecore.h"
uint8_t Key[] = CIPURSE_DEFAULT_KEY;
uint8_t KeyKvv[CIPURSE_KVV_LENGTH] = {0x5f, 0xd6, 0x7b, 0xcb};
static bool TestKVV(void) {
uint8_t kvv[CIPURSE_KVV_LENGTH] = {0};
CipurseCGetKVV(Key, kvv);
//PrintAndLogEx(INFO, "kvv: %s", sprint_hex(kvv, 4));
bool res = memcmp(KeyKvv, kvv, CIPURSE_KVV_LENGTH) == 0;
return true;
if (res)
PrintAndLogEx(INFO, "kvv: " _GREEN_("passed"));
else
PrintAndLogEx(INFO, "kvv: " _RED_("fail"));
return res;
}
bool CIPURSETest(bool verbose) {
bool res = true;
PrintAndLogEx(INFO, "------ " _CYAN_("CIPURSE TESTS") " ------");
res = res && TestKVV();
PrintAndLogEx(INFO, "---------------------------");
if (res)
PrintAndLogEx(SUCCESS, "\tTest(s) [ %s ]", _GREEN_("ok"));
else
PrintAndLogEx(FAILED, "\tTest(s) [ %s ]", _RED_("fail"));
return res;
}