gsasl-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gsasl branch, master, updated. gsasl-1-2-64-g9321ddd


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-2-64-g9321ddd
Date: Thu, 10 Sep 2009 10:17:56 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gsasl".

http://git.savannah.gnu.org/cgit/gsasl.git/commit/?id=9321ddde48e3456000a4046999b992535b68ad99

The branch, master has been updated
       via  9321ddde48e3456000a4046999b992535b68ad99 (commit)
      from  e720d54c60bd845e2e6756dcb75b080982477a3f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9321ddde48e3456000a4046999b992535b68ad99
Author: Simon Josefsson <address@hidden>
Date:   Thu Sep 10 12:17:52 2009 +0200

    SCRAM: Support iter/salt setting better.

-----------------------------------------------------------------------

Summary of changes:
 lib/scram/server.c |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/lib/scram/server.c b/lib/scram/server.c
index 147f624..dd4b4d1 100644
--- a/lib/scram/server.c
+++ b/lib/scram/server.c
@@ -27,9 +27,12 @@
 /* Get specification. */
 #include "scram.h"
 
-/* Get malloc, free. */
+/* Get malloc, free, strtoul. */
 #include <stdlib.h>
 
+/* Get ULONG_MAX. */
+#include <limits.h>
+
 /* Get memcpy, strdup, strlen. */
 #include <string.h>
 
@@ -37,12 +40,14 @@
 #include "parser.h"
 #include "printer.h"
 
+#define DEFAULT_SALT_BYTES 8
 #define SNONCE_ENTROPY_BYTES 16
 
 struct scram_server_state
 {
   int step;
   char snonce[SNONCE_ENTROPY_BYTES + 1];
+  char salt[DEFAULT_SALT_BYTES + 1];
   struct scram_client_first cf;
   struct scram_server_first sf;
   struct scram_client_final cl;
@@ -77,6 +82,23 @@ _gsasl_scram_sha1_server_start (Gsasl_session * sctx, void 
**mech_data)
        state->snonce[i]++;
     }
 
+  rc = gsasl_nonce (state->salt, DEFAULT_SALT_BYTES);
+  if (rc != GSASL_OK)
+    return rc;
+
+  state->salt[DEFAULT_SALT_BYTES] = '\0';
+
+  for (i = 0; i < DEFAULT_SALT_BYTES; i++)
+    {
+      state->salt[i] &= 0x7f;
+
+      if (state->salt[i] == '\0')
+       state->salt[i]++;
+
+      if (state->salt[i] == ',')
+       state->salt[i]++;
+    }
+
   *mech_data = state;
 
   return GSASL_OK;
@@ -120,9 +142,21 @@ _gsasl_scram_sha1_server_step (Gsasl_session * sctx,
          state->sf.nonce[cnlen + SNONCE_ENTROPY_BYTES] = '\0';
        }
 
-       /* FIXME */
-       state->sf.iter = 128;
-       state->sf.salt = strdup ("salt");
+       {
+         const char *p = gsasl_property_get (sctx, GSASL_SCRAM_ITER);
+         if (p)
+           state->sf.iter = strtoul (p, NULL, 10);
+         if (!p || state->sf.iter == 0 || state->sf.iter == ULONG_MAX)
+           state->sf.iter = 4096;
+       }
+
+       {
+         const char *p = gsasl_property_get (sctx, GSASL_SCRAM_SALT);
+         if (p)
+           state->sf.salt = strdup (p);
+         else
+           state->sf.salt = strdup (state->salt);
+       }
 
        rc = scram_print_server_first (&state->sf, output);
        if (rc != 0)


hooks/post-receive
-- 
GNU gsasl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]