Skip to content

Commit

Permalink
Added debug logs to entropic encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiogarcia465179 committed Dec 13, 2024
1 parent f004350 commit 2756c62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions providers/implementations/ciphers/cipher_chacha20_poly1305_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,21 +1292,24 @@ void entropic_encryption(const unsigned char *in, unsigned char *out, size_t len
// Perform binary polynomial multiplication of the key and public string
simplemult_gf2x(mult_result, public_string, lenM_64, (uint64_t *)key, lenk_64, chunks, chunkSize);
free(public_string);
printf("\nFree public _ stirng\n");
public_string = NULL;

free(chunks);
chunks = NULL;

printf("\nGen final key\n");
final_key = (uint64_t *)aligned_alloc(32, sizeof(uint64_t) * lenM_64);
if (NULL == final_key) {
fprintf(stderr, "entropic_encryption | alloc final_key fail.\n");
exit(-1);
}

// Reduce the multiplication result
printf("\nReduction\n");
reduction(3, mult_result, final_key, lenR_64, lenR, lenM, lenM_64);
free(mult_result);
mult_result = NULL;
printf("\nFinal key generated succesfully\n");

// XOR input (`in`) and `final_key` and write to `out`
size_t remaining_bytes = lenM % sizeof(uint64_t);
Expand All @@ -1324,8 +1327,12 @@ void entropic_encryption(const unsigned char *in, unsigned char *out, size_t len
}
}


printf("\nFinal key is free\n");
free(final_key);
printf("\nFinal key is set to NULL now....\n");
final_key = NULL;
printf("\nFinal key just set to null is free\n");



}

0 comments on commit 2756c62

Please sign in to comment.