Fix gnutls-hmac.patch

This commit is contained in:
Michael Catanzaro 2022-07-14 18:03:02 -05:00
parent 34b203d549
commit 75642e63a7

View File

@ -1025,15 +1025,15 @@ index 3ac3206df..2fa447984 100644
+ GHmac *copy;
+
+ /* No MD5 in FIPS mode. */
+ hmac = g_hmac_new (G_CHECKSUM_MD5, "abc123", sizeof ("abc123"));
+ hmac = g_hmac_new (G_CHECKSUM_MD5, (guchar *)"abc123", sizeof ("abc123"));
+ g_assert_null (hmac);
+
+ /* SHA-256 should be good. */
+ hmac = g_hmac_new (G_CHECKSUM_SHA256, "abc123", sizeof ("abc123"));
+ hmac = g_hmac_new (G_CHECKSUM_SHA256, (guchar *)"abc123", sizeof ("abc123"));
+ g_assert_nonnull (hmac);
+
+ /* Ensure g_hmac_update() does not crash when called with -1. */
+ g_hmac_update (hmac, "You win again, gravity!", -1);
+ g_hmac_update (hmac, (guchar *)"You win again, gravity!", -1);
+
+ /* Ensure g_hmac_copy() does not crash. */
+ copy = g_hmac_copy (hmac);