-/* $OpenBSD: ip_ah.c,v 1.150 2021/07/08 21:07:19 bluhm Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.151 2021/07/18 14:38:20 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
sizeof(u_int32_t), &btsx);
btsx = ntohl(btsx);
- switch (checkreplaywindow(tdb, btsx, &esn, 0)) {
+ switch (checkreplaywindow(tdb, tdb->tdb_rpl, btsx, &esn, 0)) {
case 0: /* All's well. */
break;
case 1:
tc->tc_proto = tdb->tdb_sproto;
tc->tc_rdomain = tdb->tdb_rdomain;
memcpy(&tc->tc_dst, &tdb->tdb_dst, sizeof(union sockaddr_union));
+ tc->tc_rpl = tdb->tdb_rpl;
KERNEL_LOCK();
error = crypto_dispatch(crp);
{
const struct auth_hash *ahx = tdb->tdb_authalgxform;
int roff, rplen, skip, protoff;
+ u_int64_t rpl;
u_int32_t btsx, esn;
caddr_t ptr;
unsigned char calc[AH_ALEN_MAX];
skip = tc->tc_skip;
protoff = tc->tc_protoff;
+ rpl = tc->tc_rpl;
rplen = AH_FLENGTH + sizeof(u_int32_t);
sizeof(u_int32_t), &btsx);
btsx = ntohl(btsx);
- switch (checkreplaywindow(tdb, btsx, &esn, 1)) {
+ switch (checkreplaywindow(tdb, rpl, btsx, &esn, 1)) {
case 0: /* All's well. */
#if NPFSYNC > 0
pfsync_update_tdb(tdb,0);
-/* $OpenBSD: ip_esp.c,v 1.168 2021/07/16 15:08:39 bluhm Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.169 2021/07/18 14:38:20 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
&btsx);
btsx = ntohl(btsx);
- switch (checkreplaywindow(tdb, btsx, &esn, 0)) {
+ switch (checkreplaywindow(tdb, tdb->tdb_rpl, btsx, &esn, 0)) {
case 0: /* All's well */
break;
case 1:
tc->tc_proto = tdb->tdb_sproto;
tc->tc_rdomain = tdb->tdb_rdomain;
tc->tc_dst = tdb->tdb_dst;
+ tc->tc_rpl = tdb->tdb_rpl;
/* Decryption descriptor */
if (espx) {
int hlen, roff, skip, protoff;
struct mbuf *m1, *mo;
const struct auth_hash *esph;
+ u_int64_t rpl;
u_int32_t btsx, esn;
caddr_t ptr;
#ifdef ENCDEBUG
skip = tc->tc_skip;
protoff = tc->tc_protoff;
+ rpl = tc->tc_rpl;
NET_ASSERT_LOCKED();
&btsx);
btsx = ntohl(btsx);
- switch (checkreplaywindow(tdb, btsx, &esn, 1)) {
+ switch (checkreplaywindow(tdb, rpl, btsx, &esn, 1)) {
case 0: /* All's well */
#if NPFSYNC > 0
pfsync_update_tdb(tdb,0);
* return 3 for packet within current window but already received
*/
int
-checkreplaywindow(struct tdb *tdb, u_int32_t seq, u_int32_t *seqh, int commit)
+checkreplaywindow(struct tdb *tdb, u_int64_t t, u_int32_t seq, u_int32_t *seqh,
+ int commit)
{
u_int32_t tl, th, wl;
u_int32_t packet, window = TDB_REPLAYMAX - TDB_REPLAYWASTE;
int idx, esn = tdb->tdb_flags & TDBF_ESN;
- tl = (u_int32_t)tdb->tdb_rpl;
- th = (u_int32_t)(tdb->tdb_rpl >> 32);
+ tl = (u_int32_t)t;
+ th = (u_int32_t)(t >> 32);
/* Zero SN is not allowed */
if ((esn && seq == 0 && tl <= AH_HMAC_INITIAL_RPL && th == 0) ||
-/* $OpenBSD: ip_ipsp.h,v 1.201 2021/07/13 08:16:17 mvs Exp $ */
+/* $OpenBSD: ip_ipsp.h,v 1.202 2021/07/18 14:38:20 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
};
struct tdb_crypto {
- u_int32_t tc_spi;
union sockaddr_union tc_dst;
- u_int8_t tc_proto;
+ u_int64_t tc_rpl;
+ u_int32_t tc_spi;
int tc_protoff;
int tc_skip;
u_int tc_rdomain;
+ u_int8_t tc_proto;
};
struct ipsecinit {
int, int);
/* Replay window */
-int checkreplaywindow(struct tdb *, u_int32_t, u_int32_t *, int);
+int checkreplaywindow(struct tdb *, u_int64_t, u_int32_t, u_int32_t *, int);
/* Packet processing */
int ipsp_process_packet(struct mbuf *, struct tdb *, int, int);