summaryrefslogtreecommitdiffstats
path: root/sbin/gbde
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-02-12 21:47:05 +0000
committerru <ru@FreeBSD.org>2005-02-12 21:47:05 +0000
commitf4d1c5e662054341e1decef2a481d05c96dd556a (patch)
tree763e46388ea3e9bf408325eedd427749bbb8cace /sbin/gbde
parent2bebe00e4309269f720ee56533cd77256cb7673d (diff)
downloadFreeBSD-src-f4d1c5e662054341e1decef2a481d05c96dd556a.zip
FreeBSD-src-f4d1c5e662054341e1decef2a481d05c96dd556a.tar.gz
- Fixed description of the "destroy" command options.
- Document the "nuke" command. - Mention which commands correspond to which functions.
Diffstat (limited to 'sbin/gbde')
-rw-r--r--sbin/gbde/gbde.837
-rw-r--r--sbin/gbde/gbde.c36
2 files changed, 45 insertions, 28 deletions
diff --git a/sbin/gbde/gbde.8 b/sbin/gbde/gbde.8
index 57208b5..fe3d55d 100644
--- a/sbin/gbde/gbde.8
+++ b/sbin/gbde/gbde.8
@@ -31,7 +31,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 19, 2002
+.Dd February 12, 2005
.Dt GBDE 8
.Os
.Sh NAME
@@ -51,8 +51,8 @@
.Ar destination
.Op Fl i
.Op Fl f Ar filename
-.Op Fl L Ar lockfile
-.Op Fl P Ar pass-phrase
+.Op Fl L Ar new-lockfile
+.Op Fl P Ar new-pass-phrase
.Nm
.Cm setkey
.Ar destination
@@ -62,12 +62,16 @@
.Op Fl L Ar new-lockfile
.Op Fl P Ar new-pass-phrase
.Nm
-.Cm destroy
+.Cm nuke
.Ar destination
.Op Fl n Ar key
.Op Fl l Ar lockfile
.Op Fl p Ar pass-phrase
-.Op Fl L Ar lockfile
+.Nm
+.Cm destroy
+.Ar destination
+.Op Fl l Ar lockfile
+.Op Fl p Ar pass-phrase
.Sh DESCRIPTION
.Bf -symbolic
NOTICE:
@@ -97,12 +101,21 @@ The operational aspect consists of two subcommands:
one to open and attach
a device to the in-kernel cryptographic
.Nm
-module,
-and one to close and detach a device.
+module
+.Pq Cm attach ,
+and one to close and detach a device
+.Pq Cm detach .
.Pp
The management part allows initialization of the master key and lock sectors
-on a device, initialization and replacement of pass-phrases and
-key invalidation and blackening functions.
+on a device
+.Pq Cm init ,
+initialization and replacement of pass-phrases
+.Pq Cm setkey ,
+and key invalidation
+.Pq Cm nuke
+and blackening
+.Pq Cm destroy
+functions.
.Pp
The
.Fl l Ar lockfile
@@ -114,7 +127,11 @@ option is specified, the first sector is used for this purpose.
The
.Fl L Ar new-lockfile
argument
-specifies the lock selector file for the key modified with the
+specifies the lock selector file for the key
+initialized with the
+.Cm init
+subcommand
+or modified with the
.Cm setkey
subcommand.
.Pp
diff --git a/sbin/gbde/gbde.c b/sbin/gbde/gbde.c
index f2c3c3e..39ba935 100644
--- a/sbin/gbde/gbde.c
+++ b/sbin/gbde/gbde.c
@@ -130,19 +130,19 @@ g_hexdump(void *ptr, int length)
#endif
static void __dead2
-usage(const char *reason)
+usage(void)
{
- const char *p;
- p = getprogname();
- fprintf(stderr, "Usage error: %s", reason);
- fprintf(stderr, "Usage:\n");
- fprintf(stderr, "\t%s attach dest [-l lockfile] [-p pass-phrase]\n", p);
- fprintf(stderr, "\t%s detach dest\n", p);
- fprintf(stderr, "\t%s init /dev/dest [-i] [-f filename] [-L lockfile] [-P pass-phrase]\n", p);
- fprintf(stderr, "\t%s setkey dest [-n key] [-l lockfile] [-p pass-phrase] [-L new-lockfile] [-P new-pass-phrase]\n", p);
- fprintf(stderr, "\t%s destroy dest [-n key] [-l lockfile] [-p pass-phrase] [-L lockfile]\n", p);
- exit (1);
+ (void)fprintf(stderr,
+"usage: gbde attach destination [-l lockfile] [-p pass-phrase]\n"
+" gbde detach destination\n"
+" gbde init destination [-i] [-f filename] [-L new-lockfile]\n"
+" [-P new-pass-phrase]\n"
+" gbde setkey destination [-n key] [-l lockfile] [-p pass-phrase]\n"
+" [-L new-lockfile] [-P new-pass-phrase]\n"
+" gbde nuke destination [-n key] [-l lockfile] [-p pass-phrase]\n"
+" gbde destroy destination [-l lockfile] [-p pass-phrase]\n");
+ exit(1);
}
void *
@@ -720,12 +720,12 @@ main(int argc, char **argv)
struct g_bde_softc sc;
if (argc < 3)
- usage("Too few arguments\n");
+ usage();
if ((i = modfind("g_bde")) < 0) {
/* need to load the gbde module */
if (kldload(GBDEMOD) < 0 || modfind("g_bde") < 0)
- usage(GBDEMOD ": Kernel module not available\n");
+ err(1, GBDEMOD ": Kernel module not available");
}
doopen = 0;
if (!strcmp(argv[1], "attach")) {
@@ -751,7 +751,7 @@ main(int argc, char **argv)
doopen = 1;
opts = "l:n:p:";
} else {
- usage("Unknown sub command\n");
+ usage();
}
argc--;
argv++;
@@ -784,9 +784,9 @@ main(int argc, char **argv)
case 'n':
n_opt = strtoul(optarg, &q, 0);
if (!*optarg || *q)
- usage("-n argument not numeric\n");
+ errx(1, "-n argument not numeric");
if (n_opt < -1 || n_opt > G_BDE_MAXKEYS)
- usage("-n argument out of range\n");
+ errx(1, "-n argument out of range");
break;
case 'p':
p_opt = optarg;
@@ -795,7 +795,7 @@ main(int argc, char **argv)
P_opt = optarg;
break;
default:
- usage("Invalid option\n");
+ usage();
}
if (doopen) {
@@ -858,7 +858,7 @@ main(int argc, char **argv)
}
break;
default:
- usage("Internal error\n");
+ errx(1, "internal error");
}
return(0);
OpenPOWER on IntegriCloud