diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-06-23 22:02:56 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-06-23 22:02:56 +0000 |
commit | c15d1cb5563266a23dd2725bddc4900aa877a38a (patch) | |
tree | 4ec46f94c6e881551275575bfe1fb00b53357c9e /sys/dev/pci | |
parent | 2bc524e39e037b7df71658e378475b6cd9efc677 (diff) |
Correctly handle the IV_PRESENT flag.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 26 | ||||
-rw-r--r-- | sys/dev/pci/ubsec.c | 29 |
2 files changed, 23 insertions, 32 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index 377c9b578fa..1132f2dc40e 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.76 2001/06/23 21:43:40 jason Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.77 2001/06/23 22:02:53 angelos Exp $ */ /* * Invertex AEON / Hi/fn 7751 driver @@ -1432,7 +1432,7 @@ hifn_process(crp) cmd->dst_io = (struct uio *)crp->crp_buf; } else { err = EINVAL; - goto errout; /* XXX only handle mbufs right now */ + goto errout; /* XXX we don't handle contiguous buffers! */ } crd1 = crp->crp_desc; @@ -1495,14 +1495,13 @@ hifn_process(crp) if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) { if (crp->crp_flags & CRYPTO_F_IMBUF) - m_copyback(cmd->src_m, enccrd->crd_inject, + m_copyback(cmd->src_m, + enccrd->crd_inject, + HIFN_IV_LENGTH, cmd->iv); + else if (crp->crp_flags & CRYPTO_F_IOV) + cuio_copyback(cmd->src_io, + enccrd->crd_inject, HIFN_IV_LENGTH, cmd->iv); - else if (crp->crp_flags & CRYPTO_F_IOV) { - if (crp->crp_iv == NULL) - bzero(cmd->iv, 8); - else - bcopy(crp->crp_iv, cmd->iv, 8); - } } } else { if (enccrd->crd_flags & CRD_F_IV_EXPLICIT) @@ -1510,12 +1509,9 @@ hifn_process(crp) else if (crp->crp_flags & CRYPTO_F_IMBUF) m_copydata(cmd->src_m, enccrd->crd_inject, HIFN_IV_LENGTH, cmd->iv); - else if (crp->crp_flags & CRYPTO_F_IOV) { - if (crp->crp_iv == NULL) - bzero(cmd->iv, 8); - else - bcopy(crp->crp_iv, cmd->iv, 8); - } + else if (crp->crp_flags & CRYPTO_F_IOV) + cuio_copyback(cmd->src_io, enccrd->crd_inject, + HIFN_IV_LENGTH, cmd->iv); } if (enccrd->crd_alg == CRYPTO_DES_CBC) diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index fd4878da7b1..a4dbc6f8ba8 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.61 2001/06/23 20:59:42 angelos Exp $ */ +/* $OpenBSD: ubsec.c,v 1.62 2001/06/23 22:02:55 angelos Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -617,7 +617,7 @@ ubsec_process(crp) q->q_dst_io = (struct uio *)crp->crp_buf; } else { err = EINVAL; - goto errout; /* XXX only handle mbufs right now */ + goto errout; /* XXX we don't handle contiguous blocks! */ } q->q_mcr = (struct ubsec_mcr *)malloc(sizeof(struct ubsec_mcr), @@ -692,15 +692,13 @@ ubsec_process(crp) if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) { if (crp->crp_flags & CRYPTO_F_IMBUF) - m_copyback(q->q_src_m, enccrd->crd_inject, + m_copyback(q->q_src_m, + enccrd->crd_inject, + 8, (caddr_t)ctx.pc_iv); + else if (crp->crp_flags & CRYPTO_F_IOV) + cuio_copyback(q->q_src_io, + enccrd->crd_inject, 8, (caddr_t)ctx.pc_iv); - else if (crp->crp_flags & CRYPTO_F_IOV) { - if (crp->crp_iv == NULL) - bzero((caddr_t)ctx.pc_iv, 8); - else - bcopy(crp->crp_iv, - (caddr_t)ctx.pc_iv, 8); - } } } else { ctx.pc_flags |= UBS_PKTCTX_INBOUND; @@ -710,13 +708,10 @@ ubsec_process(crp) else if (crp->crp_flags & CRYPTO_F_IMBUF) m_copydata(q->q_src_m, enccrd->crd_inject, 8, (caddr_t)ctx.pc_iv); - else if (crp->crp_flags & CRYPTO_F_IOV) { - if (crp->crp_iv == NULL) - bzero((caddr_t)ctx.pc_iv, 8); - else - bcopy(crp->crp_iv, - (caddr_t)ctx.pc_iv, 8); - } + else if (crp->crp_flags & CRYPTO_F_IOV) + cuio_copydata(q->q_src_io, + enccrd->crd_inject, 8, + (caddr_t)ctx.pc_iv); } ctx.pc_deskey[0] = ses->ses_deskey[0]; |