From 2ab9fc82365401a86dddd6f9a42a9839f5d06f72 Mon Sep 17 00:00:00 2001 From: tedu Date: Mon, 15 Dec 2014 01:53:45 +0000 Subject: [PATCH] change bcopy to memcpy. ok deraadt --- sys/arch/amd64/amd64/aesni.c | 16 ++++++++-------- sys/arch/amd64/amd64/amd64_mem.c | 6 +++--- sys/arch/amd64/amd64/bios.c | 6 +++--- sys/arch/amd64/amd64/cpu.c | 4 ++-- sys/arch/amd64/amd64/gdt.c | 4 ++-- sys/arch/amd64/amd64/machdep.c | 16 ++++++++-------- sys/arch/amd64/amd64/mem.c | 4 ++-- sys/arch/amd64/amd64/via.c | 20 ++++++++++---------- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c index 7a47fe4baa7..f34ef1e17f7 100644 --- a/sys/arch/amd64/amd64/aesni.c +++ b/sys/arch/amd64/amd64/aesni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aesni.c,v 1.30 2014/11/18 20:51:00 krw Exp $ */ +/* $OpenBSD: aesni.c,v 1.31 2014/12/15 01:53:45 tedu Exp $ */ /*- * Copyright (c) 2003 Jason Wright * Copyright (c) 2003, 2004 Theo de Raadt @@ -206,7 +206,7 @@ aesni_newsession(u_int32_t *sidp, struct cryptoini *cri) case CRYPTO_AES_GCM_16: case CRYPTO_AES_GMAC: ses->ses_klen = c->cri_klen / 8 - AESCTR_NONCESIZE; - bcopy(c->cri_key + ses->ses_klen, ses->ses_nonce, + memcpy(ses->ses_nonce, c->cri_key + ses->ses_klen, AESCTR_NONCESIZE); fpu_kernel_enter(); aesni_set_key(ses, c->cri_key, ses->ses_klen); @@ -429,7 +429,7 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd, /* Initialize the IV */ if (crd->crd_flags & CRD_F_ENCRYPT) { if (crd->crd_flags & CRD_F_IV_EXPLICIT) - bcopy(crd->crd_iv, iv, ivlen); + memcpy(iv, crd->crd_iv, ivlen); else arc4random_buf(iv, ivlen); @@ -447,7 +447,7 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd, } } else { if (crd->crd_flags & CRD_F_IV_EXPLICIT) - bcopy(crd->crd_iv, iv, ivlen); + memcpy(iv, crd->crd_iv, ivlen); else { if (crp->crp_flags & CRYPTO_F_IMBUF) m_copydata((struct mbuf *)crp->crp_buf, @@ -472,7 +472,7 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd, crda->crd_skip, 4, buf); iskip = 4; /* additional input offset */ /* ESN */ - bcopy(crda->crd_esn, buf + 4, 4); + memcpy(buf + 4, crda->crd_esn, 4); oskip = iskip + 4; /* offset output buffer by 8 */ } rlen = roundup(aadlen, GMAC_BLOCK_LEN); @@ -502,8 +502,8 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd, crd->crd_alg == CRYPTO_AES_GCM_16 || crd->crd_alg == CRYPTO_AES_GMAC) { bzero(icb, AESCTR_BLOCKSIZE); - bcopy(ses->ses_nonce, icb, AESCTR_NONCESIZE); - bcopy(iv, icb + AESCTR_NONCESIZE, AESCTR_IVSIZE); + memcpy(icb, ses->ses_nonce, AESCTR_NONCESIZE); + memcpy(icb + AESCTR_NONCESIZE, iv, AESCTR_IVSIZE); /* rlen is for gcm and gmac only */ rlen = roundup(crd->crd_len, AESCTR_BLOCKSIZE); } @@ -580,7 +580,7 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd, goto out; } } else - bcopy(tag, crp->crp_mac, GMAC_BLOCK_LEN); + memcpy(crp->crp_mac, tag, GMAC_BLOCK_LEN); /* clean up GHASH state */ bzero(ses->ses_ghash->S, GMAC_BLOCK_LEN); diff --git a/sys/arch/amd64/amd64/amd64_mem.c b/sys/arch/amd64/amd64/amd64_mem.c index c84dad299e5..568c670d552 100644 --- a/sys/arch/amd64/amd64/amd64_mem.c +++ b/sys/arch/amd64/amd64/amd64_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amd64_mem.c,v 1.9 2014/12/09 06:58:28 doug Exp $ */ +/* $OpenBSD: amd64_mem.c,v 1.10 2014/12/15 01:53:45 tedu Exp $ */ /* * Copyright (c) 1999 Michael Smith * All rights reserved. @@ -410,7 +410,7 @@ mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg) /* set flags, clear set-by-firmware flag */ for (curr_md = first_md; curr_md <= last_md; curr_md++) { curr_md->mr_flags = mrcopyflags(curr_md->mr_flags & ~MDF_FIRMWARE, mrd->mr_flags); - bcopy(mrd->mr_owner, curr_md->mr_owner, sizeof(mrd->mr_owner)); + memcpy(curr_md->mr_owner, mrd->mr_owner, sizeof(mrd->mr_owner)); } return(0); @@ -469,7 +469,7 @@ mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg) free_md->mr_base = mrd->mr_base; free_md->mr_len = mrd->mr_len; free_md->mr_flags = mrcopyflags(MDF_ACTIVE, mrd->mr_flags); - bcopy(mrd->mr_owner, free_md->mr_owner, sizeof(mrd->mr_owner)); + memcpy(free_md->mr_owner, mrd->mr_owner, sizeof(mrd->mr_owner)); return(0); } diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c index 577c8b49758..30cf980117e 100644 --- a/sys/arch/amd64/amd64/bios.c +++ b/sys/arch/amd64/amd64/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.29 2014/11/16 12:30:56 deraadt Exp $ */ +/* $OpenBSD: bios.c,v 1.30 2014/12/15 01:53:45 tedu Exp $ */ /* * Copyright (c) 2006 Gordon Willem Klok * @@ -299,7 +299,7 @@ smbios_get_string(struct smbtable *st, u_int8_t indx, char *dest, size_t len) if (i == indx) { if (va + len < end) { ret = dest; - bcopy(va, ret, len); + memcpy(ret, va, len); ret[len-1] = '\0'; } } @@ -330,7 +330,7 @@ fixstring(char *s) for (e = s + strlen(s) - 1; e > s && *e == ' '; e--) ; if (p > s || e < s + strlen(s) - 1) { - bcopy(p, s, e-p + 1); + memmove(s, p, e - p + 1); s[e - p + 1] = '\0'; } diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index 449161c4a6b..48e97982fb8 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.73 2014/12/14 05:04:49 guenther Exp $ */ +/* $OpenBSD: cpu.c,v 1.74 2014/12/15 01:53:45 tedu Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -175,7 +175,7 @@ replacesmap(void) pmap_update(pmap_kernel()); /* replace 3 byte nops with stac/clac instructions */ - bcopy(ireplace[i].saddr, (void *)(nva + po), 3); + memcpy((void *)(nva + po), ireplace[i].saddr, 3); } km_free((void *)nva, 2 * PAGE_SIZE, &kv_any, &kp_none); diff --git a/sys/arch/amd64/amd64/gdt.c b/sys/arch/amd64/amd64/gdt.c index 50588686167..df3e281dc57 100644 --- a/sys/arch/amd64/amd64/gdt.c +++ b/sys/arch/amd64/amd64/gdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt.c,v 1.21 2014/11/16 12:30:56 deraadt Exp $ */ +/* $OpenBSD: gdt.c,v 1.22 2014/12/15 01:53:45 tedu Exp $ */ /* $NetBSD: gdt.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /*- @@ -67,7 +67,7 @@ gdt_alloc_cpu(struct cpu_info *ci) panic("gdt_init: no pages"); pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg), PROT_READ | PROT_WRITE); } - bcopy(gdtstore, ci->ci_gdt, GDT_SIZE); + memcpy(ci->ci_gdt, gdtstore, GDT_SIZE); bzero(ci->ci_tss, sizeof(*ci->ci_tss)); } diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 48805a7d714..dd883326f93 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.201 2014/12/10 15:29:52 mikeb Exp $ */ +/* $OpenBSD: machdep.c,v 1.202 2014/12/15 01:53:45 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -537,7 +537,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, p->p_comm, p->p_pid, sig, catcher); #endif - bcopy(tf, &ksc, sizeof(*tf)); + memcpy(&ksc, tf, sizeof(*tf)); bzero((char *)&ksc + sizeof(*tf), sizeof(ksc) - sizeof(*tf)); ksc.sc_mask = mask; @@ -649,7 +649,7 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval) ksc.sc_trapno = tf->tf_trapno; ksc.sc_err = tf->tf_err; - bcopy(&ksc, tf, sizeof(*tf)); + memcpy(tf, &ksc, sizeof(*tf)); /* Restore signal mask. */ p->p_sigmask = ksc.sc_mask & ~sigcantmask; @@ -845,7 +845,7 @@ cpu_dump(void) * memory and bounce */ if (dumpmem_vaddr != 0) { - bcopy(buf, (char *)dumpmem_vaddr, sizeof(buf)); + memcpy((char *)dumpmem_vaddr, buf, sizeof(buf)); va = (caddr_t)dumpmem_vaddr; } else { va = (caddr_t)buf; @@ -960,7 +960,7 @@ dumpsys(void) va = (void *)dumpmem_vaddr; if (n > dumpmem_sz) n = dumpmem_sz; - bcopy((void *)PMAP_DIRECT_MAP(maddr), va, n); + memcpy(va, (void *)PMAP_DIRECT_MAP(maddr), n); } else { va = (void *)PMAP_DIRECT_MAP(maddr); } @@ -1850,15 +1850,15 @@ getbootinfo(char *bootinfo, int bootinfo_size) case BOOTARG_BOOTDUID: bios_bootduid = (bios_bootduid_t *)q->ba_arg; - bcopy(bios_bootduid, bootduid, sizeof(bootduid)); + memcpy(bootduid, bios_bootduid, sizeof(bootduid)); break; case BOOTARG_BOOTSR: bios_bootsr = (bios_bootsr_t *)q->ba_arg; #if NSOFTRAID > 0 - bcopy(&bios_bootsr->uuid, &sr_bootuuid, + memcpy(&sr_bootuuid, &bios_bootsr->uuid, sizeof(sr_bootuuid)); - bcopy(&bios_bootsr->maskkey, &sr_bootkey, + memcpy(&sr_bootkey, &bios_bootsr->maskkey, sizeof(sr_bootkey)); #endif explicit_bzero(bios_bootsr, sizeof(bios_bootsr_t)); diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c index d52d2baeb6b..dbe092847c1 100644 --- a/sys/arch/amd64/amd64/mem.c +++ b/sys/arch/amd64/amd64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.19 2014/10/09 04:18:09 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.20 2014/12/15 01:53:45 tedu Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -314,7 +314,7 @@ mem_range_attr_get(struct mem_range_desc *mrd, int *arg) if (*arg == 0) { *arg = mem_range_softc.mr_ndesc; } else { - bcopy(mem_range_softc.mr_desc, mrd, (*arg) * sizeof(struct mem_range_desc)); + memcpy(mrd, mem_range_softc.mr_desc, (*arg) * sizeof(struct mem_range_desc)); } return (0); } diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c index ca303873c82..23ab6fc3a2b 100644 --- a/sys/arch/amd64/amd64/via.c +++ b/sys/arch/amd64/amd64/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.18 2014/12/09 06:58:28 doug Exp $ */ +/* $OpenBSD: via.c,v 1.19 2014/12/15 01:53:45 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -159,7 +159,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, 0); sc->sc_sessions = ses; @@ -368,7 +368,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); @@ -380,8 +380,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); } @@ -389,7 +389,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, @@ -398,8 +398,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); } } @@ -410,7 +410,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, @@ -423,7 +423,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) { -- 2.20.1