Commit Graph

58 Commits

Author SHA1 Message Date
phk
a7b8d85b93 Interior decoration changes. 2003-10-07 09:28:07 +00:00
phk
bab9696ceb Correct bzero length so we clear the entire key structure. 2003-09-08 18:35:26 +00:00
phk
db461ec795 Bzero the right number of bytes.
Found by:	Juergen Buchmueller <pullmoll@stop1984.com>
2003-09-06 18:37:17 +00:00
phk
069191fcbf Simplify the GEOM OAM api: Drop the request type, and let everything
hinge on the "verb" parameter which the class gets to interpret as
it sees fit.

Move the entire request into the kernel and move changed parameters
back when done.
2003-06-01 13:47:51 +00:00
phk
ef00c86fce Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:28:53 +00:00
phk
48e54f8060 Don't use & in front of arrays.
Found by:       FlexeLint
2003-05-31 19:23:11 +00:00
phk
c48dbf1758 Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:08:23 +00:00
phk
e2298826ec Remove the G_CLASS_INITIALIZER, we do not need it anymore. 2003-05-31 16:59:27 +00:00
phk
3f2e0ad16d Re-order the the initialization slightly to improve structure. 2003-05-05 08:58:12 +00:00
phk
d6ece911bb Use a dedicated malloc(9) bucket for sector storage. 2003-05-05 08:37:07 +00:00
phk
d73072efd4 Considering that I did cast the arguments to (intmax_t) I must have
been sleepy since I used %qd instead of %jd.
2003-05-02 19:08:57 +00:00
phk
a43e2a0d8e Fix an obscure fencepost error in GBDE's sector mapping code:
For certain combinations of sectorsize, mediasize and random numbers
(used to define the mapping), a multisector read or write would ignore
some subset of the sectors past the first sector in the request because
those sectors would be mapped past the end of the parent device, and
normal "end of media" truncation would zap that part of the request.

Rev 1.19+1.20 of g_bde_work.c added the check which should have alerted
me to this happening.  This commit maps the request correctly and
adds KASSERTS to make sure things stay inside the parent device.

This does not change the on-disk layout of GBDE, there is no need to
backup/restore.
2003-04-29 19:46:42 +00:00
phk
df12452858 Typo in last commit: Do not press xZZ to leave vi(1). 2003-04-29 19:38:55 +00:00
phk
46e72efe59 When a bio comes back from below with a zero error code, check that
it wrote the full length.  The only case where this should be able
to happen is if we try to read/write past the end and the request
is truncated.  We obviously should never try to do that, so this
code should never activate.
2003-04-29 19:37:36 +00:00
phk
647f79f459 I accidentally leaked this debugging tool in with my last commit.
Disable it with a direct warning.
2003-04-28 17:57:12 +00:00
phk
1b6624b999 Rename g_bde_get_sector() to g_bde_get_keysector() and pick up the
offset from the work packet.
2003-04-28 06:38:31 +00:00
phk
1adaf3d22c Only attempt total cache-purge once in case of failure. 2003-04-28 06:19:41 +00:00
phk
5299f69145 Better criteria for skipping disk reading BIO_READ work packets. 2003-04-28 06:15:39 +00:00
phk
600f5cf898 Explicitly set the sector state to JUNK if we encounter a read-error. 2003-04-28 06:10:35 +00:00
phk
cd6350ca83 Bail as soon as the first write request has failed, there is no point
in trying the second write if the first one went nowhere.
2003-04-26 21:40:26 +00:00
phk
da80cf8fcc Appearantly UFS no longer issues BIO_DELETE requests correctly, and
consequently trashes data.  Disable BIO_DELETE handling in gbde for now.
2003-04-26 21:39:33 +00:00
phk
876e7e7a6d Do an explicit retry after we have dumped the cache, rather than a
(potential) tail recursion.
2003-04-25 21:43:11 +00:00
phk
82e4f296ff If on a BIO_READ request, we failed to allocate the bio for reading
our key-sector, we would end up returning the read without an error,
despite the fact that the data was not correctly decrypted.

This would result in data corruption on read, but intact data still
on the media.
2003-04-25 21:28:28 +00:00
phk
017246b9b8 Fix a problem and slightly improve the ENOMEM handling:
Give up the entire bio as soon as we detect a problem.

When we detect a problem, give up the bio by contributing the
remainder with ENOMEM, rather than kicking the bio back right
away.

