summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/hifn7751.c72
1 files changed, 29 insertions, 43 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index 862e59a0497..45a163c9181 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.172 2015/11/13 12:21:16 mikeb Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.173 2015/11/13 15:29:55 naddy Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -291,7 +291,6 @@ hifn_attach(struct device *parent, struct device *self, void *aux)
switch (ena) {
case HIFN_PUSTAT_ENA_2:
algs[CRYPTO_3DES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
- algs[CRYPTO_ARC4] = CRYPTO_ALG_FLAG_SUPPORTED;
/*FALLTHROUGH*/
case HIFN_PUSTAT_ENA_1:
algs[CRYPTO_MD5_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
@@ -1870,7 +1869,6 @@ hifn_newsession(u_int32_t *sidp, struct cryptoini *cri)
case CRYPTO_DES_CBC:
case CRYPTO_3DES_CBC:
case CRYPTO_AES_CBC:
- case CRYPTO_ARC4:
if (cry)
return (EINVAL);
cry = 1;
@@ -1987,8 +1985,7 @@ hifn_process(struct cryptop *crp)
enccrd = NULL;
} else if (crd1->crd_alg == CRYPTO_DES_CBC ||
crd1->crd_alg == CRYPTO_3DES_CBC ||
- crd1->crd_alg == CRYPTO_AES_CBC ||
- crd1->crd_alg == CRYPTO_ARC4) {
+ crd1->crd_alg == CRYPTO_AES_CBC) {
if ((crd1->crd_flags & CRD_F_ENCRYPT) == 0)
cmd->base_masks |= HIFN_BASE_CMD_DECODE;
maccrd = NULL;
@@ -2004,16 +2001,14 @@ hifn_process(struct cryptop *crp)
crd1->crd_alg == CRYPTO_SHA1_HMAC) &&
(crd2->crd_alg == CRYPTO_DES_CBC ||
crd2->crd_alg == CRYPTO_3DES_CBC ||
- crd2->crd_alg == CRYPTO_AES_CBC ||
- crd2->crd_alg == CRYPTO_ARC4) &&
+ crd2->crd_alg == CRYPTO_AES_CBC) &&
((crd2->crd_flags & CRD_F_ENCRYPT) == 0)) {
cmd->base_masks = HIFN_BASE_CMD_DECODE;
maccrd = crd1;
enccrd = crd2;
} else if ((crd1->crd_alg == CRYPTO_DES_CBC ||
- crd1->crd_alg == CRYPTO_ARC4 ||
- crd1->crd_alg == CRYPTO_AES_CBC ||
- crd1->crd_alg == CRYPTO_3DES_CBC) &&
+ crd1->crd_alg == CRYPTO_3DES_CBC ||
+ crd1->crd_alg == CRYPTO_AES_CBC) &&
(crd2->crd_alg == CRYPTO_MD5_HMAC ||
crd2->crd_alg == CRYPTO_SHA1_HMAC) &&
(crd1->crd_flags & CRD_F_ENCRYPT)) {
@@ -2032,9 +2027,6 @@ hifn_process(struct cryptop *crp)
cmd->enccrd = enccrd;
cmd->base_masks |= HIFN_BASE_CMD_CRYPT;
switch (enccrd->crd_alg) {
- case CRYPTO_ARC4:
- cmd->cry_masks |= HIFN_CRYPT_CMD_ALG_RC4;
- break;
case CRYPTO_DES_CBC:
cmd->cry_masks |= HIFN_CRYPT_CMD_ALG_DES |
HIFN_CRYPT_CMD_MODE_CBC |
@@ -2054,41 +2046,35 @@ hifn_process(struct cryptop *crp)
err = EINVAL;
goto errout;
}
- if (enccrd->crd_alg != CRYPTO_ARC4) {
- ivlen = ((enccrd->crd_alg == CRYPTO_AES_CBC) ?
- HIFN_AES_IV_LENGTH : HIFN_IV_LENGTH);
- if (enccrd->crd_flags & CRD_F_ENCRYPT) {
- if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
- bcopy(enccrd->crd_iv, cmd->iv, ivlen);
- else
- arc4random_buf(cmd->iv, ivlen);
-
- if ((enccrd->crd_flags & CRD_F_IV_PRESENT)
- == 0) {
- if (crp->crp_flags & CRYPTO_F_IMBUF)
- err =
- m_copyback(cmd->srcu.src_m,
- enccrd->crd_inject,
- ivlen, cmd->iv, M_NOWAIT);
- else if (crp->crp_flags & CRYPTO_F_IOV)
- cuio_copyback(cmd->srcu.src_io,
- enccrd->crd_inject,
- ivlen, cmd->iv);
- if (err)
- goto errout;
- }
- } else {
- if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
- bcopy(enccrd->crd_iv, cmd->iv, ivlen);
- else if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copydata(cmd->srcu.src_m,
+ ivlen = ((enccrd->crd_alg == CRYPTO_AES_CBC) ?
+ HIFN_AES_IV_LENGTH : HIFN_IV_LENGTH);
+ if (enccrd->crd_flags & CRD_F_ENCRYPT) {
+ if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
+ bcopy(enccrd->crd_iv, cmd->iv, ivlen);
+ else
+ arc4random_buf(cmd->iv, ivlen);
+
+ if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
+ if (crp->crp_flags & CRYPTO_F_IMBUF)
+ err = m_copyback(cmd->srcu.src_m,
enccrd->crd_inject,
- ivlen, cmd->iv);
+ ivlen, cmd->iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
- cuio_copydata(cmd->srcu.src_io,
+ cuio_copyback(cmd->srcu.src_io,
enccrd->crd_inject,
ivlen, cmd->iv);
+ if (err)
+ goto errout;
}
+ } else {
+ if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
+ bcopy(enccrd->crd_iv, cmd->iv, ivlen);
+ else if (crp->crp_flags & CRYPTO_F_IMBUF)
+ m_copydata(cmd->srcu.src_m,
+ enccrd->crd_inject, ivlen, cmd->iv);
+ else if (crp->crp_flags & CRYPTO_F_IOV)
+ cuio_copydata(cmd->srcu.src_io,
+ enccrd->crd_inject, ivlen, cmd->iv);
}
cmd->ck = enccrd->crd_key;