From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
David Miller <davem@davemloft.net>
Cc: Alex Badea <abadea@ixiacom.com>,
Andreas Gruenbacher <agruen@suse.de>,
netdev@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: [RFC v2 PATCH 2/9] xfrm: Add basic infrastructure to support IPsec extended sequence numbers
Date: Tue, 8 Mar 2011 11:05:43 +0100 [thread overview]
Message-ID: <20110308100543.GD31402@secunet.com> (raw)
In-Reply-To: <20110308100407.GB31402@secunet.com>
This patch adds the struct xfrm_replay_state_esn which will be
used to support IPsec extended sequence numbers and anti replay windows
bigger than 32 packets. Also we add a function that returns the actual
size of the xfrm_replay_state_esn, a xfrm netlink atribute and a xfrm state
flag for the use of extended sequence numbers.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/linux/xfrm.h | 12 ++++++++++++
include/net/xfrm.h | 7 +++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index b93d6f5..22e61fd 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -84,6 +84,16 @@ struct xfrm_replay_state {
__u32 bitmap;
};
+struct xfrm_replay_state_esn {
+ unsigned int bmp_len;
+ __u32 oseq;
+ __u32 seq;
+ __u32 oseq_hi;
+ __u32 seq_hi;
+ __u32 replay_window;
+ __u32 bmp[0];
+};
+
struct xfrm_algo {
char alg_name[64];
unsigned int alg_key_len; /* in bits */
@@ -284,6 +294,7 @@ enum xfrm_attr_type_t {
XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */
XFRMA_MARK, /* struct xfrm_mark */
XFRMA_TFCPAD, /* __u32 */
+ XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
__XFRMA_MAX
#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -351,6 +362,7 @@ struct xfrm_usersa_info {
#define XFRM_STATE_ICMP 16
#define XFRM_STATE_AF_UNSPEC 32
#define XFRM_STATE_ALIGN4 64
+#define XFRM_STATE_ESN 128
};
struct xfrm_usersa_id {
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d5dcf39..6dab7df 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -186,9 +186,11 @@ struct xfrm_state {
/* State for replay detection */
struct xfrm_replay_state replay;
+ struct xfrm_replay_state_esn *replay_esn;
/* Replay detection state at the time we sent the last notification */
struct xfrm_replay_state preplay;
+ struct xfrm_replay_state_esn *preplay_esn;
/* internal flag that only holds state for delayed aevent at the
* moment
@@ -1569,6 +1571,11 @@ static inline int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg)
return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
}
+static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn)
+{
+ return sizeof(*replay_esn) + replay_esn->bmp_len * sizeof(__u32);
+}
+
#ifdef CONFIG_XFRM_MIGRATE
static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
{
--
1.7.0.4
next prev parent reply other threads:[~2011-03-08 10:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 10:04 [RFC v2 PATCH 0/9] Add IPsec extended (64-bit) sequence numbers Steffen Klassert
2011-03-08 10:04 ` [RFC v2 PATCH 1/9] crypto: authencesn - Add algorithm to handle IPsec extended " Steffen Klassert
2011-03-13 6:30 ` Herbert Xu
2011-03-14 8:37 ` Steffen Klassert
2011-03-14 9:39 ` Herbert Xu
2011-03-14 10:02 ` Steffen Klassert
2011-03-08 10:05 ` Steffen Klassert [this message]
2011-03-13 6:44 ` [RFC v2 PATCH 2/9] xfrm: Add basic infrastructure to support " Herbert Xu
2011-03-13 6:53 ` David Miller
2011-03-13 6:58 ` Herbert Xu
2011-03-08 10:06 ` [RFC v2 PATCH 3/9] xfrm: Use separate low and high order bits of the sequence numbers in xfrm_skb_cb Steffen Klassert
2011-03-08 10:07 ` [RFC v2 PATCH 4/9] esp4: Add support for IPsec extended sequence numbers Steffen Klassert
2011-03-08 10:07 ` [RFC v2 PATCH 5/9] esp6: " Steffen Klassert
2011-03-08 10:08 ` [RFC v2 PATCH 6/9] xfrm: Move IPsec replay detection functions to a separate file Steffen Klassert
2011-03-08 10:09 ` [RFC v2 PATCH 7/9] xfrm: Support anti-replay window size bigger than 32 packets Steffen Klassert
2011-03-08 10:09 ` [RFC v2 PATCH 8/9] xfrm: Add support for IPsec extended sequence numbers Steffen Klassert
2011-03-08 10:10 ` [RFC v2 PATCH 9/9] xfrm: Add user interface for esn and big anti-replay windows Steffen Klassert
2011-03-08 10:12 ` [RFC PATCH] iproute2: Add IPsec extended sequence number support Steffen Klassert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110308100543.GD31402@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=abadea@ixiacom.com \
--cc=agruen@suse.de \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).