common.h (1164B)
1 #ifndef __SUPERCOP_CLI_COMMON_H__ 2 #define __SUPERCOP_CLI_COMMON_H__ 3 4 #include <stdio.h> 5 6 #include "fmt/common.h" 7 #include "keypair/keypair.h" 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 // Intentionally minimal: this is a short-lived CLI, so it keeps the 14 // fprintf(stdout/stderr) + exit-code contract instead of adopting the 15 // rxi/log verbosity model used by the daemon projects (unosd, udphole). 16 // No config file, no environment variables: flags and stdin/files only. 17 18 extern struct Format *supercop_formats; 19 20 long fremaining(FILE *fd); 21 struct KeyPair *readKeyFile(const char *filename); 22 23 // Find a registered key format by name (0x00, asc, hdr); NULL if unknown 24 struct Format *supercop_find_format(const char *name); 25 26 // Message source: -m string wins, then -M file, then stdin 27 FILE *supercop_open_message(const char *message, const char *messageFile); 28 29 // Parse a hex signature string into a rewinded tmpfile (must be 64 bytes) 30 FILE *supercop_parse_signature(const char *hex); 31 32 // Single implementation shared by the --version flag and version subcommand 33 void print_version(void); 34 35 #ifdef __cplusplus 36 } // extern "C" 37 #endif 38 39 #endif // __SUPERCOP_CLI_COMMON_H__