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-73-gd6dc44a


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-2-73-gd6dc44a
Date: Thu, 10 Sep 2009 13:09:48 +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=d6dc44a2fa20b3a8d7c8e44343a573afcd8c2693

The branch, master has been updated
       via  d6dc44a2fa20b3a8d7c8e44343a573afcd8c2693 (commit)
      from  624e503864ac13347e5f8009af00ab64b8b80e99 (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 d6dc44a2fa20b3a8d7c8e44343a573afcd8c2693
Author: Simon Josefsson <address@hidden>
Date:   Thu Sep 10 15:09:43 2009 +0200

    Add SHA-1 APIs.

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

Summary of changes:
 lib/NEWS         |    5 +++++
 lib/src/crypto.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 lib/src/gsasl.h  |    5 +++++
 3 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/lib/NEWS b/lib/NEWS
index a43fdb2..9ae17d9 100644
--- a/lib/NEWS
+++ b/lib/NEWS
@@ -7,9 +7,14 @@ See the end for copying conditions.
 ** libgsasl: Implement SCRAM-SHA-1.
 New properties are GSASL_SCRAM_ITER and GSASL_SCRAM_SALT.
 
+** libgsasl: Add helper APIs for SHA-1 and HMAC-SHA-1.
+New functions are gsasl_sha1 and gsasl_hmac_sha1.
+
 ** API and ABI modifications.
 GSASL_SCRAM_ITER: ADDED.
 GSASL_SCRAM_SALT: ADDED.
+gsasl_sha1: ADDED.
+gsasl_hmac_sha1: ADDED.
 
 * Version 1.2 (released 2009-06-13)
 
diff --git a/lib/src/crypto.c b/lib/src/crypto.c
index 1ed7f28..fc5e553 100644
--- a/lib/src/crypto.c
+++ b/lib/src/crypto.c
@@ -97,3 +97,46 @@ gsasl_hmac_md5 (const char *key, size_t keylen,
     return GSASL_MALLOC_ERROR;
   return gc_hmac_md5 (key, keylen, in, inlen, *outhash);
 }
+
+/**
+ * gsasl_sha1:
+ * @in: input character array of data to hash.
+ * @inlen: length of input character array of data to hash.
+ * @out: newly allocated character array with hash of data.
+ *
+ * Compute hash of data using SHA1.  The @out buffer must be
+ * deallocated by the caller.
+ *
+ * Return value: Returns %GSASL_OK iff successful.
+ **/
+int
+gsasl_sha1 (const char *in, size_t inlen, char *out[20])
+{
+  *out = malloc (20);
+  if (!*out)
+    return GSASL_MALLOC_ERROR;
+  return gc_sha1 (in, inlen, *out);
+}
+
+/**
+ * gsasl_hmac_sha1:
+ * @key: input character array with key to use.
+ * @keylen: length of input character array with key to use.
+ * @in: input character array of data to hash.
+ * @inlen: length of input character array of data to hash.
+ * @outhash: newly allocated character array with keyed hash of data.
+ *
+ * Compute keyed checksum of data using HMAC-SHA1.  The @outhash buffer
+ * must be deallocated by the caller.
+ *
+ * Return value: Returns %GSASL_OK iff successful.
+ **/
+int
+gsasl_hmac_sha1 (const char *key, size_t keylen,
+               const char *in, size_t inlen, char *outhash[20])
+{
+  *outhash = malloc (20);
+  if (!*outhash)
+    return GSASL_MALLOC_ERROR;
+  return gc_hmac_sha1 (key, keylen, in, inlen, *outhash);
+}
diff --git a/lib/src/gsasl.h b/lib/src/gsasl.h
index 32591f2..7931d7d 100644
--- a/lib/src/gsasl.h
+++ b/lib/src/gsasl.h
@@ -320,6 +320,11 @@ extern "C"
   extern GSASL_API int gsasl_hmac_md5 (const char *key, size_t keylen,
                                       const char *in, size_t inlen,
                                       char *outhash[16]);
+  extern GSASL_API int gsasl_sha1 (const char *in, size_t inlen,
+                                  char *out[20]);
+  extern GSASL_API int gsasl_hmac_sha1 (const char *key, size_t keylen,
+                                       const char *in, size_t inlen,
+                                       char *outhash[20]);
   extern GSASL_API void gsasl_free (void *ptr);
 
   /* Get the mechanism API. */


hooks/post-receive
-- 
GNU gsasl




reply via email to

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