[PATCH 07/28] gss_krb5: Use random value to initialize confounder
Kevin Coffman
kwc at citi.umich.edu
Mon Mar 31 10:31:28 EDT 2008
Initialize the value used for the confounder to a random value
rather than starting from zero.
Allow for confounders of length 8 or 16 (which will be needed for AES).
Signed-off-by: Kevin Coffman <kwc at citi.umich.edu>
---
net/sunrpc/auth_gss/gss_krb5_wrap.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 3cd99a7..89338a4 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -88,7 +88,7 @@ out:
}
static inline void
-make_confounder(char *p, int blocksize)
+make_confounder(char *p, int conflen)
{
static u64 i = 0;
u64 *q = (u64 *)p;
@@ -102,8 +102,19 @@ make_confounder(char *p, int blocksize)
* uniqueness would mean worrying about atomicity and rollover, and I
* don't care enough. */
- BUG_ON(blocksize != 8);
- *q = i++;
+ /* initialize to random value */
+ if (i == 0) {
+ i = random32();
+ i = (i << 32) | random32();
+ }
+
+ if (conflen == 8)
+ *q = i++;
+ else if (conflen == 16) {
+ *q++ = i++;
+ *q++ = i++;
+ } else
+ BUG();
}
/* Assumptions: the head and tail of inbuf are ours to play with.
More information about the NFSv4
mailing list