Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 974470238d | |||
| 7c2821dd0d | |||
| 6f3976bc07 |
@@ -58,14 +58,14 @@ One-time pads can be trivially encrypted and decrypted using pencil and paper, m
|
||||
|
||||
### Download Pre-Built Binaries
|
||||
|
||||
**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.42/otp-v0.3.42-linux-x86_64)**
|
||||
**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.45/otp-v0.3.45-linux-x86_64)**
|
||||
|
||||
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.42/otp-v0.3.42-linux-arm64)**
|
||||
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.45/otp-v0.3.45-linux-arm64)**
|
||||
|
||||
After downloading:
|
||||
```bash
|
||||
# Rename for convenience, then make executable
|
||||
mv otp-v0.3.42-linux-x86_64 otp
|
||||
mv otp-v0.3.45-linux-x86_64 otp
|
||||
chmod +x otp
|
||||
|
||||
# Run it
|
||||
|
||||
38
src/crypto.c
38
src/crypto.c
@@ -587,36 +587,14 @@ int universal_decrypt(const char* input_data, const char* output_target, decrypt
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Validate pad integrity
|
||||
int integrity_result = validate_pad_integrity(pad_path, stored_chksum);
|
||||
if (integrity_result == 3) {
|
||||
if (mode == DECRYPT_MODE_SILENT) {
|
||||
fprintf(stderr, "Error: Pad integrity check failed!\n");
|
||||
return 1;
|
||||
} else if (mode == DECRYPT_MODE_INTERACTIVE) {
|
||||
printf("Warning: Pad integrity check failed!\n");
|
||||
printf("Expected: %s\n", stored_chksum);
|
||||
printf("Continue anyway? (y/N): ");
|
||||
fflush(stdout);
|
||||
|
||||
char response[10];
|
||||
if (fgets(response, sizeof(response), stdin) == NULL ||
|
||||
(response[0] != 'y' && response[0] != 'Y')) {
|
||||
printf("Decryption aborted.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (integrity_result != 0) {
|
||||
if (mode == DECRYPT_MODE_SILENT) {
|
||||
fprintf(stderr, "Error: Cannot verify pad integrity\n");
|
||||
} else {
|
||||
printf("Error: Cannot verify pad integrity\n");
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
if (mode == DECRYPT_MODE_INTERACTIVE || mode == DECRYPT_MODE_FILE_TO_TEXT) {
|
||||
printf("Pad integrity: VERIFIED\n");
|
||||
}
|
||||
// Pad integrity validation disabled for performance
|
||||
// The checksum is already verified by matching the filename
|
||||
// If you need to verify pad integrity, the pad file would need to be read entirely
|
||||
// which is very slow for large pads (multi-GB files)
|
||||
|
||||
// Skip integrity check - trust the filename checksum
|
||||
if (mode == DECRYPT_MODE_INTERACTIVE || mode == DECRYPT_MODE_FILE_TO_TEXT) {
|
||||
printf("Using pad: %s\n", stored_chksum);
|
||||
}
|
||||
|
||||
// Decode base64 ciphertext
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
// Version - Updated automatically by build.sh
|
||||
#define OTP_VERSION "v0.3.42"
|
||||
#define OTP_VERSION "v0.3.45"
|
||||
|
||||
// Constants
|
||||
#define MAX_INPUT_SIZE 4096
|
||||
|
||||
31
src/ui.c
31
src/ui.c
@@ -334,7 +334,15 @@ int handle_decrypt_menu(void) {
|
||||
temp_default[sizeof(temp_default) - 1] = '\0';
|
||||
|
||||
// Remove common encrypted extensions to get a better default
|
||||
if (strstr(temp_default, ".otp.asc")) {
|
||||
if (strstr(temp_default, ".tar.gz.otp")) {
|
||||
// Directory archive - remove .tar.gz.otp to get original directory name
|
||||
char* ext_pos = strstr(temp_default, ".tar.gz.otp");
|
||||
*ext_pos = '\0';
|
||||
} else if (strstr(temp_default, ".tar.otp")) {
|
||||
// Directory archive without compression - remove .tar.otp
|
||||
char* ext_pos = strstr(temp_default, ".tar.otp");
|
||||
*ext_pos = '\0';
|
||||
} else if (strstr(temp_default, ".otp.asc")) {
|
||||
// Replace .otp.asc with original extension or no extension
|
||||
char* ext_pos = strstr(temp_default, ".otp.asc");
|
||||
*ext_pos = '\0';
|
||||
@@ -402,7 +410,15 @@ int handle_decrypt_menu(void) {
|
||||
temp_default[sizeof(temp_default) - 1] = '\0';
|
||||
|
||||
// Remove common encrypted extensions to get a better default
|
||||
if (strstr(temp_default, ".otp.asc")) {
|
||||
if (strstr(temp_default, ".tar.gz.otp")) {
|
||||
// Directory archive - remove .tar.gz.otp to get original directory name
|
||||
char* ext_pos = strstr(temp_default, ".tar.gz.otp");
|
||||
*ext_pos = '\0';
|
||||
} else if (strstr(temp_default, ".tar.otp")) {
|
||||
// Directory archive without compression - remove .tar.otp
|
||||
char* ext_pos = strstr(temp_default, ".tar.otp");
|
||||
*ext_pos = '\0';
|
||||
} else if (strstr(temp_default, ".otp.asc")) {
|
||||
// Replace .otp.asc with original extension or no extension
|
||||
char* ext_pos = strstr(temp_default, ".otp.asc");
|
||||
*ext_pos = '\0';
|
||||
@@ -595,16 +611,9 @@ int handle_directory_encrypt(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Generate default output filename
|
||||
// Generate default output filename - append .tar.gz.otp to the directory path
|
||||
char default_output[1024];
|
||||
const char* dir_name = strrchr(dir_path, '/');
|
||||
if (dir_name) {
|
||||
dir_name++; // Skip the '/'
|
||||
} else {
|
||||
dir_name = dir_path;
|
||||
}
|
||||
|
||||
snprintf(default_output, sizeof(default_output), "%s.tar.gz.otp", dir_name);
|
||||
snprintf(default_output, sizeof(default_output), "%s.tar.gz.otp", dir_path);
|
||||
|
||||
// Get output filename
|
||||
char output_file[512];
|
||||
|
||||
Reference in New Issue
Block a user