Commit Graph

16 Commits

Author SHA1 Message Date
Poul-Henning Kamp
035694b29a Better criteria for skipping disk reading BIO_READ work packets. 2003-04-28 06:15:39 +00:00
Poul-Henning Kamp
d8e7c92c9e Explicitly set the sector state to JUNK if we encounter a read-error. 2003-04-28 06:10:35 +00:00
Poul-Henning Kamp
c08c56e02a 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
Poul-Henning Kamp
9b99e39d61 Do an explicit retry after we have dumped the cache, rather than a
(potential) tail recursion.
2003-04-25 21:43:11 +00:00
Poul-Henning Kamp
e8e0742ef4 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
Poul-Henning Kamp
37f5e4a6c2 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
Poul-Henning Kamp
af6b9f17f9 Don't count a sector in the cache unless we manage to create it. 2003-04-25 20:56:27 +00:00
Poul-Henning Kamp
f2314b445d 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
Poul-Henning Kamp
195d573278 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
Poul-Henning Kamp
b4b138c27f 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
Poul-Henning Kamp
4ec353005c 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
Poul-Henning Kamp
acb161b16f 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
Poul-Henning Kamp
88806cc28c 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
Poul-Henning Kamp
5afa461402 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
Poul-Henning Kamp
87d4861cc5 Be consistent about functions being static.
Spotted by:	FlexeLint
2002-10-20 14:30:28 +00:00
Poul-Henning Kamp
19b5c7bc4b Add Geom Based Disk Encryption to the tree.
This is an encryption module designed for to secure denial of access
to the contents of "cold disks" with or without destruction activation.

Major features:

   * Based on AES, MD5 and ARC4 algorithms.
   * Four cryptographic barriers:
        1) Pass-phrase encrypts the master key.
        2) Pass-phrase + Lock data locates master key.
        3) 128 bit key derived from 2048 bit master key protects sector key.
        3) 128 bit random single-use sector keys protect data payload.
   * Up to four different changeable pass-phrases.
   * Blackening feature for provable destruction of master key material.
   * Isotropic disk contents offers no information about sector contents.
   * Configurable destination sector range allows steganographic deployment.

This commit adds the kernel part, separate commits will follow for the
userland utility and documentation.

This software was developed for the FreeBSD Project by Poul-Henning Kamp and
NAI Labs, the Security Research Division of Network Associates, Inc.  under
DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
research program.

Many thanks to Robert Watson, CBOSS Principal Investigator for making this
possible.

Sponsored by:   DARPA & NAI Labs.
2002-10-19 17:02:17 +00:00