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=605fe234954cd3068e4566012d2ba762df735174 The branch, master has been updated via 605fe234954cd3068e4566012d2ba762df735174 (commit) from 9321ddde48e3456000a4046999b992535b68ad99 (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 605fe234954cd3068e4566012d2ba762df735174 Author: Simon Josefsson <[email protected]> Date: Thu Sep 10 13:48:53 2009 +0200 SCRAM: Use printable nonces. ----------------------------------------------------------------------- Summary of changes: lib/scram/client.c | 25 +++++++------------------ lib/scram/server.c | 24 +++++++++--------------- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/lib/scram/client.c b/lib/scram/client.c index 6397af5..29034cc 100644 --- a/lib/scram/client.c +++ b/lib/scram/client.c @@ -37,7 +37,7 @@ #include "parser.h" #include "printer.h" -#define CNONCE_ENTROPY_BYTES 16 +#define CNONCE_ENTROPY_BYTES 18 struct scram_client_state { @@ -52,6 +52,7 @@ int _gsasl_scram_sha1_client_start (Gsasl_session * sctx, void **mech_data) { struct scram_client_state *state; + char buf[CNONCE_ENTROPY_BYTES]; size_t i; int rc; @@ -59,26 +60,14 @@ _gsasl_scram_sha1_client_start (Gsasl_session * sctx, void **mech_data) if (state == NULL) return GSASL_MALLOC_ERROR; - state->cf.client_nonce = malloc (CNONCE_ENTROPY_BYTES + 1); - if (!state->cf.client_nonce) - return GSASL_MALLOC_ERROR; - - rc = gsasl_nonce (state->cf.client_nonce, CNONCE_ENTROPY_BYTES); + rc = gsasl_nonce (buf, CNONCE_ENTROPY_BYTES); if (rc != GSASL_OK) return rc; - state->cf.client_nonce[CNONCE_ENTROPY_BYTES] = '\0'; - - for (i = 0; i < CNONCE_ENTROPY_BYTES; i++) - { - state->cf.client_nonce[i] &= 0x7f; - - if (state->cf.client_nonce[i] == '\0') - state->cf.client_nonce[i]++; - - if (state->cf.client_nonce[i] == ',') - state->cf.client_nonce[i]++; - } + rc = gsasl_base64_to (buf, CNONCE_ENTROPY_BYTES, + &state->cf.client_nonce, NULL); + if (rc != GSASL_OK) + return rc; *mech_data = state; diff --git a/lib/scram/server.c b/lib/scram/server.c index dd4b4d1..7a4f57d 100644 --- a/lib/scram/server.c +++ b/lib/scram/server.c @@ -41,12 +41,12 @@ #include "printer.h" #define DEFAULT_SALT_BYTES 8 -#define SNONCE_ENTROPY_BYTES 16 +#define SNONCE_ENTROPY_BYTES 18 struct scram_server_state { int step; - char snonce[SNONCE_ENTROPY_BYTES + 1]; + char *snonce; char salt[DEFAULT_SALT_BYTES + 1]; struct scram_client_first cf; struct scram_server_first sf; @@ -58,6 +58,7 @@ int _gsasl_scram_sha1_server_start (Gsasl_session * sctx, void **mech_data) { struct scram_server_state *state; + char buf[SNONCE_ENTROPY_BYTES]; size_t i; int rc; @@ -65,22 +66,14 @@ _gsasl_scram_sha1_server_start (Gsasl_session * sctx, void **mech_data) if (state == NULL) return GSASL_MALLOC_ERROR; - rc = gsasl_nonce (state->snonce, SNONCE_ENTROPY_BYTES); + rc = gsasl_nonce (buf, SNONCE_ENTROPY_BYTES); if (rc != GSASL_OK) return rc; - state->snonce[SNONCE_ENTROPY_BYTES] = '\0'; - - for (i = 0; i < SNONCE_ENTROPY_BYTES; i++) - { - state->snonce[i] &= 0x7f; - - if (state->snonce[i] == '\0') - state->snonce[i]++; - - if (state->snonce[i] == ',') - state->snonce[i]++; - } + rc = gsasl_base64_to (buf, SNONCE_ENTROPY_BYTES, + &state->snonce, NULL); + if (rc != GSASL_OK) + return rc; rc = gsasl_nonce (state->salt, DEFAULT_SALT_BYTES); if (rc != GSASL_OK) @@ -203,6 +196,7 @@ _gsasl_scram_sha1_server_finish (Gsasl_session * sctx, void *mech_data) if (!state) return; + free (state->snonce); scram_free_client_first (&state->cf); scram_free_server_first (&state->sf); scram_free_client_final (&state->cl); hooks/post-receive -- GNU gsasl _______________________________________________ Gsasl-commit mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gsasl-commit
