diff options
author | pjd <pjd@FreeBSD.org> | 2006-05-17 18:34:26 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-05-17 18:34:26 +0000 |
commit | 13602a353ca35e6594bdd7201c284768ed3317fe (patch) | |
tree | 69cf0d44ef9ce935725c11a054db6071e9931fad /sys/dev/ubsec/ubsec.c | |
parent | 1f7868c704afbf4e8feb32d6bd24bbeebd94b35b (diff) | |
download | FreeBSD-src-13602a353ca35e6594bdd7201c284768ed3317fe.zip FreeBSD-src-13602a353ca35e6594bdd7201c284768ed3317fe.tar.gz |
Honor cri_mlen value.
Reviewed by: sam
Tested on: hifn(4), ubsec(4)
Compile-tested: safe(4)
Diffstat (limited to 'sys/dev/ubsec/ubsec.c')
-rw-r--r-- | sys/dev/ubsec/ubsec.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/ubsec/ubsec.c b/sys/dev/ubsec/ubsec.c index 82281c5..22ab654 100644 --- a/sys/dev/ubsec/ubsec.c +++ b/sys/dev/ubsec/ubsec.c @@ -917,6 +917,14 @@ ubsec_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; @@ -1604,11 +1612,13 @@ ubsec_callback(struct ubsec_softc *sc, struct ubsec_q *q) continue; if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, - crd->crd_inject, 12, + crd->crd_inject, + sc->sc_sessions[q->q_sesn].ses_mlen, (caddr_t)dmap->d_dma->d_macbuf); else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac) bcopy((caddr_t)dmap->d_dma->d_macbuf, - crp->crp_mac, 12); + crp->crp_mac, + sc->sc_sessions[q->q_sesn].ses_mlen); break; } mtx_lock(&sc->sc_freeqlock); |