From 77945667f70d85e1d95e111a601834d768c0982b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 10 Feb 2017 10:45:56 +0000 Subject: 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 https://bugzilla.gnome.org/show_bug.cgi?id=771997 --- glib/ghmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'glib/ghmac.c') 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; -- cgit v1.2.1