mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-21 18:50:50 +01:00
Remove gbde support from swapon(8)
This commit is contained in:
parent
eef9887871
commit
14b475c479
@ -61,7 +61,6 @@
|
||||
#define _PATH_FIRMWARE "/usr/share/firmware"
|
||||
#define _PATH_FTPUSERS "/etc/ftpusers"
|
||||
#define _PATH_FWMEM "/dev/fwmem"
|
||||
#define _PATH_GBDE "/sbin/gbde"
|
||||
#define _PATH_GELI "/sbin/geli"
|
||||
#define _PATH_HALT "/sbin/halt"
|
||||
#ifdef COMPAT_libcompat
|
||||
|
@ -56,7 +56,6 @@
|
||||
|
||||
static void usage(void) __dead2;
|
||||
static const char *swap_on_off(const char *, int, char *);
|
||||
static const char *swap_on_off_gbde(const char *, int);
|
||||
static const char *swap_on_off_geli(const char *, char *, int);
|
||||
static const char *swap_on_off_md(const char *, char *, int);
|
||||
static const char *swap_on_off_sfile(const char *, int);
|
||||
@ -238,12 +237,6 @@ swap_on_off(const char *name, int doingall, char *mntops)
|
||||
basebuf = strdup(name);
|
||||
base = basename(basebuf);
|
||||
|
||||
/* Swap on encrypted device by GEOM_BDE. */
|
||||
if (fnmatch("*.bde", base, 0) == 0) {
|
||||
free(basebuf);
|
||||
return (swap_on_off_gbde(name, doingall));
|
||||
}
|
||||
|
||||
/* Swap on encrypted device by GEOM_ELI. */
|
||||
if (fnmatch("*.eli", base, 0) == 0) {
|
||||
free(basebuf);
|
||||
@ -269,59 +262,6 @@ swap_basename(const char *name)
|
||||
return (dname);
|
||||
}
|
||||
|
||||
static const char *
|
||||
swap_on_off_gbde(const char *name, int doingall)
|
||||
{
|
||||
const char *ret;
|
||||
char pass[64 * 2 + 1];
|
||||
unsigned char bpass[64];
|
||||
char *dname;
|
||||
int i, error;
|
||||
|
||||
dname = swap_basename(name);
|
||||
if (dname == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (which_prog == SWAPON) {
|
||||
arc4random_buf(bpass, sizeof(bpass));
|
||||
for (i = 0; i < (int)sizeof(bpass); i++)
|
||||
sprintf(&pass[2 * i], "%02x", bpass[i]);
|
||||
pass[sizeof(pass) - 1] = '\0';
|
||||
|
||||
error = run_cmd(NULL, "%s init %s -P %s", _PATH_GBDE,
|
||||
dname, pass);
|
||||
if (error) {
|
||||
/* bde device found. Ignore it. */
|
||||
free(dname);
|
||||
if (qflag == 0)
|
||||
warnx("%s: Device already in use", name);
|
||||
return (NULL);
|
||||
}
|
||||
error = run_cmd(NULL, "%s attach %s -p %s", _PATH_GBDE,
|
||||
dname, pass);
|
||||
free(dname);
|
||||
if (error) {
|
||||
warnx("gbde (attach) error: %s", name);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
ret = swap_on_off_sfile(name, doingall);
|
||||
|
||||
if (which_prog == SWAPOFF) {
|
||||
error = run_cmd(NULL, "%s detach %s", _PATH_GBDE, dname);
|
||||
free(dname);
|
||||
if (error) {
|
||||
/* bde device not found. Ignore it. */
|
||||
if (qflag == 0)
|
||||
warnx("%s: Device not found", name);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* Build geli(8) arguments from mntops */
|
||||
static char *
|
||||
swap_on_geli_args(const char *mntops)
|
||||
|
@ -423,10 +423,9 @@ resides in
|
||||
# Swap space on a block device.
|
||||
/dev/da0p1 none swap sw 0 0
|
||||
#
|
||||
# Swap space using a block device with GBDE/GELI encryption.
|
||||
# Swap space using a block device with GELI encryption.
|
||||
# aalgo, ealgo, keylen, sectorsize options are available
|
||||
# for .eli devices.
|
||||
/dev/da1p1.bde none swap sw 0 0
|
||||
/dev/da1p2.eli none swap sw 0 0
|
||||
#
|
||||
# tmpfs.
|
||||
|
Loading…
Reference in New Issue
Block a user