summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_ipsp.h
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-07-18 14:38:21 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-07-18 14:38:21 +0000
commitcd8098560ae5c49bf2c08f0304a1da55936179e4 (patch)
tree7b9561eddcd3003ee8e397710ed6b13492fd10cf /sys/netinet/ip_ipsp.h
parent5b8f807a78f498c67c79e51656903593cf41fb7e (diff)
The IPsec authentication before decryption used a different replay
counter than after decryption. This could result in "esp_input_cb: authentication failed for packet in SA" errors. As we run crypto operations async, thousands of packets are stored in the crypto task. During the queueing the replay counter of the tdb can change. Then the higher 32 bits may increment although the lower 32 bits did not wrap. checkreplaywindow() must be called twice per packet with the same replay counter. Store the value in struct tdb_crypto while dangling in the task queue and doing crypto operations. tested by Hrvoje Popovski; joint work with tobhe@
Diffstat (limited to 'sys/netinet/ip_ipsp.h')
-rw-r--r--sys/netinet/ip_ipsp.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h
index 41801db1200..ba2c7c616fb 100644
--- a/sys/netinet/ip_ipsp.h
+++ b/sys/netinet/ip_ipsp.h
@@ -1,4 +1,4 @@
-/* $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),
@@ -432,12 +432,13 @@ struct tdb_ident {
};
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 {
@@ -622,7 +623,7 @@ int tcp_signature_tdb_output(struct mbuf *, struct tdb *, struct mbuf **,
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);