summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/cryptmod.c
diff options
context:
space:
mode:
authorPeter Shoults <Peter.Shoults@Sun.COM>2008-11-18 15:42:56 -0500
committerPeter Shoults <Peter.Shoults@Sun.COM>2008-11-18 15:42:56 -0500
commite682dfaf387b7be0450598aed453622de82dcdeb (patch)
treebe2316f924e19ae49b81d5cf0267495b03b5a0b4 /usr/src/uts/common/io/cryptmod.c
parent0eb5a252b97289dc58b3cfab8137fbfcb8b6a603 (diff)
downloadillumos-joyent-e682dfaf387b7be0450598aed453622de82dcdeb.tar.gz
6712440 AES-256 not functioning on T6320 chip
6748874 Assertion panic in cryptmod due to incorrect calculation of assertion.
Diffstat (limited to 'usr/src/uts/common/io/cryptmod.c')
-rw-r--r--usr/src/uts/common/io/cryptmod.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/usr/src/uts/common/io/cryptmod.c b/usr/src/uts/common/io/cryptmod.c
index 14f0fec9e2..0f02c29404 100644
--- a/usr/src/uts/common/io/cryptmod.c
+++ b/usr/src/uts/common/io/cryptmod.c
@@ -37,7 +37,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/sysmacros.h>
@@ -1256,13 +1255,11 @@ aes_cbc_cts_encrypt(struct tmodinfo *tmi, uchar_t *plain, size_t length)
mech.cm_type = tmi->enc_data.mech_type;
if (tmi->enc_data.ivlen > 0 && tmi->enc_data.ivec != NULL) {
bcopy(tmi->enc_data.ivec, tmp, DEFAULT_AES_BLOCKLEN);
- mech.cm_param = tmi->enc_data.ivec;
- mech.cm_param_len = tmi->enc_data.ivlen;
} else {
bzero(tmp, sizeof (tmp));
- mech.cm_param = NULL;
- mech.cm_param_len = 0;
}
+ mech.cm_param = NULL;
+ mech.cm_param_len = 0;
nblocks = (length + DEFAULT_AES_BLOCKLEN - 1) / DEFAULT_AES_BLOCKLEN;
@@ -1420,13 +1417,12 @@ aes_cbc_cts_decrypt(struct tmodinfo *tmi, uchar_t *buff, size_t length)
if (tmi->dec_data.ivec_usage != IVEC_NEVER &&
tmi->dec_data.ivlen > 0 && tmi->dec_data.ivec != NULL) {
bcopy(tmi->dec_data.ivec, tmp, DEFAULT_AES_BLOCKLEN);
- mech.cm_param = tmi->dec_data.ivec;
- mech.cm_param_len = tmi->dec_data.ivlen;
} else {
bzero(tmp, sizeof (tmp));
- mech.cm_param_len = 0;
- mech.cm_param = NULL;
}
+ mech.cm_param_len = 0;
+ mech.cm_param = NULL;
+
nblocks = (length + DEFAULT_AES_BLOCKLEN - 1) / DEFAULT_AES_BLOCKLEN;
bzero(&pt, sizeof (pt));
@@ -1455,7 +1451,7 @@ aes_cbc_cts_decrypt(struct tmodinfo *tmi, uchar_t *buff, size_t length)
pt.cd_offset = 0;
pt.cd_length = DEFAULT_AES_BLOCKLEN;
- result = crypto_encrypt_init(&mech,
+ result = crypto_decrypt_init(&mech,
&tmi->dec_data.d_encr_key,
tmi->dec_data.enc_tmpl,
&tmi->dec_data.ctx, NULL);
@@ -3014,11 +3010,10 @@ encrypt_block(queue_t *q, struct tmodinfo *tmi, mblk_t *mp, size_t plainlen)
* headspace includes the length fields needed
* for the RCMD modes (v1 == 4 bytes, V2 = 8)
*/
- cbp->b_rptr = DB_BASE(cbp) + headspace;
-
- ASSERT(cbp->b_rptr + P2ROUNDUP(plainlen, 8)
+ ASSERT(cbp->b_rptr + P2ROUNDUP(plainlen+headspace, 8)
<= DB_LIM(cbp));
+ cbp->b_rptr = DB_BASE(cbp) + headspace;
bcopy(mp->b_rptr, cbp->b_rptr, plainlen);
cbp->b_wptr = cbp->b_rptr + plainlen;