Version v0.3.9 - fix truerng

This commit is contained in:
2025-09-22 13:04:06 -04:00
parent 5e1de92454
commit a0ce6f3253
3 changed files with 68 additions and 47 deletions

BIN
otp-arm64 Executable file

Binary file not shown.

BIN
otp-x86_64 Executable file

Binary file not shown.

31
otp.c
View File

@@ -331,7 +331,7 @@ int interactive_mode(void) {
void show_main_menu(void) {
printf("\n=========================== Main Menu - OTP v0.3.7 ===========================\n\n");
printf("\n=========================== Main Menu - OTP v0.3.8 ===========================\n\n");
printf(" \033[4mT\033[0mext encrypt\n"); //TEXT ENCRYPT
printf(" \033[4mF\033[0mile encrypt\n"); //FILE ENCRYPT
@@ -3243,7 +3243,7 @@ int generate_ascii_armor(const char* chksum, uint64_t offset, const unsigned cha
strcpy(*ascii_output, "-----BEGIN OTP MESSAGE-----\n");
char temp_line[256];
snprintf(temp_line, sizeof(temp_line), "Version: v0.3.7\n");
snprintf(temp_line, sizeof(temp_line), "Version: v0.3.8\n");
strcat(*ascii_output, temp_line);
snprintf(temp_line, sizeof(temp_line), "Pad-ChkSum: %s\n", chksum);
@@ -4729,7 +4729,27 @@ int handle_add_entropy_to_pad(const char* pad_chksum) {
return 1;
}
// Get entropy amount
size_t target_bytes;
// For TrueRNG, automatically use the full pad size
if (entropy_source == ENTROPY_SOURCE_TRUERNG) {
// Get the pad file size
char pad_path[1024];
char state_path[1024];
get_pad_path(pad_chksum, pad_path, state_path);
struct stat pad_stat;
if (stat(pad_path, &pad_stat) != 0) {
printf("Error: Cannot get pad file size\n");
return 1;
}
target_bytes = (size_t)pad_stat.st_size;
printf("\nTrueRNG selected - will enhance entire pad with hardware entropy\n");
printf("Pad size: %.2f GB (%zu bytes)\n",
(double)target_bytes / (1024.0 * 1024.0 * 1024.0), target_bytes);
} else {
// For other entropy sources, show the selection menu
printf("\nEntropy collection options:\n");
printf(" 1. Recommended (2048 bytes) - Optimal security\n");
printf(" 2. Minimum (1024 bytes) - Good security\n");
@@ -4743,7 +4763,7 @@ int handle_add_entropy_to_pad(const char* pad_chksum) {
return 1;
}
size_t target_bytes = 2048; // Default
target_bytes = 2048; // Default
int amount_choice = atoi(amount_input);
switch (amount_choice) {
@@ -4775,6 +4795,7 @@ int handle_add_entropy_to_pad(const char* pad_chksum) {
target_bytes = 2048; // Default to recommended
break;
}
}
printf("\nCollecting %zu bytes of entropy from selected source...\n", target_bytes);
@@ -4824,7 +4845,7 @@ int handle_add_entropy_to_pad(const char* pad_chksum) {
void print_usage(const char* program_name) {
printf("OTP Cipher - One Time Pad Implementation v0.3.7\n");
printf("OTP Cipher - One Time Pad Implementation v0.3.8\n");
printf("Built for testing entropy system\n");
printf("Usage:\n");
printf(" %s - Interactive mode\n", program_name);