common.h (966B)
1 #ifndef __SFINX_CLI_COMMON_H__ 2 #define __SFINX_CLI_COMMON_H__ 3 4 #include <stddef.h> 5 #include <stdint.h> 6 7 #include "sfinx.h" 8 9 // Common {{{ 10 // 11 // Message reading and hex helpers shared by the commands 12 13 int cli_read_message(const char *message, const char *file, uint8_t **out, size_t *len_out); 14 int cli_hex_decode(const char *hex, uint8_t **out, size_t *len_out); 15 // }}} 16 17 // Seed {{{ 18 // 19 // The optional length argument and the random bytes it describes 20 21 #define CLI_SEED_LEN_DEFAULT 32 22 23 int cli_seed_length(const char *text, size_t *len_out); 24 sfinx_status cli_seed_random(size_t len, uint8_t **out); 25 // }}} 26 27 // Key derive {{{ 28 // 29 // Derive the public half of a key for one key mode 30 // single selects the N = 0 key, otherwise the stacked subtrees 31 // a seed in the key wins over a stored public key, so --hash cannot disagree with the file 32 33 sfinx_status cli_key_derive(sfinx_key *key, int single, ssize_t path_len); 34 // }}} 35 36 #endif // __SFINX_CLI_COMMON_H__