Version v0.3.17 - Refactored to smaller files to help agents out
This commit is contained in:
45
otp.h
45
otp.h
@@ -134,7 +134,8 @@ int decrypt_ascii_file(const char* input_file, const char* output_file);
|
||||
typedef enum {
|
||||
ENTROPY_SOURCE_KEYBOARD = 1,
|
||||
ENTROPY_SOURCE_DICE = 2,
|
||||
ENTROPY_SOURCE_TRUERNG = 3
|
||||
ENTROPY_SOURCE_TRUERNG = 3,
|
||||
ENTROPY_SOURCE_FILE = 4
|
||||
} entropy_source_t;
|
||||
|
||||
// Terminal control for entropy collection
|
||||
@@ -156,17 +157,45 @@ void draw_quality_bar(double quality, int width, const char* label);
|
||||
#define TRUERNGPROV2_VID "04D8"
|
||||
#define TRUERNGPROV2_PID "EBB5"
|
||||
|
||||
// TrueRNG Device Type enumeration
|
||||
// SwiftRNG Device Constants (same VID/PID as TrueRNG devices)
|
||||
#define SWIFT_RNG_VID "04D8"
|
||||
#define SWIFT_RNG_PID "F5FE"
|
||||
#define SWIFT_RNG_PRO_VID "16D0"
|
||||
#define SWIFT_RNG_PRO_PID "0AA0"
|
||||
#define SWIFT_RNG_PRO_V2_VID "04D8"
|
||||
#define SWIFT_RNG_PRO_V2_PID "EBB5"
|
||||
|
||||
// TrueRNG/SwiftRNG Device Type enumeration
|
||||
typedef enum {
|
||||
TRUERNG_ORIGINAL = 1,
|
||||
TRUERNG_PRO = 2,
|
||||
TRUERNG_PRO_V2 = 3
|
||||
TRUERNG_PRO_V2 = 3,
|
||||
SWIFT_RNG = 4,
|
||||
SWIFT_RNG_PRO = 5,
|
||||
SWIFT_RNG_PRO_V2 = 6
|
||||
} truerng_device_type_t;
|
||||
|
||||
// Hardware RNG device information structure
|
||||
typedef struct {
|
||||
char port_path[256]; // Device port path (e.g., /dev/ttyUSB0)
|
||||
truerng_device_type_t device_type; // Device type identifier
|
||||
char friendly_name[64]; // Human-readable device name
|
||||
int is_working; // 1 if device passes basic test, 0 otherwise
|
||||
} hardware_rng_device_t;
|
||||
|
||||
// Hardware RNG device detection and selection functions
|
||||
int detect_all_hardware_rng_devices(hardware_rng_device_t* devices, int max_devices, int* num_devices_found);
|
||||
int test_hardware_rng_device(const hardware_rng_device_t* device);
|
||||
int select_hardware_rng_device_interactive(hardware_rng_device_t* devices, int num_devices, hardware_rng_device_t* selected_device);
|
||||
int find_truerng_port(char* port_path, size_t port_path_size, truerng_device_type_t* device_type); // Legacy function for backward compatibility
|
||||
|
||||
// TrueRNG entropy collection functions (updated to match implementation)
|
||||
int find_truerng_port(char* port_path, size_t port_path_size, truerng_device_type_t* device_type);
|
||||
int setup_truerng_serial_port(const char* port_path);
|
||||
int collect_truerng_entropy(unsigned char* entropy_buffer, size_t target_bytes, size_t* collected_bytes, int display_progress);
|
||||
int collect_truerng_entropy_from_device(const hardware_rng_device_t* device, unsigned char* entropy_buffer,
|
||||
size_t target_bytes, size_t* collected_bytes, int display_progress);
|
||||
int collect_truerng_entropy_streaming_from_device(const hardware_rng_device_t* device, const char* pad_chksum,
|
||||
size_t total_bytes, int display_progress, int entropy_mode);
|
||||
const char* get_truerng_device_name(truerng_device_type_t device_type);
|
||||
int read_usb_device_info(const char* port_name, char* vid, char* pid);
|
||||
|
||||
@@ -184,9 +213,13 @@ double get_precise_time(void);
|
||||
|
||||
// Entropy processing and application
|
||||
int derive_chacha20_params(const unsigned char* entropy_data, size_t entropy_size,
|
||||
unsigned char key[32], unsigned char nonce[12]);
|
||||
unsigned char key[32], unsigned char nonce[12]);
|
||||
int add_entropy_to_pad(const char* pad_chksum, const unsigned char* entropy_data,
|
||||
size_t entropy_size, int show_progress);
|
||||
size_t entropy_size, int show_progress);
|
||||
int add_entropy_direct_xor(const char* pad_chksum, const unsigned char* entropy_data,
|
||||
size_t entropy_size, uint64_t pad_size, int display_progress);
|
||||
int add_entropy_chacha20(const char* pad_chksum, const unsigned char* entropy_data,
|
||||
size_t entropy_size, uint64_t pad_size, int display_progress);
|
||||
int handle_add_entropy_to_pad(const char* pad_chksum);
|
||||
|
||||
// Enhanced entropy system helper functions
|
||||
|
||||
Reference in New Issue
Block a user