unify text - step 1

This commit is contained in:
iceman1001 committed 2025-03-25 10:12:16 +01:00
1 parent 090f31d0a7
commit 875b3c44b4
40 files changed
+167 -128

No files matched your search

+5 -5
View File
@@ -51,7 +51,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
uint8_t *fpga_config = calloc(num_infiles * FPGA_CONFIG_SIZE, sizeof(uint8_t));
if (fpga_config == NULL) {
fprintf(stderr, "failed to allocate memory");
fprintf(stderr, "Failed to allocate memory\n");
return (EXIT_FAILURE);
}
@@ -94,14 +94,14 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
char *outbuf = calloc(outsize_max, sizeof(char));
if (outbuf == NULL) {
fprintf(stderr, "failed to allocate memory");
fprintf(stderr, "Failed to allocate memory\n");
free(fpga_config);
return (EXIT_FAILURE);
}
char *ring_buffer = calloc(buffer_size, sizeof(char));
if (ring_buffer == NULL) {
fprintf(stderr, "failed to allocate memory");
fprintf(stderr, "Failed to allocate memory\n");
free(outbuf);
free(fpga_config);
return (EXIT_FAILURE);
@@ -470,7 +470,7 @@ int main(int argc, char **argv) {
FILE **outfiles = calloc(num_output_files, sizeof(FILE *));
char **outfile_names = calloc(num_output_files, sizeof(char *));
if (outfiles == NULL || outfile_names == NULL) {
fprintf(stderr, "Error. Cannot allocate memory for output files\n\n");
fprintf(stderr, "Failed to allocate memory\n\n");
free(outfiles);
free(outfile_names);
return (EXIT_FAILURE);
@@ -533,7 +533,7 @@ int main(int argc, char **argv) {
FILE **infiles = calloc(num_input_files, sizeof(FILE *));
char **infile_names = calloc(num_input_files, sizeof(char *));
if (infiles == NULL || infile_names == NULL) {
fprintf(stderr, "Error. Cannot allocate memory for input files\n\n");
fprintf(stderr, "Failed to allocate memory\n\n");
free(infile_names);
free(infiles);
return (EXIT_FAILURE);
@@ -459,12 +459,12 @@ int main(int argc, char *argv[]) {
for (int i = 0; i < thread_count; ++i) {
targs *a = calloc(1, rng.len + sizeof(targs));
if (a == NULL) {
printf("Memory allocation failed for thread arguments\n");
printf("Failed to allocate memory\n");
exit(1);
}
a->r.data = calloc(1, rng.len);
if (a->r.data == NULL) {
printf("Memory allocation failed for rng data\n");
printf("Failed to allocate memory\n");
free(a);
exit(1);
}
+2 -2
View File
@@ -197,8 +197,8 @@ static void *crack(void *d) {
// create space for tables
Tk = (struct Tklower *)calloc(sizeof(struct Tklower) * 0x40000, sizeof(uint8_t));
if (!Tk) {
printf("Failed to allocate memory (Tk)\n");
if (Tk == NULL) {
printf("Failed to allocate memory\n");
exit(1);
}
+2 -2
View File
@@ -227,8 +227,8 @@ static uint64_t packstate(uint64_t s) {
/* create_guess_table mallocs the tables */
static void create_guess_table(void) {
guesses = (struct guess *)calloc(1, sizeof(struct guess) * maxtablesize);
if (!guesses) {
printf("cannot allocate memory for guess table\n");
if (guesses == NULL) {
printf("Failed to allocate memory\n");
exit(1);
}
}
+1 -1
View File
@@ -113,7 +113,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
// allocate memory to hold info about platforms/devices
*cd_ctx = (compute_platform_ctx_t *) calloc(ocl_platform_cnt, sizeof(compute_platform_ctx_t));
if (*cd_ctx == NULL) {
printf("Error: calloc (compute_platform_ctx_t) failed (%d): %s\n", errno, strerror(errno));
printf("Failed to allocate memory\n");
free(ocl_platforms);
return -5;
}
+8 -7
View File
@@ -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);
+1
View File
@@ -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;
}
+1
View File
@@ -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;
}
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -278,7 +278,7 @@ int main(int argc, 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;
+1 -1
View File
@@ -472,7 +472,7 @@ int main(int argc, 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;