diff options
Diffstat (limited to 'host/lib/file_keys.c')
-rw-r--r-- | host/lib/file_keys.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/host/lib/file_keys.c b/host/lib/file_keys.c index c311e6ac..ac9af17d 100644 --- a/host/lib/file_keys.c +++ b/host/lib/file_keys.c @@ -79,42 +79,3 @@ uint8_t* DigestFile(char* input_file, int sig_algorithm) { close(input_fd); return digest; } - -uint8_t* SignatureFile(const char* input_file, const char* key_file, - unsigned int algorithm) { - char* sign_utility = "./sign_data.sh"; - char* cmd; /* Command line to invoke. */ - int cmd_len; - FILE* cmd_out; /* File descriptor to command output. */ - uint8_t* signature = NULL; - int signature_size = siglen_map[algorithm]; - - /* Build command line: - * sign_data.sh <algorithm> <key file> <input file> - */ - cmd_len = (strlen(sign_utility) + 1 + /* +1 for space. */ - 2 + 1 + /* For [algorithm]. */ - strlen(key_file) + 1 + /* +1 for space. */ - strlen(input_file) + - 1); /* For the trailing '\0'. */ - cmd = (char*) malloc(cmd_len); - snprintf(cmd, cmd_len, "%s %u %s %s", sign_utility, algorithm, key_file, - input_file); - cmd_out = popen(cmd, "r"); - free(cmd); - if (!cmd_out) { - VBDEBUG(("Couldn't execute: %s\n", cmd)); - return NULL; - } - - signature = (uint8_t*) malloc(signature_size); - if (fread(signature, signature_size, 1, cmd_out) != 1) { - VBDEBUG(("Couldn't read signature.\n")); - pclose(cmd_out); - free(signature); - return NULL; - } - - pclose(cmd_out); - return signature; -} |