diff options
Diffstat (limited to 'src/tpmtool.c')
-rw-r--r-- | src/tpmtool.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/src/tpmtool.c b/src/tpmtool.c index 0c81d3418a..9b2168e349 100644 --- a/src/tpmtool.c +++ b/src/tpmtool.c @@ -39,7 +39,6 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <error.h> /* Gnulib portability files. */ #include <read-file.h> @@ -130,13 +129,19 @@ cmd_parser (int argc, char **argv) printf ("Setting log level to %d\n", debug); if ((ret = gnutls_global_init ()) < 0) - error (EXIT_FAILURE, 0, "global_init: %s", gnutls_strerror (ret)); + { + fprintf (stderr, "global_init: %s", gnutls_strerror (ret)); + exit(1); + } if (HAVE_OPT(OUTFILE)) { outfile = safe_open_rw (OPT_ARG(OUTFILE), 0); if (outfile == NULL) - error (EXIT_FAILURE, errno, "%s", OPT_ARG(OUTFILE)); + { + fprintf (stderr, "%s", OPT_ARG(OUTFILE)); + exit(1); + } } else outfile = stdout; @@ -145,7 +150,10 @@ cmd_parser (int argc, char **argv) { infile = fopen (OPT_ARG(INFILE), "rb"); if (infile == NULL) - error (EXIT_FAILURE, errno, "%s", OPT_ARG(INFILE)); + { + fprintf (stderr, "%s", OPT_ARG(INFILE)); + exit(1); + } } else infile = stdin; @@ -210,7 +218,10 @@ static void tpm_generate(FILE* outfile, unsigned int key_type, unsigned int bits free(srk_pass); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_tpm_privkey_generate: %s", gnutls_strerror (ret)); + { + fprintf (stderr, "gnutls_tpm_privkey_generate: %s", gnutls_strerror (ret)); + exit(1); + } /* fwrite (pubkey.data, 1, pubkey.size, outfile); fputs ("\n", outfile);*/ @@ -230,7 +241,10 @@ static void tpm_delete(const char* url, FILE* outfile) ret = gnutls_tpm_privkey_delete(url, srk_pass); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_tpm_privkey_delete: %s", gnutls_strerror (ret)); + { + fprintf (stderr, "gnutls_tpm_privkey_delete: %s", gnutls_strerror (ret)); + exit(1); + } fprintf (outfile, "Key %s deleted\n", url); } @@ -244,7 +258,10 @@ static void tpm_list(FILE* outfile) ret = gnutls_tpm_get_registered (&list); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_tpm_get_registered: %s", gnutls_strerror (ret)); + { + fprintf (stderr, "gnutls_tpm_get_registered: %s", gnutls_strerror (ret)); + exit(1); + } fprintf(outfile, "Available keys:\n"); for (i=0;;i++) @@ -253,7 +270,10 @@ static void tpm_list(FILE* outfile) if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) break; else if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_tpm_key_list_get_url: %s", gnutls_strerror (ret)); + { + fprintf (stderr, "gnutls_tpm_key_list_get_url: %s", gnutls_strerror (ret)); + exit(1); + } fprintf(outfile, "\t%u: %s\n", i, url); gnutls_free(url); @@ -279,7 +299,10 @@ static void tpm_pubkey(const char* url, FILE* outfile) free(srk_pass); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_pubkey_import_tpm_url: %s", gnutls_strerror (ret)); + { + fprintf (stderr, "gnutls_pubkey_import_tpm_url: %s", gnutls_strerror (ret)); + exit(1); + } _pubkey_info(outfile, GNUTLS_CRT_PRINT_FULL, pubkey); |