diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2016-09-19 18:09:23 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2016-09-19 18:09:23 +0000 |
commit | 13bc41e4d33b6958a542533db7b7d900eb305f9a (patch) | |
tree | 7b88cfba279d981767e05566a7c576f39744b0a8 | |
parent | 744427cb8a87628e9c8228a3000a6b3fbfb4a436 (diff) |
convert bcopy to memcpy. from david hill.
-rw-r--r-- | sys/netinet/ip_ah.c | 26 | ||||
-rw-r--r-- | sys/netinet/ip_esp.c | 16 | ||||
-rw-r--r-- | sys/netinet/ip_ipsp.c | 6 |
3 files changed, 23 insertions, 25 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 0d5adfc526e..28c084839e4 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.122 2016/09/13 19:56:55 markus Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.123 2016/09/19 18:09:22 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -151,7 +151,7 @@ ah_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii) tdbp->tdb_amxkeylen = ii->ii_authkeylen; tdbp->tdb_amxkey = malloc(tdbp->tdb_amxkeylen, M_XDATA, M_WAITOK); - bcopy(ii->ii_authkey, tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); + memcpy(tdbp->tdb_amxkey, ii->ii_authkey, tdbp->tdb_amxkeylen); /* Initialize crypto session. */ memset(&cria, 0, sizeof(cria)); @@ -312,7 +312,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* Zeroize all other options. */ count = ptr[off + 1]; - bcopy(ipseczeroes, ptr, count); + memcpy(ptr, ipseczeroes, count); off += count; break; } @@ -422,7 +422,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* If mutable option, zeroize. */ if (ptr[count] & IP6OPT_MUTABLE) - bcopy(ipseczeroes, ptr + count, + memcpy(ptr + count, ipseczeroes, ptr[count + 1]); count += ad; @@ -642,7 +642,7 @@ ah_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) if ((tdb->tdb_wnd > 0) && (tdb->tdb_flags & TDBF_ESN)) { esn = htonl(esn); - bcopy(&esn, crda->crd_esn, 4); + memcpy(crda->crd_esn, &esn, 4); crda->crd_flags |= CRD_F_ESN; } @@ -689,7 +689,7 @@ ah_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) tc->tc_spi = tdb->tdb_spi; tc->tc_proto = tdb->tdb_sproto; tc->tc_rdomain = tdb->tdb_rdomain; - bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); + memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union)); return crypto_dispatch(crp); } @@ -1114,7 +1114,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, u_int32_t esn; esn = htonl((u_int32_t)(tdb->tdb_rpl >> 32)); - bcopy(&esn, crda->crd_esn, 4); + memcpy(crda->crd_esn, &esn, 4); crda->crd_flags |= CRD_F_ESN; } @@ -1138,9 +1138,8 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, */ switch (tdb->tdb_dst.sa.sa_family) { case AF_INET: - bcopy(((caddr_t)(tc + 1)) + - offsetof(struct ip, ip_len), - (caddr_t) &iplen, sizeof(u_int16_t)); + memcpy((caddr_t) &iplen, ((caddr_t)(tc + 1)) + + offsetof(struct ip, ip_len), sizeof(u_int16_t)); iplen = htons(ntohs(iplen) + rplen + ahx->authsize); m_copyback(m, offsetof(struct ip, ip_len), sizeof(u_int16_t), &iplen, M_NOWAIT); @@ -1148,9 +1147,8 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, #ifdef INET6 case AF_INET6: - bcopy(((caddr_t)(tc + 1)) + - offsetof(struct ip6_hdr, ip6_plen), - (caddr_t) &iplen, sizeof(u_int16_t)); + memcpy((caddr_t) &iplen, ((caddr_t)(tc + 1)) + + offsetof(struct ip6_hdr, ip6_plen), sizeof(u_int16_t)); iplen = htons(ntohs(iplen) + rplen + ahx->authsize); m_copyback(m, offsetof(struct ip6_hdr, ip6_plen), sizeof(u_int16_t), &iplen, M_NOWAIT); @@ -1188,7 +1186,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, tc->tc_spi = tdb->tdb_spi; tc->tc_proto = tdb->tdb_sproto; tc->tc_rdomain = tdb->tdb_rdomain; - bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); + memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union)); return crypto_dispatch(crp); } diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index 48408e316e1..176a0f03012 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.140 2016/09/13 19:56:55 markus Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.141 2016/09/19 18:09:22 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -262,7 +262,7 @@ esp_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii) tdbp->tdb_emxkeylen = ii->ii_enckeylen; tdbp->tdb_emxkey = malloc(tdbp->tdb_emxkeylen, M_XDATA, M_WAITOK); - bcopy(ii->ii_enckey, tdbp->tdb_emxkey, tdbp->tdb_emxkeylen); + memcpy(tdbp->tdb_emxkey, ii->ii_enckey, tdbp->tdb_emxkeylen); memset(&crie, 0, sizeof(crie)); @@ -283,7 +283,7 @@ esp_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii) tdbp->tdb_amxkeylen = ii->ii_authkeylen; tdbp->tdb_amxkey = malloc(tdbp->tdb_amxkeylen, M_XDATA, M_WAITOK); - bcopy(ii->ii_authkey, tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); + memcpy(tdbp->tdb_amxkey, ii->ii_authkey, tdbp->tdb_amxkeylen); memset(&cria, 0, sizeof(cria)); @@ -474,7 +474,7 @@ esp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) if ((tdb->tdb_wnd > 0) && (tdb->tdb_flags & TDBF_ESN)) { esn = htonl(esn); - bcopy(&esn, crda->crd_esn, 4); + memcpy(crda->crd_esn, &esn, 4); crda->crd_flags |= CRD_F_ESN; } @@ -504,7 +504,7 @@ esp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) tc->tc_spi = tdb->tdb_spi; tc->tc_proto = tdb->tdb_sproto; tc->tc_rdomain = tdb->tdb_rdomain; - bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); + memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union)); /* Decryption descriptor */ if (espx) { @@ -922,7 +922,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, sizeof(u_int32_t)); tdb->tdb_rpl++; replay = htonl((u_int32_t)tdb->tdb_rpl); - bcopy((caddr_t) &replay, mtod(mo, caddr_t) + roff + sizeof(u_int32_t), + memcpy(mtod(mo, caddr_t) + roff + sizeof(u_int32_t), (caddr_t) &replay, sizeof(u_int32_t)); #if NPFSYNC > 0 @@ -1000,7 +1000,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, tc->tc_spi = tdb->tdb_spi; tc->tc_proto = tdb->tdb_sproto; tc->tc_rdomain = tdb->tdb_rdomain; - bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); + memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union)); /* Crypto operation descriptor. */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */ @@ -1024,7 +1024,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, u_int32_t esn; esn = htonl((u_int32_t)(tdb->tdb_rpl >> 32)); - bcopy(&esn, crda->crd_esn, 4); + memcpy(crda->crd_esn, &esn, 4); crda->crd_flags |= CRD_F_ESN; } diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index 5fad2df2172..c5465ad7142 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.215 2016/09/15 03:37:09 dlg Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.216 2016/09/19 18:09:22 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -238,8 +238,8 @@ reserve_spi(u_int rdomain, u_int32_t sspi, u_int32_t tspi, tdbp->tdb_spi = spi; - bcopy(&dst->sa, &tdbp->tdb_dst.sa, SA_LEN(&dst->sa)); - bcopy(&src->sa, &tdbp->tdb_src.sa, SA_LEN(&src->sa)); + memcpy(&tdbp->tdb_dst.sa, &dst->sa, SA_LEN(&dst->sa)); + memcpy(&tdbp->tdb_src.sa, &src->sa, SA_LEN(&src->sa)); tdbp->tdb_sproto = sproto; tdbp->tdb_flags |= TDBF_INVALID; /* Mark SA invalid for now. */ tdbp->tdb_satype = SADB_SATYPE_UNSPEC; |