The NetBSD Project

CVS log for src/tests/dev/cgd/t_cgdconfig.sh

[BACK] Up to [cvs.NetBSD.org] / src / tests / dev / cgd

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.4: download - view: text, markup, annotated - select for diffs
Sat Aug 13 17:46:26 2022 UTC (2 years, 3 months ago) by hannken
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, HEAD
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +27 -27 lines
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".

Revision 1.3: download - view: text, markup, annotated - select for diffs
Fri Aug 12 10:49:17 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +153 -1 lines
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.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Fri Aug 12 10:48:44 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +36 -1 lines
cgdconfig(8): New -T operation prints all generated keys in cgd.conf.

For testing purposes.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Fri Aug 12 10:48:28 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
cgdconfig(8): New -t operation just prints the derived key in base64.

For testing purposes.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>