Closed emmanuel-deloget closed 6 years ago
@emmanuel-deloget agreed. It used to be even worse, there have been some work to make the options more consistent, as an example:
cd3a1c72b278 tpm2_create: rename options for public and sensitive portions of the object 634ea6a795e5 tpm2_createprimary: add attribute support
Since there are a lot of tools and options, sometime is hard to be consistent though. For example -H
is --hierarchy
for most tools, but some tools use -H
has --handle
. So if a tool gets both a hierarchy and a handle you have to make a compromise.
But yes, we should try to be as consistent as possible to avoid confusing users.
@martinezjavier honestly, this is a proposal, as I don't have much idea on how to correctly achieve that. There are a few change I can make (alg --> algorithm, password --> passwd, and a few other obvious fixes) but this is the tip of the iceberg (the iceberg itself is not that big).
@emmanuel-deloget yes, whatever change you may do is always welcomed. The more consistent the options, the better for users.
With the hereby mentionned commits, the following changes occurs.
I did not changed the short option names right now, as this is more difficult (and may have more impact on real world scripts).
@@ -1,4 +1,3 @@
-"--output" 'o' tools/tpm2_send.c
"Hierachy" 'H' tools/tpm2_loadexternal.c
"Password" 'P' tools/tpm2_activatecredential.c
"SSL-NO-VERIFY" 'U' tools/tpm2_getmanufec.c
@@ -7,10 +6,10 @@
"ak-handle" 'k' tools/tpm2_quote.c
"ak-name" 'n' tools/tpm2_getpubak.c
"ak-passwd" 'P' tools/tpm2_getpubak.c
-"ak-password" 'P' tools/tpm2_quote.c
-"alg" 'g' tools/tpm2_getmanufec.c
-"alg" 'g' tools/tpm2_getpubak.c
-"alg" 'g' tools/tpm2_getpubek.c
+"ak-passwd" 'P' tools/tpm2_quote.c
+"algorithm" 'g' tools/tpm2_getmanufec.c
+"algorithm" 'g' tools/tpm2_getpubak.c
+"algorithm" 'g' tools/tpm2_getpubek.c
"algorithm" 'g' tools/tpm2_hmac.c
"algorithm" 'g' tools/tpm2_pcrlist.c
"algorithm" 'g' tools/tpm2_quote.c
@@ -75,8 +74,8 @@
"handle-passwd" 'P' tools/tpm2_nvrelease.c
"handle-passwd" 'P' tools/tpm2_nvwrite.c
"help" 'h' tools/tpm2_getpubek.c
-"hierachy" 'H' tools/tpm2_hash.c
"hierarchy" 'H' tools/tpm2_createprimary.c
+"hierarchy" 'H' tools/tpm2_hash.c
"id-list" 'l' tools/tpm2_quote.c
"import-key-private" 'r' tools/tpm2_import.c
"import-key-public" 'q' tools/tpm2_import.c
@@ -132,14 +131,14 @@
"key-handle" 'k' tools/tpm2_sign.c
"key-handle" 'k' tools/tpm2_verifysignature.c
"loaded-session" 'l' tools/tpm2_flushcontext.c
-"lock-passwd" 'l' tools/tpm2_changeauth.c
+"lockout-passwd" 'L' tools/tpm2_clear.c
"lockout-passwd" 'P' tools/tpm2_dictionarylockout.c
-"lockout-password" 'L' tools/tpm2_clear.c
+"lockout-passwd" 'l' tools/tpm2_changeauth.c
"lockout-recovery-time" 'l' tools/tpm2_dictionarylockout.c
"max-tries" 'n' tools/tpm2_dictionarylockout.c
"message" 'm' tools/tpm2_quote.c
-"msg" 'm' tools/tpm2_sign.c
-"msg" 'm' tools/tpm2_verifysignature.c
+"message" 'm' tools/tpm2_sign.c
+"message" 'm' tools/tpm2_verifysignature.c
"name" 'n' tools/tpm2_load.c
"name" 'n' tools/tpm2_makecredential.c
"non-persistent" 'N' tools/tpm2_getmanufec.c
@@ -152,22 +151,23 @@
"offline" 'O' tools/tpm2_getmanufec.c
"offset" 'o' tools/tpm2_nvread.c
"offset" 'o' tools/tpm2_nvwrite.c
-"oldEndorsePasswd" 'E' tools/tpm2_changeauth.c
-"oldLockPasswd" 'L' tools/tpm2_changeauth.c
-"oldOwnerPasswd" 'O' tools/tpm2_changeauth.c
-"opu" 'o' tools/tpm2_readpublic.c
+"old-endorse-passwd" 'E' tools/tpm2_changeauth.c
+"old-ockout-passwd" 'L' tools/tpm2_changeauth.c
+"old-owner-passwd" 'O' tools/tpm2_changeauth.c
+"out-file" 'f' tools/tpm2_getmanufec.c
+"out-file" 'f' tools/tpm2_nvread.c
"out-file" 'o' tools/tpm2_activatecredential.c
"out-file" 'o' tools/tpm2_encryptdecrypt.c
+"out-file" 'o' tools/tpm2_getrandom.c
+"out-file" 'o' tools/tpm2_hash.c
+"out-file" 'o' tools/tpm2_hmac.c
"out-file" 'o' tools/tpm2_makecredential.c
+"out-file" 'o' tools/tpm2_pcrlist.c
+"out-file" 'o' tools/tpm2_readpublic.c
"out-file" 'o' tools/tpm2_rsadecrypt.c
"out-file" 'o' tools/tpm2_rsaencrypt.c
-"outfile" 'o' tools/tpm2_hash.c
-"outfile" 'o' tools/tpm2_hmac.c
-"outfile" 'o' tools/tpm2_unseal.c
-"output" 'f' tools/tpm2_getmanufec.c
-"output" 'f' tools/tpm2_nvread.c
-"output" 'o' tools/tpm2_getrandom.c
-"output" 'o' tools/tpm2_pcrlist.c
+"out-file" 'o' tools/tpm2_send.c
+"out-file" 'o' tools/tpm2_unseal.c
"owner-passwd" 'o' tools/tpm2_changeauth.c
"owner-passwd" 'o' tools/tpm2_getmanufec.c
"owner-passwd" 'o' tools/tpm2_getpubak.c
@@ -176,10 +176,10 @@
"parent" 'H' tools/tpm2_load.c
"parent-key-handle" 'H' tools/tpm2_import.c
"parent-key-public" 'f' tools/tpm2_import.c
+"passwd" 'P' tools/tpm2_pcrevent.c
"passwdInHex" 'X' tools/tpm2_activatecredential.c
"passwdInHex" 'X' tools/tpm2_nvdefine.c
"passwdInHex" 'X' tools/tpm2_nvreadlock.c
-"password" 'P' tools/tpm2_pcrevent.c
"pcr-index" 'i' tools/tpm2_pcrevent.c
"pcr-input-file" 'F' tools/tpm2_createpolicy.c
"pcr-input-file" 'F' tools/tpm2_nvread.c
There are multiple cases in the code where a similar option on two different tools are named differently. For example, the long name of option -g (alg) in tpm2_getpubek.c is "alg", where the same option tpm2_hmac.c is named "algorithm". Similarly, option in-file is -I in most tools, and -f in tpm2_activatecredential.
Here is the output of a (rather convoluted) command
grep -rHn -- '{[[:space:]]*"[a-zA-Z0-9_-]\+"' tools/* | awk -F ':' '{ print $1 " --- " $3 }' | sed 's/[[:space:]]*//;s/{"/{ "/;s/,/ /g;s/}/ }/g;s/[[:space:]]\+/ /g' | awk '{ printf("%-30s %-6s %s\n",$4,$7,$1); }' | LANG=C sort
It shows what should be all options used within the various tools (minus those defined in the private library).
Best regards,
-- Emmanuel Deloget