diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2012-10-09 11:57:34 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2012-10-09 11:57:34 +0000 |
commit | f4171802e8cbc5e9e0c04c1bd14906cdf3b82abf (patch) | |
tree | e7170898620278ffb186c379e060755043a3dfa3 /sys/dev/softraid_crypto.c | |
parent | 5e065c779e48d10afeaf7c00e7fe38d7bdd06ae8 (diff) |
Provide a mechanism for the kernel to directly pass a mask key through to
a crypto volume when it is assembling it.
Diffstat (limited to 'sys/dev/softraid_crypto.c')
-rw-r--r-- | sys/dev/softraid_crypto.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c index 5423acb2ba4..13881a8f04c 100644 --- a/sys/dev/softraid_crypto.c +++ b/sys/dev/softraid_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_crypto.c,v 1.81 2012/10/08 14:22:41 jsing Exp $ */ +/* $OpenBSD: softraid_crypto.c,v 1.82 2012/10/09 11:57:33 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org> @@ -204,7 +204,11 @@ sr_crypto_assemble(struct sr_discipline *sd, struct bioc_createraid *bc, if (sd->mds.mdd_crypto.scr_meta == NULL) goto done; - if (bc->bc_key_disk != NODEV) { + if (data != NULL) { + /* Kernel already has mask key. */ + bcopy(data, sd->mds.mdd_crypto.scr_maskkey, + sizeof(sd->mds.mdd_crypto.scr_maskkey)); + } else if (bc->bc_key_disk != NODEV) { /* Read the mask key from the key disk. */ sd->mds.mdd_crypto.key_disk = sr_crypto_read_key_disk(sd, bc->bc_key_disk); @@ -231,8 +235,8 @@ sr_crypto_assemble(struct sr_discipline *sd, struct bioc_createraid *bc, /* get kdf with maskkey from userland */ if (sr_crypto_get_kdf(bc, sd)) goto done; - - } + } else + goto done; sd->sd_max_ccb_per_wu = sd->sd_meta->ssdi.ssd_chunk_no; |