Change bcopy to memcpy in the i386 version of the VIA PadLock driver.
authorfcambus <fcambus@openbsd.org>
Thu, 14 Dec 2017 09:14:30 +0000 (09:14 +0000)
committerfcambus <fcambus@openbsd.org>
Thu, 14 Dec 2017 09:14:30 +0000 (09:14 +0000)
It was done a while ago in the amd64 version.

OK mlarkin@, deraadt@, dlg@

sys/arch/i386/i386/via.c

index 3fac9ab..7f26863 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: via.c,v 1.37 2017/05/02 11:47:49 mikeb Exp $  */
+/*     $OpenBSD: via.c,v 1.38 2017/12/14 09:14:30 fcambus Exp $        */
 /*     $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $    */
 
 /*-
@@ -161,7 +161,7 @@ viac3_crypto_newsession(u_int32_t *sidp, struct cryptoini *cri)
                            M_NOWAIT);
                        if (ses == NULL)
                                return (ENOMEM);
-                       bcopy(sc->sc_sessions, ses, sesn * sizeof(*ses));
+                       memcpy(ses, sc->sc_sessions, sesn * sizeof(*ses));
                        explicit_bzero(sc->sc_sessions, sesn * sizeof(*ses));
                        free(sc->sc_sessions, M_DEVBUF, sesn * sizeof(*ses));
                        sc->sc_sessions = ses;
@@ -370,7 +370,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
                sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_ENCRYPT;
                key = ses->ses_ekey;
                if (crd->crd_flags & CRD_F_IV_EXPLICIT)
-                       bcopy(crd->crd_iv, sc->op_iv, 16);
+                       memcpy(sc->op_iv, crd->crd_iv, 16);
                else
                        arc4random_buf(sc->op_iv, 16);
 
@@ -382,8 +382,8 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
                                cuio_copyback((struct uio *)crp->crp_buf,
                                    crd->crd_inject, 16, sc->op_iv);
                        else
-                               bcopy(sc->op_iv,
-                                   crp->crp_buf + crd->crd_inject, 16);
+                               memcpy(crp->crp_buf + crd->crd_inject,
+                                   sc->op_iv, 16);
                        if (err)
                                return (err);
                }
@@ -391,7 +391,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
                sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_DECRYPT;
                key = ses->ses_dkey;
                if (crd->crd_flags & CRD_F_IV_EXPLICIT)
-                       bcopy(crd->crd_iv, sc->op_iv, 16);
+                       memcpy(sc->op_iv, crd->crd_iv, 16);
                else {
                        if (crp->crp_flags & CRYPTO_F_IMBUF)
                                m_copydata((struct mbuf *)crp->crp_buf,
@@ -400,8 +400,8 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
                                cuio_copydata((struct uio *)crp->crp_buf,
                                    crd->crd_inject, 16, sc->op_iv);
                        else
-                               bcopy(crp->crp_buf + crd->crd_inject,
-                                   sc->op_iv, 16);
+                               memcpy(sc->op_iv,
+                                   crp->crp_buf + crd->crd_inject, 16);
                }
        }
 
@@ -412,7 +412,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
                cuio_copydata((struct uio *)crp->crp_buf,
                    crd->crd_skip, crd->crd_len, sc->op_buf);
        else
-               bcopy(crp->crp_buf + crd->crd_skip, sc->op_buf, crd->crd_len);
+               memcpy(sc->op_buf, crp->crp_buf + crd->crd_skip, crd->crd_len);
 
        sc->op_cw[1] = sc->op_cw[2] = sc->op_cw[3] = 0;
        viac3_cbc(&sc->op_cw, sc->op_buf, sc->op_buf, key,
@@ -425,7 +425,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
                cuio_copyback((struct uio *)crp->crp_buf,
                    crd->crd_skip, crd->crd_len, sc->op_buf);
        else
-               bcopy(sc->op_buf, crp->crp_buf + crd->crd_skip,
+               memcpy(crp->crp_buf + crd->crd_skip, sc->op_buf,
                    crd->crd_len);
 
        if (sc->op_buf != NULL) {