After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771997 - gchecksum: Add SHA-384 support
gchecksum: Add SHA-384 support
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-09-26 17:55 UTC by Igor Gnatenko
Modified: 2017-02-26 10:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gchecksum: Adds SHA-384 support (28.94 KB, patch)
2016-09-26 17:55 UTC, Igor Gnatenko
needs-work Details | Review
gchecksum: Add SHA-384 support (29.02 KB, patch)
2016-10-05 13:48 UTC, Igor Gnatenko
needs-work Details | Review
gchecksum: Adds SHA-384 support (28.90 KB, patch)
2017-02-07 10:31 UTC, Igor Gnatenko
none Details | Review
gchecksum: add SHA-384 support (28.90 KB, patch)
2017-02-07 10:32 UTC, Igor Gnatenko
committed Details | Review
ghmac: Add support for G_CHECKSUM_SHA384 to GHmac (7.81 KB, patch)
2017-02-10 10:47 UTC, Philip Withnall
committed Details | Review

Description Igor Gnatenko 2016-09-26 17:55:05 UTC
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Comment 1 Igor Gnatenko 2016-09-26 17:55:09 UTC
Created attachment 336292 [details] [review]
gchecksum: Adds SHA-384 support
Comment 2 Matthias Clasen 2016-09-26 18:30:32 UTC
Do you have a use case where this is important to have ?
Comment 3 Igor Gnatenko 2016-09-26 19:02:34 UTC
libdnf (former libhif) -> hence rpm-ostree and dnf should have support for sha384 repo checksums.
Comment 4 Christian Persch 2016-10-04 15:56:28 UTC
@@ -47,6 +48,7 @@ typedef enum {
   G_CHECKSUM_MD5,
   G_CHECKSUM_SHA1,
   G_CHECKSUM_SHA256,
+  G_CHECKSUM_SHA384,
   G_CHECKSUM_SHA512
 } GChecksumType;

This breaks the ABI since it changes the SHA512 enum value.
Comment 5 Igor Gnatenko 2016-10-04 16:18:11 UTC
(In reply to Christian Persch from comment #4)
> @@ -47,6 +48,7 @@ typedef enum {
>    G_CHECKSUM_MD5,
>    G_CHECKSUM_SHA1,
>    G_CHECKSUM_SHA256,
> +  G_CHECKSUM_SHA384,
>    G_CHECKSUM_SHA512
>  } GChecksumType;
> 
> This breaks the ABI since it changes the SHA512 enum value.
Oh, I will reorder it.
Comment 6 Matthias Clasen 2016-10-05 13:40:12 UTC
(In reply to Igor Gnatenko from comment #3)
> libdnf (former libhif) -> hence rpm-ostree and dnf should have support for
> sha384 repo checksums.

Ok, if we have a user, seems fine to add
Comment 7 Igor Gnatenko 2016-10-05 13:48:02 UTC
Created attachment 336984 [details] [review]
gchecksum: Add SHA-384 support

v2: Put G_CHECKSUM_SHA384 after G_CHECKSUM_SHA512 to not break ABI.

References: https://bugzilla.gnome.org/show_bug.cgi?id=771997
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Comment 8 Matthias Clasen 2016-10-05 14:05:40 UTC
Review of attachment 336984 [details] [review]:

ok. thanks for adding tests. Please hold off with committing until I have done a 2.50.1 and branched
Comment 9 Igor Gnatenko 2016-10-05 14:20:53 UTC
I reuse Sha512sum* for SHA384, so probably should reuse sha512_sum_digest(), but then it would memcpy() 512 bits instead of 384, but then we could have less error-possibility in the code.
Comment 10 Matthias Clasen 2016-10-12 19:49:23 UTC
master is open now
Comment 11 Sébastien Wilmet 2016-12-27 19:42:02 UTC
Review of attachment 336984 [details] [review]:

The unit test fails:

/checksum/SHA384/0: OK
/checksum/SHA384/1: OK
/checksum/SHA384/2: 
(/home/seb/gnome/glib/glib/tests/.libs/lt-checksum:5552): GLib-CRITICAL **: g_checksum_update: assertion 'checksum != NULL' failed
Comment 12 Igor Gnatenko 2017-02-07 10:31:46 UTC
Created attachment 345092 [details] [review]
gchecksum: Adds SHA-384 support

Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Comment 13 Igor Gnatenko 2017-02-07 10:32:50 UTC
Created attachment 345093 [details] [review]
gchecksum: add SHA-384 support

Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Comment 14 Igor Gnatenko 2017-02-07 10:33:53 UTC
(In reply to Sébastien Wilmet from comment #11)
> Review of attachment 336984 [details] [review] [review]:
> 
> The unit test fails:
> 
> /checksum/SHA384/0: OK
> /checksum/SHA384/1: OK
> /checksum/SHA384/2: 
> (/home/seb/gnome/glib/glib/tests/.libs/lt-checksum:5552): GLib-CRITICAL **:
> g_checksum_update: assertion 'checksum != NULL' failed
I can't reproduce this one... But anyway I rebased on top of master, double-checked it and ran tests and non fails.
Comment 15 Philip Withnall 2017-02-10 10:44:45 UTC
Review of attachment 345093 [details] [review]:

Looks good to commit now that master is open. The tests pass.
Comment 16 Philip Withnall 2017-02-10 10:47:47 UTC
Created attachment 345417 [details] [review]
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>
Comment 17 Philip Withnall 2017-02-10 10:49:56 UTC
We’d better add GHmac support for SHA-384 at the same time, otherwise calling g_hmac_new(G_CHECKSUM_SHA384) will cause an assertion failure. Simple patch attached.
Comment 18 Igor Gnatenko 2017-02-20 11:41:21 UTC
Pushed in master:

* 77945667f ghmac: Add support for G_CHECKSUM_SHA384 to GHmac
* 1f9a9f8ce gchecksum: add SHA-384 support
Comment 19 Christian Persch 2017-02-26 09:51:23 UTC
@@ -47,6 +48,7 @@ typedef enum {
   G_CHECKSUM_MD5,
   G_CHECKSUM_SHA1,
   G_CHECKSUM_SHA256,
+  G_CHECKSUM_SHA384,
   G_CHECKSUM_SHA512
 } GChecksumType;

So commit 1f9a9f8ce56a7996eea67a2d79ce70f03ecc61ac broke the ABI, as I had already pointed out in comment 4.
Comment 20 Christian Persch 2017-02-26 09:54:02 UTC
And it uses Since: 2.51 whereas usually we use the stable version number, not the unstable one.
Comment 21 Igor Gnatenko 2017-02-26 10:54:28 UTC
(In reply to Christian Persch from comment #20)
> And it uses Since: 2.51 whereas usually we use the stable version number,
> not the unstable one.
Oh god, why it made there? I've fixed it before.. =(

So sorry about this.

* 3e32350b5 gchecksum: don't break ABI by inserting new enum member in the middle