diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-07-14 09:56:52 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-07-14 09:56:52 +0200 |
commit | f4559dbb0a42dea56c0c45610b182f3951211759 (patch) | |
tree | 7216bebcb28e7000a383c5aa1f686711fc79dfbc /src/tpmtool.c | |
parent | 21080193e5d7b9da46bea1e30212ccbf206a1474 (diff) | |
download | gnutls-f4559dbb0a42dea56c0c45610b182f3951211759.tar.gz |
Enabled the generation of signing keys.
Diffstat (limited to 'src/tpmtool.c')
-rw-r--r-- | src/tpmtool.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/tpmtool.c b/src/tpmtool.c index 7f689b5208..074e6653c5 100644 --- a/src/tpmtool.c +++ b/src/tpmtool.c @@ -50,7 +50,7 @@ #include "tpmtool-args.h" static void cmd_parser (int argc, char **argv); -static void tpm_generate(FILE* outfile, unsigned int key_type, unsigned int bits, int reg); +static void tpm_generate(FILE* outfile, unsigned int key_type, unsigned int bits, unsigned int flags); static void tpm_pubkey(const char* url, FILE* outfile); static void tpm_delete(const char* url, FILE* outfile); static void tpm_list(FILE* outfile); @@ -81,7 +81,8 @@ cmd_parser (int argc, char **argv) int ret, debug = 0; unsigned int optct; unsigned int key_type = GNUTLS_PK_UNKNOWN; - unsigned int bits = 0, reg = 0; + unsigned int bits = 0; + unsigned int genflags = 0; /* Note that the default sec-param is legacy because several TPMs * cannot handle larger keys. */ @@ -95,7 +96,9 @@ cmd_parser (int argc, char **argv) debug = OPT_VALUE_DEBUG; if (HAVE_OPT(REGISTER)) - reg = 1; + genflags |= GNUTLS_TPM_REGISTER_KEY; + if (HAVE_OPT(SIGNING)) + genflags |= GNUTLS_TPM_KEY_SIGNING; gnutls_global_set_log_function (tls_log_func); gnutls_global_set_log_level (debug); @@ -133,7 +136,7 @@ cmd_parser (int argc, char **argv) { key_type = GNUTLS_PK_RSA; bits = get_bits (key_type, bits, sec_param); - tpm_generate (outfile, key_type, bits, reg); + tpm_generate (outfile, key_type, bits, genflags); } else if (HAVE_OPT(PUBKEY)) { @@ -157,15 +160,11 @@ cmd_parser (int argc, char **argv) gnutls_global_deinit (); } -static void tpm_generate(FILE* outfile, unsigned int key_type, unsigned int bits, int reg) +static void tpm_generate(FILE* outfile, unsigned int key_type, unsigned int bits, unsigned int flags) { int ret; char* srk_pass, *key_pass; gnutls_datum_t privkey, pubkey; - unsigned int flags = 0; - - if (reg) - flags |= GNUTLS_TPM_REGISTER_KEY; srk_pass = getpass ("Enter SRK password: "); if (srk_pass != NULL) |