summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorhshoexer <hshoexer@openbsd.org>2008-06-13 18:26:59 +0000
committerhshoexer <hshoexer@openbsd.org>2008-06-13 18:26:59 +0000
commitd4aeb51298b4d6377bb3fcb6ea26de9746c7f497 (patch)
treec2196346a406efa6e4cd2c829b95477a02234789 /sys/dev/softraid.c
parentRemove DEBUG #undef's we can turn it on/off in GENERIC like for all (diff)
downloadwireguard-openbsd-d4aeb51298b4d6377bb3fcb6ea26de9746c7f497.tar.xz
wireguard-openbsd-d4aeb51298b4d6377bb3fcb6ea26de9746c7f497.zip
When assembling an already initialized crytpo softraid, correctly copy in
mask key from userland. Thus, modify sr_crypto_get_kdf() do correclty handle copying kdf hint and/or mask key. While there, remove superflous sr_read_meta(). ok marco djm
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 7f035669c1b..4e7117b4b29 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.112 2008/06/12 23:29:27 hshoexer Exp $ */
+/* $OpenBSD: softraid.c,v 1.113 2008/06/13 18:26:59 hshoexer Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -884,9 +884,6 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user)
if (bc->bc_opaque == NULL)
goto unwind;
- if (sr_read_meta(sd) == 0)
- goto unwind;
-
if (sizeof(sd->mds.mdd_crypto.scr_meta.scm_kdfhint) <
bc->bc_opaque_size)
goto unwind;
@@ -899,6 +896,11 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user)
rv = 0;
goto unwind;
}
+ /* get kdf with maskkey from userland */
+ if (bc->bc_opaque_flags & BIOC_SOIN) {
+ if (sr_crypto_get_kdf(bc, sd))
+ goto unwind;
+ }
#endif /* CRYPTO */
DNPRINTF(SR_D_META, "%s: disk assembled from metadata\n",
DEVNAME(sc));