Skip to content

Commit

Permalink
Fix SYNOPSIS & sync to usage()
Browse files Browse the repository at this point in the history
Also fix typo in getopt string.
  • Loading branch information
Thomas Nikolajsen authored and bwalex committed Jul 31, 2011
1 parent a2e0654 commit a0d7aa0
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 71 deletions.
73 changes: 42 additions & 31 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,52 +56,63 @@ void
usage(void)
{
fprintf(stderr,
"Usage: tcplay <command> [options]\n"
"Valid commands and its arguments are:\n"
"usage: tcplay -c -d device [-g] [-a pbkdb_hash] [-b cipher]\n"
" [-f keyfile_hidden] [-k keyfile] [-x pbkdf_hash] [-y cipher]\n"
" tcplay -i -d device [-e] [-f keyfile_hidden] [-k keyfile]\n"
" [-s system_devcie]\n"
" tcplay -m mapping -d device [-e] [-f keyfile_hidden] [-k keyfile]\n"
" [-s system_device]\n"
" tcplay -h | -v\n"
"\n"
"Valid commands are:\n"
" -c, --create\n"
"\t Creates a new TC volume on the device specified by -d or --device\n"
"\t Creates a new TC volume on the device specified by -d or --device.\n"
" -h, --help\n"
"\t Print help message and exit.\n"
" -i, --info\n"
"\t Gives information about the TC volume specified by -d or --device\n"
"\t Gives information about the TC volume specified by -d or --device.\n"
" -m <mapping name>, --map=<mapping name>\n"
"\t Creates a dm-crypt mapping with the given name for the device\n"
"\t specified by -d or --device\n"
"\t specified by -d or --device.\n"
" -v, --version\n"
"\t Print version message and exit.\n"
"\n"
"Valid options and its arguments for 'create' are:\n"
"Valid options for --create are:\n"
" -a <pbkdf prf algorithm>, --pbkdf-prf=<pbkdf prf algorithm>\n"
"\t specifies which hashing function to use for the PBKDF password\n"
"\t derivation when creating a new volume\n"
"\t To see valid options, specify -a help\n"
"\t Specifies which hashing function to use for the PBKDF password\n"
"\t derivation when creating a new volume.\n"
"\t To see valid options, specify '-a help'.\n"
" -b <cipher>, --cipher=<cipher>\n"
"\t specifies which cipher to use when creating a new TC volume\n"
"\t To see valid options, specify -b help\n"
"\t Specifies which cipher to use when creating a new TC volume.\n"
"\t To see valid options, specify '-b help'.\n"
" -g, --hidden\n"
"\t Specifies that the newly created volume will contain a hidden volume.\n"
" -x <pbkdf prf algorithm>, --pbkdf-prf=<pbkdf prf algorithm>\n"
"\t specifies which hashing function to use for the PBKDF password\n"
"\t derivation when creating a new hidden volume. By default, the\n"
"\t same as for the outer volume will be used\n"
"\t To see valid options, specify -a help\n"
"\t Specifies which hashing function to use for the PBKDF password\n"
"\t derivation when creating a new hidden volume. By default, the\n"
"\t same as for the outer volume will be used.\n"
"\t To see valid options, specify '-x help'.\n"
" -y <cipher>, --cipher=<cipher>\n"
"\t specifies which cipher to use when creating a new hidden volume.\n"
"\t By default, the same as for the outer volume will be used\n"
"\t To see valid options, specify -b help\n"
" -g, --hidden\n"
"\t specifies that the newly created volume will contain a hidden volume\n"
"\t Specifies which cipher to use when creating a new hidden volume.\n"
"\t By default, the same as for the outer volume will be used.\n"
"\t To see valid options, specify '-y help'.\n"
"\n"
"Valid options and its arguments for 'info' and 'map' are:\n"
"Valid options for --info and --map are:\n"
" -e, --protect-hidden\n"
"\t protect a hidden volume when mounting the outer volume\n"
"\t Protect a hidden volume when mounting the outer volume.\n"
" -s <disk path>, --system-encryption=<disk path>\n"
"\t specifies that the disk (e.g. /dev/da0) is using system encryption\n"
"\t Specifies that the disk (e.g. /dev/da0) is using system encryption.\n"
"\n"
"Valid options and its arguments common to all commands are:\n"
"Valid options common to all commands are:\n"
" -d <device path>, --device=<device path>\n"
"\t specifies the path to the volume to operate on (e.g. /dev/da0s1)\n"
" -k <key file>, --keyfile=<key file>\n"
"\t specifies a key file to use for the password derivation, can appear\n"
"\t multiple times\n"
"\t Specifies the path to the volume to operate on (e.g. /dev/da0s1).\n"
" -f <key file>, --keyfile-hidden=<key file>\n"
"\t specifies a key file to use for the hidden volume password derivation\n"
"\t Specifies a key file to use for the hidden volume password derivation.\n"
"\t This option is only valid in combination with -e, --protect-hidden\n"
"\t or -g, --hidden\n"
"\t or -g, --hidden.\n"
" -k <key file>, --keyfile=<key file>\n"
"\t Specifies a key file to use for the password derivation, can appear\n"
"\t multiple times.\n"
);

exit(1);
Expand Down Expand Up @@ -154,7 +165,7 @@ main(int argc, char *argv[])
nkeyfiles = 0;
n_hkeyfiles = 0;

while ((ch = getopt_long(argc, argv, "a:b:cd:efgh:ik:m:s:vx:y:",
while ((ch = getopt_long(argc, argv, "a:b:cd:ef:ghik:m:s:vx:y:",
longopts, NULL)) != -1) {
switch(ch) {
case 'a':
Expand Down
89 changes: 49 additions & 40 deletions tcplay.8
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,26 @@
.Op Fl g
.Op Fl a Ar pbkdf_hash
.Op Fl b Ar cipher
.Op Fl k Ar keyfile
.Op Fl f Ar keyfile_hidden
.Op Fl k Ar keyfile
.Op Fl x Ar pbkdf_hash
.Op Fl y Ar cipher
.Nm
.Fl i
.Fl d Ar device
.Op Fl e
.Op Fl f Ar keyfile_hidden
.Op Fl k Ar keyfile
.Op Fl s Ar system_device
.Nm
.Fl m Ar mapping
.Fl d Ar device
.Op Fl e
.Op Fl f Ar keyfile_hidden
.Op Fl k Ar keyfile
.Op Fl s Ar system_device
.Nm
.Fl h | v
.Sh DESCRIPTION
The
.Nm
Expand All @@ -66,6 +74,8 @@ detailed further below:
Create a new encrypted TrueCrypt volume on the device
specified by
.Fl -device .
.It Fl h, Fl -help
Print help message and exit.
.It Fl i , Fl -info
Print out information about the encrypted device specified by
.Fl -device .
Expand All @@ -76,6 +86,8 @@ as a
.Xr dm 4
mapping called
.Ar mapping .
.It Fl v, Fl -version
Print version message and exit.
.El
.Pp
Options common to all commands are:
Expand All @@ -85,15 +97,8 @@ Specifies the disk
.Ar device
on which the TrueCrypt volume resides/will reside.
This option is mandatory for all commands.
.It Fl k Ar keyfile , Fl -keyfile Ns = Ns Ar keyfile
Specifies a
.Ar keyfile
to use in addition to the passphrase.
This option can appear multiple times; if so, multiple
keyfiles will be used.
.It Fl f Ar keyfile , Fl -keyfile-hidden Ns = Ns Ar keyfile
Specifies a
.Ar keyfile
.It Fl f Ar keyfile_hidden , Fl -keyfile-hidden Ns = Ns Ar keyfile_hidden
Specifies a keyfile
to use in addition to the passphrase when either creating a
hidden volume or when protecting a hidden volume while mapping
or querying the outer volume.
Expand All @@ -102,48 +107,54 @@ If you only intend to map a hidden volume, the
option has to be used.
This option can appear multiple times; if so, multiple
keyfiles will be used.
.It Fl k Ar keyfile , Fl -keyfile Ns = Ns Ar keyfile
Specifies a
.Ar keyfile
to use in addition to the passphrase.
This option can appear multiple times; if so, multiple
keyfiles will be used.
.El
.Pp
Additional options for the
.Fl -create
command are:
.Bl -tag -width indent
.It Fl a Ar pbkdf_hash , Fl -pbkdf-prf Ns = Ns Ar pbkdf_hash
Specifies with hash algorithm to use for the PBKDF2 password
Specifies which hash algorithm to use for the PBKDF2 password
derivation.
To see which algorithms are supported, specify
.Fl -pbkdf-prf Ns = Ns Ar help .
.Fl -pbkdf-prf Ns = Ns Cm help .
.It Fl b Ar cipher , Fl -cipher Ns = Ns Ar cipher
Specifies with cipher algorithm or cascade of ciphers to use
Specifies which cipher algorithm or cascade of ciphers to use
to encrypt the new volume.
To see which algorithms are supported, specify
.Fl -cipher Ns = Ns Ar help .
.Fl -cipher Ns = Ns Cm help .
.It Fl g, Fl -hidden
Specifies that the newly created volume will contain a hidden
volume.
The keyfiles applied to the passphrase for the hidden
volume are those specified by
.Fl -keyfile-hidden .
The user will be prompted for the size of the hidden volume
interactively.
.It Fl x Ar pbkdf_hash , Fl -pbkdf-prf-hidden Ns = Ns Ar pbkdf_hash
Specifies with hash algorithm to use for the PBKDF2 password
Specifies which hash algorithm to use for the PBKDF2 password
derivation for the hidden volume.
Only valid in conjunction with
.Fl -hidden .
If no algorithm is specified, the same as for the outer volume
will be used.
To see which algorithms are supported, specify
.Fl -pbkdf-prf-hidden Ns = Ns Ar help .
.Fl -pbkdf-prf-hidden Ns = Ns Cm help .
.It Fl y Ar cipher , Fl -cipher-hidden Ns = Ns Ar cipher
Specifies with cipher algorithm or cascade of ciphers to use
Specifies which cipher algorithm or cascade of ciphers to use
to encrypt the hidden volume on the new TrueCrypt volume.
Only valid in conjunction with
.Fl -hidden .
If no cipher is specified, the same as for the outer volume
will be used.
To see which algorithms are supported, specify
.Fl -cipher-hidden Ns = Ns Ar help .
.It Fl g, Fl -hidden
Specifies that the newly created volume will contain a hidden
volume.
The keyfiles applied to the passphrase for the hidden
volume are those specified by
.Fl -keyfile-hidden .
The user will be prompted for the size of the hidden volume
interactively.
.Fl -cipher-hidden Ns = Ns Cm help .
.El
.Pp
Additional options for the
Expand All @@ -158,8 +169,7 @@ its reported size will be adjusted accordingly to the size of
the hidden volume contained in it.
Both the hidden volume and outer volume passphrase and keyfiles
will be required.
.It Fl s Ar system_device , Fl -system-encryption Ns = Ns Ar
system_device
.It Fl s Ar system_device , Fl -system-encryption Ns = Ns Ar system_device
This option is required if you are attempting to access a device
that uses system encryption, for example an encrypted
.Tn Windows
Expand All @@ -182,11 +192,11 @@ and
.Pa two.key :
.Bd -ragged -offset indent
.Nm Fl -create
.Fl -device Ns = Ns Ar /dev/vn0
.Fl -cipher Ns = Ns Ar AES-256-XTS,TWOFISH-256-XTS
.Fl -pbkdf-prf Ns = Ns Ar whirlpool
.Fl -keyfile Ns = Ns Ar one.key
.Fl -keyfile Ns = Ns Ar two.key
.Fl -device Ns = Ns Cm /dev/vn0
.Fl -cipher Ns = Ns Cm AES-256-XTS,TWOFISH-256-XTS
.Fl -pbkdf-prf Ns = Ns Cm whirlpool
.Fl -keyfile Ns = Ns Cm one.key
.Fl -keyfile Ns = Ns Cm two.key
.Ed
.Pp
Map the outer volume on the TrueCrypt volume on
Expand All @@ -197,10 +207,10 @@ but protect the hidden volume, using the keyfile
.Pa hidden.key ,
from being overwritten:
.Bd -ragged -offset indent
.Nm Fl -map Ns = Ns Ar truecrypt1
.Fl -device Ns = Ns Ar /dev/vn0
.Nm Fl -map Ns = Ns Cm truecrypt1
.Fl -device Ns = Ns Cm /dev/vn0
.Fl -protect-hidden
.Fl -keyfile-hidden Ns = Ns Ar hidden.key
.Fl -keyfile-hidden Ns = Ns Cm hidden.key
.Ed
.Pp
Map the hidden volume on the TrueCrypt volume on
Expand All @@ -210,9 +220,9 @@ as
using the keyfile
.Pa hidden.key :
.Bd -ragged -offset indent
.Nm Fl -map Ns = Ns Ar truecrypt2
.Fl -device Ns = Ns Ar /dev/vn0
.Fl -keyfile Ns = Ns Ar hidden.key
.Nm Fl -map Ns = Ns Cm truecrypt2
.Fl -device Ns = Ns Cm /dev/vn0
.Fl -keyfile Ns = Ns Cm hidden.key
.Ed
.Sh SEE ALSO
.Xr crypttab 5 ,
Expand All @@ -224,4 +234,3 @@ utility appeared in
.Dx 2.11 .
.Sh AUTHORS
.An Alex Hornung

0 comments on commit a0d7aa0

Please sign in to comment.