Blame SOURCES/gnutls-3.3.29-dummy-wait-account-len-field.patch

519d7d
diff --git a/lib/algorithms/mac.c b/lib/algorithms/mac.c
519d7d
index 0527ca4f1..a39acd49f 100644
519d7d
--- a/lib/algorithms/mac.c
519d7d
+++ b/lib/algorithms/mac.c
519d7d
@@ -37,9 +37,9 @@ static const mac_entry_st hash_algorithms[] = {
519d7d
 	{"SHA256", HASH_OID_SHA256, MAC_OID_SHA256, GNUTLS_MAC_SHA256, 32, 32, 0, 0, 1,
519d7d
 	 64},
519d7d
 	{"SHA384", HASH_OID_SHA384, MAC_OID_SHA384, GNUTLS_MAC_SHA384, 48, 48, 0, 0, 1,
519d7d
-	 64},
519d7d
+	 128},
519d7d
 	{"SHA512", HASH_OID_SHA512, MAC_OID_SHA512, GNUTLS_MAC_SHA512, 64, 64, 0, 0, 1,
519d7d
-	 64},
519d7d
+	 128},
519d7d
 	{"SHA224", HASH_OID_SHA224, MAC_OID_SHA224, GNUTLS_MAC_SHA224, 28, 28, 0, 0, 1,
519d7d
 	 64},
519d7d
 	{"UMAC-96", NULL, NULL, GNUTLS_MAC_UMAC_96, 12, 16, 8, 0, 1, 0},
519d7d
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
519d7d
index 58ce79775..37478a4c3 100644
519d7d
--- a/lib/gnutls_cipher.c
519d7d
+++ b/lib/gnutls_cipher.c
519d7d
@@ -440,7 +440,7 @@ static void dummy_wait(record_parameters_st * params,
519d7d
 {
519d7d
 	/* this hack is only needed on CBC ciphers */
519d7d
 	if (_gnutls_cipher_is_block(params->cipher) == CIPHER_BLOCK) {
519d7d
-		unsigned len;
519d7d
+		unsigned len, v;
519d7d
 
519d7d
 		/* force an additional hash compression function evaluation to prevent timing 
519d7d
 		 * attacks that distinguish between wrong-mac + correct pad, from wrong-mac + incorrect pad.
519d7d
@@ -448,11 +448,14 @@ static void dummy_wait(record_parameters_st * params,
519d7d
 		if (pad_failed == 0 && pad > 0) {
519d7d
 			len = _gnutls_mac_block_size(params->mac);
519d7d
 			if (len > 0) {
519d7d
-				/* This is really specific to the current hash functions.
519d7d
-				 * It should be removed once a protocol fix is in place.
519d7d
-				 */
519d7d
-				if ((pad + total) % len > len - 9
519d7d
-				    && total % len <= len - 9) {
519d7d
+				if (params->mac && params->mac->id == GNUTLS_MAC_SHA384)
519d7d
+					/* v = 1 for the hash function padding + 16 for message length */
519d7d
+					v = 17;
519d7d
+				else /* v = 1 for the hash function padding + 8 for message length */
519d7d
+					v = 9;
519d7d
+
519d7d
+				if ((pad + total) % len > len - v
519d7d
+				    && total % len <= len - v) {
519d7d
 					if (len < plaintext->size)
519d7d
 						_gnutls_auth_cipher_add_auth
519d7d
 						    (&params->read.
519d7d
-- 
519d7d
2.14.3
519d7d