Commit Graph

22 Commits

Author SHA1 Message Date
riastradh 920e28df65 cgdconfig(8): Add support for shared keys.
New clause `shared <id> algorithm <alg> subkey <info>' in a keygen
block enables `cgdconfig -C' to reuse a key between different params
files, so you can, e.g., use a single password for multiple disks.
This is better than simply caching the password itself because:

- Hashing the password is expensive, so it should only be done once.

  Suppose your budget is time t before you get bored, and you
  calibrate password hash parameters to unlock n disks before you get
  bored waiting for `cgdconfig -C'.

  . With n password hashings the adversary's cost goes up only by a
    factor of t/n.
  . With one password hashing and n subkeys the adversary's cost goes
    up by a factor of n.

  And if you ever add a disk, rehashing it will make `cgdconfig -C'
  go over budget, whereas another subkey adds negligible cost to you.

- Subkeys work for other types of keygen blocks, like shell_cmd,
  which could be used to get a key from a hardware token that needs a
  button press.

The <info> parameter must be different for each params file;
everything else in the keygen block must be the same.  With this
clause, the keygen block determines a shared key used only to derive
keys; the actual key used by cgdconfig is derived from the shared key
by the specified algorithm.

The only supported algorithm is hkdf-hmac-sha256, which uses
HKDF-Expand of RFC 5869 instantiated with SHA-256.

Example:

	algorithm aes-cbc;
	iv-method encblkno1;
	keylength 128;
	verify_method none;
	keygen pkcs5_pbkdf2/sha1 {
		iterations 39361;
		salt AAAAgMoHiYonye6KogdYJAobCHE=;
		shared "pw" algorithm hkdf-hmac-sha256
		    subkey AAAAgFlw0BMQ5gY+haYkZ6JC+yY=;
	};

The key used for this disk will be derived by

	HKDF-HMAC-SHA256_k(WXDQExDmBj6FpiRnokL7Jg==),

where k is the outcome of PBKDF2-SHA1 with the given parameters.

Note that <info> encodes a four-byte prefix giving the big-endian
length in bits of the info argument to HKDF, just like all other bit
strings in cgdconfig parameters files.

If you have multiple disks configured using the same keygen block
except for the info parameter, `cgdconfig -C' will only prompt once
for your passphrase, generate a shared key k with PBKDF2 as usual,
and then reuse it for each of the disks.
2022-08-12 10:49:17 +00:00
christos 7a3aa8fc03 Use the Makefile.inc from libargon2 (fixes the vax build that requires
a compiler hack).
2022-05-17 18:56:29 +00:00
christos b5df3bed15 make things behave just like before the libcrypt symbol renaming:
The normal cgdconfig binary is built with threads and the crunched one
in rescue without.
2022-05-16 14:57:44 +00:00
christos 0afca0c76d Re-enable threads; apparently we get different results depending if we are
threaded or not... This tastes like a bug.
2022-05-16 10:44:06 +00:00
christos f3c3951664 Build argon2 inline so that crunched programs work. I also disabled threads
for now; we can put them back if needed.
2022-05-15 19:53:27 +00:00
christos ccce93efc8 -lpthread to LDADD (fixes lint build) 2021-11-28 02:01:30 +00:00
nia 1569bcc0b3 cgdconfig(8): Add an argon2id password-based key generation method
This provides an extra level of side-channel and cracking resistance
compared to the pre-existing pkcs5_pbkdf2/sha1 method used for
password-based disk encryption.

Several new keygen parameters are supported:

	memory (integer, in kilobytes)
	parallelism (integer, usually the number of CPU cores)
	version (integer, usually 19...)

We do our best to calibrate these automatically when the paramsfile
is initially generated.

lgtm riastradh@
2021-11-22 14:34:35 +00:00
christos 55b06df259 replace openssl HMAC(3) with our hmac(3). 2016-07-01 22:50:09 +00:00
pooka 5f732a29cb Convert from the oldstyle cgd_kops.op_open to the newstyle prog_open
and define RUMPPRG.  Get rid of the Makefile.inc stuff, since it was
useful only for the oldstyle regime.
2010-12-14 17:46:21 +00:00
pooka eb2ef0c632 Use RUMP_ACTION to avoid having to specify the same information
in the Makefiles of all the consumers.
2009-12-19 15:03:34 +00:00
pooka 7ae6c0a6f6 * allow specification of kernel operations vector
* make it possible to build cgdconfig as a library
2009-09-08 21:36:35 +00:00
drochner 0fa7059102 define YY_NO_INPUT where appropriate, from Kurt J. Lidl per PR misc/41160 2009-04-20 16:05:29 +00:00
dholland 2c1061aba6 Adjust this to not need -Wno-pointer-sign. 2008-07-24 05:32:45 +00:00
gmcgarry 8d54263568 Add HAVE_PCC tests for -Wno-pointer-sign. 2008-07-21 11:38:44 +00:00
matt f664ab11b6 Change incorrect usage of CFLAGS to CPPFLAGS 2008-02-16 17:56:36 +00:00
mrg aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
simonb 3204463045 We link against libl and liby, so depend on them too. 2006-02-25 11:57:52 +00:00
christos 192c2eccf6 Add -lcrypt where -lcrypto is specified. 2005-03-09 03:11:22 +00:00
thorpej 817eb1cb2e We need -I., too. 2003-04-17 22:12:50 +00:00
fvdl 38f661d48d -I. -> -I${.CURDIR} 2003-04-17 10:55:43 +00:00
elric 8c6033d202 substantial rototill of the code.
o  added new features:
		o  -G:  generate a new paramsfile that produces the same
			key as the old paramsfile,
		o  ffs verify_method,
		o  multiple keygen methods that are xor'ed together
		   (for n-factor authentication), and
		o  calibrating the iteration count of PKCS#5 PBKDF2 to
		   the current machine's speed.
	o  changed paramsfile format to allow for the new features.
	o  replaced open-coded parser with yacc grammar.
	o  lots of supporting changes.
	o  updated documentation to reflect new features and new
	   paramsfile format.
2003-03-24 02:02:49 +00:00
elric 49ec72f444 Initial checkin of cgdconfig(8), a program to configure a cgd. 2002-10-04 18:37:19 +00:00