summaryrefslogtreecommitdiff
path: root/glib/ghmac.c
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-02-10 10:45:56 +0000
committerIgor Gnatenko <ignatenko@src.gnome.org>2017-02-20 12:40:26 +0100
commit77945667f70d85e1d95e111a601834d768c0982b (patch)
tree76db3dd43072f69cdd04f6fe95a5968881aa558b /glib/ghmac.c
parent1f9a9f8ce56a7996eea67a2d79ce70f03ecc61ac (diff)
downloadglib-77945667f70d85e1d95e111a601834d768c0982b.tar.gz
ghmac: Add support for G_CHECKSUM_SHA384 to GHmac
It has the same block size as SHA-512, so it just needs a new case in the switch, some documentation updates, and the test vectors from RFC 4868. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=771997
Diffstat (limited to 'glib/ghmac.c')
-rw-r--r--glib/ghmac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/glib/ghmac.c b/glib/ghmac.c
index bc498ffd7..a4177329a 100644
--- a/glib/ghmac.c
+++ b/glib/ghmac.c
@@ -50,7 +50,7 @@
* Both the key and data are arbitrary byte arrays of bytes or characters.
*
* Support for HMAC Digests has been added in GLib 2.30, and support for SHA-512
- * in GLib 2.42.
+ * in GLib 2.42. Support for SHA-384 was added in GLib 2.51.
*/
struct _GHmac
@@ -82,6 +82,7 @@ struct _GHmac
* on it anymore.
*
* Support for digests of type %G_CHECKSUM_SHA512 has been added in GLib 2.42.
+ * Support for %G_CHECKSUM_SHA384 was added in GLib 2.51.
*
* Returns: the newly created #GHmac, or %NULL.
* Use g_hmac_unref() to free the memory allocated by it.
@@ -112,6 +113,7 @@ g_hmac_new (GChecksumType digest_type,
case G_CHECKSUM_SHA256:
block_size = 64; /* RFC 4868 */
break;
+ case G_CHECKSUM_SHA384:
case G_CHECKSUM_SHA512:
block_size = 128; /* RFC 4868 */
break;