summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-01-21 03:21:39 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-01-21 03:21:39 +0000
commit50f934564d7af1734c724ee908c68d48ecf24d6e (patch)
treecee6d22c67bf74eeedbd19c3cd5678e4c39c4860 /sys/dev
parenta9ad2a650e3a9b3b54f7ce056004501cea12036c (diff)
Remove pointless validation - these cases cannot be hit as they have
already been checked in sr_crypto_alloc_resources and sr_validate_io. Also document the known issue with per-block key selection. ok krw@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/softraid_crypto.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index 2910fbd2252..f4250f16fb1 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.102 2014/01/20 10:54:54 jsing Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.103 2014/01/21 03:21:38 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -294,13 +294,15 @@ sr_crypto_wu_get(struct sr_workunit *wu, int encrypt)
flags = (encrypt ? CRD_F_ENCRYPT : 0) |
CRD_F_IV_PRESENT | CRD_F_IV_EXPLICIT;
- /* Select crypto session based on block number */
+ /*
+ * Select crypto session based on block number.
+ *
+ * XXX - this does not handle the case where the read/write spans
+ * across a different key blocks (e.g. 0.5TB boundary). Currently
+ * this is already broken by the use of scr_key[0] below.
+ */
keyndx = blk >> SR_CRYPTO_KEY_BLKSHIFT;
- if (keyndx >= SR_CRYPTO_MAXKEYS)
- goto unwind;
crwu->cr_crp->crp_sid = sd->mds.mdd_crypto.scr_sid[keyndx];
- if (crwu->cr_crp->crp_sid == (u_int64_t)-1)
- goto unwind;
crwu->cr_crp->crp_ilen = xs->datalen;
crwu->cr_crp->crp_alloctype = M_DEVBUF;
@@ -320,9 +322,6 @@ sr_crypto_wu_get(struct sr_workunit *wu, int encrypt)
crwu->cr_crp->crp_opaque = crwu;
return (crwu);
-
-unwind:
- return (NULL);
}
void