If we failed on a non-first iteration we previously could end up
modifying fields in the bio after we delivered it.  This could
account for memory corruption (none directly reported) on machines
with GBDE.
2003-04-25 21:20:57 +00:00
phk
e2ee68d54b Don't count a sector in the cache unless we manage to create it. 2003-04-25 20:56:27 +00:00
phk
b2fdd2cc0f Rename g_bde_release_sector() to g_bde_release_keysector() and pick up
the sector from the work item.
2003-04-25 20:35:34 +00:00
phk
5b6422dcef Rename g_bde_read_sector() to g_bde_read_keysector() pick up the offset
in the work structure.
2003-04-25 20:16:59 +00:00
phk
cbe207a30e Remove all references to BIO_SETATTR. We will not be using it. 2003-04-03 19:19:36 +00:00
phk
34a3abe946 Use sys/endian.h instead of geom_enc.c for endian-agnostfication. 2003-04-03 11:33:51 +00:00
phk
85edc96041 Remove the old config interface now that the new OAM is functional. 2003-04-01 07:33:17 +00:00
phk
cdc67e7072 Add create_geom and destroy_geom methods. 2003-03-29 22:14:21 +00:00
phk
87ed6d02e4 Forward compatibility: NULL check the passed in meta argument. 2003-03-25 09:02:41 +00:00
phk
639a37daa0 Premptively change initializations of struct g_class to use C99
sparse struct initializations before we extend the struct with
new OAM related member functions.
2003-03-24 19:30:15 +00:00
phk
e059b79437 Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
phk
6471cae560 Limit our requests to DFLTPHYS, this is generally a good idea for
memory-allocation purposes.  Right now it is also a very good idea
because we hit a Giant assertion in the free(9) processing if we
free something larger than 64k.
2003-03-07 19:09:46 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
phk
dc511a8940 Typo in last commit. 2003-02-11 15:20:34 +00:00
phk
fd7ea6d48a Better names for struct disk elements: d_maxsize, d_stripeoffset
and d_stripesisze;

Introduce si_stripesize and si_stripeoffset in struct cdev so we
can make the visible to clustering code.

Add stripesize and stripeoffset to providers.

DTRT with stripesize and stripeoffset in various places in GEOM.
2003-02-11 14:57:34 +00:00
phk
a61961945a Unconditionally make our provider with G_PF_CANDELETE. 2003-02-11 12:37:04 +00:00
phk
04a4ba381f Move the g_stat struct to its own .h file, we will export it to other code.
Insted of embedding a struct g_stat in consumers and providers, merely
include a pointer.

Remove a couple of <sys/time.h> includes now unneeded.

Add a special allocator for struct g_stat.  This allocator will allocate
entire pages and hand out g_stat functions from there.  The "id" field
indicates free/used status.

Add "/dev/geom.stats" device driver whic exports the pages from the
allocator to userland with mmap(2) in read-only mode.

This mmap(2) interface should be considered a non-public interface and
the functions in libgeom (not yet committed) should be used to access
the statistics data.
2003-02-08 13:03:57 +00:00
phk
7a3625aca3 Add the new statistics structure, put one in consumers and providers.
include <sys/time.h> as necessary.
2003-02-07 21:43:34 +00:00
alfred
bf8e8a6e8f Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
phk
bc7a07d94c Optimize the size of the work-items by letting the mapping function
decide the largest size which stays inside the zone and does not
collide with a lock sector.
2003-01-02 19:29:49 +00:00
phk
790740dde5 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.
2002-12-18 22:11:54 +00:00
phk
761d063e80 Fix two blunders in the mapping functions which can lead to corrupt data,
for request sizes larger than the sectorsize or for multi-key setups.

See warning mailed to current@ for details of recovery.

Found by:	Marcus Reid <marcus@blazingdot.com>
2002-12-18 19:57:27 +00:00
phk
39fb253bb1 Fix spelling in comment. 2002-12-13 21:10:59 +00:00
phk
d2f5accf6d Conceiveably, there may exist an algorithm which can tell if a sequence of bytes
are the output of AES/128/CBC or ARC4RANDOM.  Encrypt the random data with which
we wipe when we get a BIO_DELETE to make such an algorithm useful.

Sponsored by:	DARPA & NAI Labs
Approved by:	re (blanket)
2002-12-01 15:50:48 +00:00
phk
2e45221c26 Use unsigned for an index.
Sponsored by:	DARPA & NAI Labs.
Approved by:	re (blanket).
2002-12-01 15:47:49 +00:00
phk
ad8a01f928 Straighten up the geom.ctl config interface definitions.
Sponsored by:	DARPA & NAI Labs
2002-11-06 20:05:15 +00:00
phk
16874ad923 Run a revision on the GBDE encryption facility.
Replace ARC4 with SHA2-512.
Change lock-structure encoding to use random ordering rather for obscurity.
Encrypt lock-structure with AES/256 instead of AES/128.
Change kkey derivation to be MD5 hash based.
Watch for malloc(M_NOWAIT) failures and ditch our cache when they happen.
Remove clause 3 of the license with NAI Labs consent.

Many thanks to "Lucky Green" <shamrock@cypherpunks.to> and "David
Wagner" <daw@cs.berkeley.edu>, for code reading, inputs and
suggestions.

This code has still not been stared at for 10 years by a gang of
hard-core cryptographers.  Discretion advised.

NB: These changes result in the on-disk format changing: dump/restore needed.

Sponsored by:   DARPA & NAI Labs.
2002-11-04 09:27:01 +00:00