summaryrefslogtreecommitdiffstats
path: root/sbin/gbde
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-12-18 22:11:54 +0000
committerphk <phk@FreeBSD.org>2002-12-18 22:11:54 +0000
commit790740dde56a2f5e62e3aa9f1c92ee9f984d67ec (patch)
treed0aa5e275286cd1f865f71c45bcd5a3800c77614 /sbin/gbde
parente0fc35ab9aa517617491628d564a722738f28920 (diff)
downloadFreeBSD-src-790740dde56a2f5e62e3aa9f1c92ee9f984d67ec.zip
FreeBSD-src-790740dde56a2f5e62e3aa9f1c92ee9f984d67ec.tar.gz
Solve another bug in the mapping code: correctly skip lock sectors.
Make sure sector zero is protected if it contains metadata. Lower WARNS for gbde to 3 on non-i386 archs. rijndael-fst is evil but appearntly does the right thing and passes the test-vectors. MFC Candidate.
Diffstat (limited to 'sbin/gbde')
-rw-r--r--sbin/gbde/Makefile6
-rw-r--r--sbin/gbde/gbde.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/sbin/gbde/Makefile b/sbin/gbde/Makefile
index 58a992e..368edd9 100644
--- a/sbin/gbde/Makefile
+++ b/sbin/gbde/Makefile
@@ -8,7 +8,13 @@ SRCS+= rijndael-api-fst.c
SRCS+= sha2.c
SRCS+= g_bde_lock.c
+# rijndael-fst.c does evil casting things which results in warnings on
+# 64 bit machines, the test-vectors check out however, so it works right.
+.if ${MACHINE_ARCH} == "i386"
WARNS?= 5
+.else
+WARNS?= 3
+.endif
CFLAGS+= -I${.CURDIR}/../../sys
.PATH: ${.CURDIR}/../../sys/geom \
diff --git a/sbin/gbde/gbde.c b/sbin/gbde/gbde.c
index 041d206..05344d3 100644
--- a/sbin/gbde/gbde.c
+++ b/sbin/gbde/gbde.c
@@ -541,7 +541,6 @@ cmd_init(struct g_bde_key *gl, int dfd, const char *f_opt, int i_opt, const char
if (!*p || *q)
errx(1, "first_sector not a proper number");
}
- gl->sector0 = first_sector * gl->sectorsize;
/* <last_sector> */
p = property_find(params, "last_sector");
@@ -571,6 +570,7 @@ cmd_init(struct g_bde_key *gl, int dfd, const char *f_opt, int i_opt, const char
total_sectors--;
gl->flags |= 1;
}
+ gl->sector0 = first_sector * gl->sectorsize;
if (total_sectors != (last_sector - first_sector) + 1)
errx(1, "total_sectors disagree with first_sector and last_sector");
OpenPOWER on IntegriCloud