mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
unify text - step 1
This commit is contained in:
parent
090f31d0a7
commit
875b3c44b4
40 changed files with 167 additions and 128 deletions
|
@ -57,7 +57,7 @@ static countKeys *uniqsort(uint64_t *possibleKeys, uint32_t size) {
|
|||
|
||||
our_counts = calloc(size, sizeof(countKeys));
|
||||
if (our_counts == NULL) {
|
||||
printf("Memory allocation error for our_counts");
|
||||
printf("Failed to allocate memory");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ static void *nested_revover(void *args) {
|
|||
// printf("New chunk by %d, sizeof %lu\n", kcount, rp->keyCount * sizeof(uint64_t));
|
||||
void *tmp = realloc(rp->keys, rp->keyCount * sizeof(uint64_t));
|
||||
if (tmp == NULL) {
|
||||
printf("Memory allocation error for pk->possibleKeys");
|
||||
printf("Failed to allocate memory\n");
|
||||
rp->keyCount = 0;
|
||||
is_ok = false;
|
||||
break;
|
||||
|
@ -136,7 +136,7 @@ static void *nested_revover(void *args) {
|
|||
rp->keyCount = kcount;
|
||||
void *tmp = (uint64_t *)realloc(rp->keys, rp->keyCount * sizeof(uint64_t));
|
||||
if (tmp == NULL) {
|
||||
printf("Memory allocation error for pk->possibleKeys");
|
||||
printf("Failed to allocate memory\n");
|
||||
rp->keyCount = 0;
|
||||
free(rp->keys);
|
||||
} else {
|
||||
|
@ -198,14 +198,14 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
|||
free(threads);
|
||||
|
||||
if (*keyCount == 0) {
|
||||
printf("Didn't recover any keys.\r\n");
|
||||
printf("Didn't recover any keys\r\n");
|
||||
free(pRPs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
keys = calloc((*keyCount) * sizeof(uint64_t), sizeof(uint8_t));
|
||||
if (keys == NULL) {
|
||||
printf("Cannot allocate memory to merge keys.\r\n");
|
||||
printf("Failed to allocate memory\r\n");
|
||||
free(pRPs);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
|||
*keyCount = 0;
|
||||
|
||||
if (ck == NULL) {
|
||||
printf("Cannot allocate memory for ck on uniqsort.");
|
||||
printf("Failed to allocate memory\n");
|
||||
free(ck);
|
||||
free(pRPs);
|
||||
return NULL;
|
||||
|
@ -242,9 +242,10 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
|||
// This key can be found here two or more times
|
||||
if (ck[i].count > 0) {
|
||||
*keyCount += 1;
|
||||
|
||||
void *tmp = realloc(keys, sizeof(uint64_t) * (*keyCount));
|
||||
if (tmp == NULL) {
|
||||
printf("Cannot allocate memory for keys on merge.");
|
||||
printf("Failed to allocate memory\n");
|
||||
free(ck);
|
||||
free(keys);
|
||||
free(pRPs);
|
||||
|
|
|
@ -424,6 +424,7 @@ int main(int argc, char *const argv[]) {
|
|||
uint32_t nttest = prng_successor(1, 16); // a first valid nonce
|
||||
pNtData->pNK = (NtpKs1 *)calloc(8192, sizeof(NtpKs1)); // 2**16 filtered with 3 parity bits => 2**13
|
||||
if (pNtData->pNK == NULL) {
|
||||
printf("Failed to allocate memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ int main(int argc, char *const argv[]) {
|
|||
printf("Init...\n");
|
||||
NtpKs1 *pNK = calloc(2, sizeof(NtpKs1));
|
||||
if (pNK == NULL) {
|
||||
printf("Failed to allocate memory\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
@ -738,7 +738,7 @@ int main(int argc, const char *argv[]) {
|
|||
printf("Testing default keys using NESTED authentication...\n");
|
||||
struct thread_key_args *def = calloc(1, sizeof(struct thread_key_args));
|
||||
if (def == NULL) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
fprintf(stderr, "Failed to allocate memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
def->thread = 0;
|
||||
|
@ -763,7 +763,7 @@ int main(int argc, const char *argv[]) {
|
|||
for (int i = 0; i < thread_count; ++i) {
|
||||
struct thread_args *a = calloc(1, sizeof(struct thread_args));
|
||||
if (a == NULL) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
fprintf(stderr, "Failed to allocate memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a->xored = xored;
|
||||
|
@ -789,7 +789,7 @@ int main(int argc, const char *argv[]) {
|
|||
for (int i = 0; i < thread_count; ++i) {
|
||||
struct thread_args *a = calloc(1, sizeof(struct thread_args));
|
||||
if (a == NULL) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
fprintf(stderr, "Failed to allocate memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a->xored = xored;
|
||||
|
@ -836,7 +836,7 @@ int main(int argc, const char *argv[]) {
|
|||
for (int i = 0; i < thread_count; ++i) {
|
||||
struct thread_key_args *b = calloc(1, sizeof(struct thread_key_args));
|
||||
if (b == NULL) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
fprintf(stderr, "Failed to allocaet memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
b->thread = i;
|
||||
|
|
|
@ -291,7 +291,7 @@ int main(int argc, const char *argv[]) {
|
|||
for (int i = 0; i < thread_count; ++i) {
|
||||
struct thread_args *a = calloc(1, sizeof(struct thread_args));
|
||||
if (a == NULL) {
|
||||
fprintf(stderr, "Failed to allocate memory for thread arguments\n");
|
||||
fprintf(stderr, "Failed to allocate memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a->thread = i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue