summaryrefslogtreecommitdiff
path: root/sys/dev/safe
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2006-05-17 18:34:26 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2006-05-17 18:34:26 +0000
commitaf65c53afdc6325ad100bd9907aa3e04493b9d10 (patch)
tree69cf0d44ef9ce935725c11a054db6071e9931fad /sys/dev/safe
parent80e35494cc95f545abadfa78f1fd25e65d1f69f3 (diff)
downloadsrc-test2-af65c53afdc6325ad100bd9907aa3e04493b9d10.tar.gz
src-test2-af65c53afdc6325ad100bd9907aa3e04493b9d10.zip
Notes
Diffstat (limited to 'sys/dev/safe')
-rw-r--r--sys/dev/safe/safe.c14
-rw-r--r--sys/dev/safe/safevar.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/safe/safe.c b/sys/dev/safe/safe.c
index 734e6c5cae95..4475f5012397 100644
--- a/sys/dev/safe/safe.c
+++ b/sys/dev/safe/safe.c
@@ -746,6 +746,14 @@ safe_newsession(void *arg, u_int32_t *sidp, struct cryptoini *cri)
}
if (macini) {
+ ses->ses_mlen = macini->cri_mlen;
+ if (ses->ses_mlen == 0) {
+ if (macini->cri_alg == CRYPTO_MD5_HMAC)
+ ses->ses_mlen = MD5_DIGEST_LENGTH;
+ else
+ ses->ses_mlen = SHA1_RESULTLEN;
+ }
+
for (i = 0; i < macini->cri_klen / 8; i++)
macini->cri_key[i] ^= HMAC_IPAD_VAL;
@@ -1580,11 +1588,13 @@ safe_callback(struct safe_softc *sc, struct safe_ringentry *re)
}
if (crp->crp_flags & CRYPTO_F_IMBUF) {
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_inject, 12,
+ crd->crd_inject,
+ sc->sc_sessions[re->re_sesn].ses_mlen,
(caddr_t)re->re_sastate.sa_saved_indigest);
} else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac) {
bcopy((caddr_t)re->re_sastate.sa_saved_indigest,
- crp->crp_mac, 12);
+ crp->crp_mac,
+ sc->sc_sessions[re->re_sesn].ses_mlen);
}
break;
}
diff --git a/sys/dev/safe/safevar.h b/sys/dev/safe/safevar.h
index fd1ee389a2a7..aadf30dd6e63 100644
--- a/sys/dev/safe/safevar.h
+++ b/sys/dev/safe/safevar.h
@@ -138,6 +138,7 @@ struct safe_session {
u_int32_t ses_used;
u_int32_t ses_klen; /* key length in bits */
u_int32_t ses_key[8]; /* DES/3DES/AES key */
+ u_int32_t ses_mlen; /* hmac length in bytes */
u_int32_t ses_hminner[5]; /* hmac inner state */
u_int32_t ses_hmouter[5]; /* hmac outer state */
u_int32_t ses_iv[4]; /* DES/3DES/AES iv */