Blame SOURCES/cups-fips-restrict-md5.patch

ad8523
diff --git a/cups/http-support.c b/cups/http-support.c
ad8523
index a4bc079..9ee2309 100644
ad8523
--- a/cups/http-support.c
ad8523
+++ b/cups/http-support.c
ad8523
@@ -1430,6 +1430,12 @@ _httpSetDigestAuthString(
ad8523
     * Use old RFC 2069 Digest method...
ad8523
     */
ad8523
 
ad8523
+    if (cg->digestoptions == _CUPS_DIGESTOPTIONS_DENYMD5)
ad8523
+    {
ad8523
+      DEBUG_puts("3_httpSetDigestAuthString: MD5 Digest is disabled.");
ad8523
+      return (0);
ad8523
+    }
ad8523
+
ad8523
     /* H(A1) = H(username:realm:password) */
ad8523
     snprintf(temp, sizeof(temp), "%s:%s:%s", username, http->realm, password);
ad8523
     hashsize = (size_t)cupsHashData("md5", (unsigned char *)temp, strlen(temp), hash, sizeof(hash));
ad8523
diff --git a/cups/md5passwd.c b/cups/md5passwd.c
ad8523
index 9af5de2..5c9a64e 100644
ad8523
--- a/cups/md5passwd.c
ad8523
+++ b/cups/md5passwd.c
ad8523
@@ -19,6 +19,9 @@
ad8523
 /*
ad8523
  * 'httpMD5()' - Compute the MD5 sum of the username:group:password.
ad8523
  *
ad8523
+ * The function was used for HTTP Digest authentication. Since CUPS 2.4.0
ad8523
+ * it produces an empty string. Please use @link cupsDoAuthentication@ instead.
ad8523
+ *
ad8523
  * @deprecated@
ad8523
  */
ad8523
 
ad8523
@@ -28,22 +31,13 @@ httpMD5(const char *username,		/* I - User name */
ad8523
         const char *passwd,		/* I - Password string */
ad8523
 	char       md5[33])		/* O - MD5 string */
ad8523
 {
ad8523
-  unsigned char		sum[16];	/* Sum data */
ad8523
-  char			line[256];	/* Line to sum */
ad8523
-
ad8523
-
ad8523
- /*
ad8523
-  * Compute the MD5 sum of the user name, group name, and password.
ad8523
-  */
ad8523
+  (void)username;
ad8523
+  (void)realm;
ad8523
+  (void)passwd;
ad8523
 
ad8523
-  snprintf(line, sizeof(line), "%s:%s:%s", username, realm, passwd);
ad8523
-  cupsHashData("md5", (unsigned char *)line, strlen(line), sum, sizeof(sum));
ad8523
+  md5[0] = '\0';
ad8523
 
ad8523
- /*
ad8523
-  * Return the sum...
ad8523
-  */
ad8523
-
ad8523
-  return ((char *)cupsHashString(sum, sizeof(sum), md5, 33));
ad8523
+  return (NULL);
ad8523
 }
ad8523
 
ad8523
 
ad8523
@@ -52,6 +46,9 @@ httpMD5(const char *username,		/* I - User name */
ad8523
  *                    with the server-supplied nonce value, method, and
ad8523
  *                    request-uri.
ad8523
  *
ad8523
+ * The function was used for HTTP Digest authentication. Since CUPS 2.4.0
ad8523
+ * it produces an empty string. Please use @link cupsDoAuthentication@ instead.
ad8523
+ *
ad8523
  * @deprecated@
ad8523
  */
ad8523
 
ad8523
@@ -61,35 +58,22 @@ httpMD5Final(const char *nonce,		/* I - Server nonce value */
ad8523
 	     const char *resource,	/* I - Resource path */
ad8523
              char       md5[33])	/* IO - MD5 sum */
ad8523
 {
ad8523
-  unsigned char		sum[16];	/* Sum data */
ad8523
-  char			line[1024];	/* Line of data */
ad8523
-  char			a2[33];		/* Hash of method and resource */
ad8523
-
ad8523
+  (void)nonce;
ad8523
+  (void)method;
ad8523
+  (void)resource;
ad8523
 
ad8523
- /*
ad8523
-  * First compute the MD5 sum of the method and resource...
ad8523
-  */
ad8523
+  md5[0] = '\0';
ad8523
 
ad8523
-  snprintf(line, sizeof(line), "%s:%s", method, resource);
ad8523
-  cupsHashData("md5", (unsigned char *)line, strlen(line), sum, sizeof(sum));
ad8523
-  cupsHashString(sum, sizeof(sum), a2, sizeof(a2));
ad8523
-
ad8523
- /*
ad8523
-  * Then combine A1 (MD5 of username, realm, and password) with the nonce
ad8523
-  * and A2 (method + resource) values to get the final MD5 sum for the
ad8523
-  * request...
ad8523
-  */
ad8523
-
ad8523
-  snprintf(line, sizeof(line), "%s:%s:%s", md5, nonce, a2);
ad8523
-  cupsHashData("md5", (unsigned char *)line, strlen(line), sum, sizeof(sum));
ad8523
-
ad8523
-  return ((char *)cupsHashString(sum, sizeof(sum), md5, 33));
ad8523
+  return (NULL);
ad8523
 }
ad8523
 
ad8523
 
ad8523
 /*
ad8523
  * 'httpMD5String()' - Convert an MD5 sum to a character string.
ad8523
  *
ad8523
+ * The function was used for HTTP Digest authentication. Since CUPS 2.4.0
ad8523
+ * it produces an empty string. Please use @link cupsDoAuthentication@ instead.
ad8523
+ *
ad8523
  * @deprecated@
ad8523
  */
ad8523
 
ad8523
@@ -98,5 +82,9 @@ httpMD5String(const unsigned char *sum,	/* I - MD5 sum data */
ad8523
               char                md5[33])
ad8523
 					/* O - MD5 sum in hex */
ad8523
 {
ad8523
-  return ((char *)cupsHashString(sum, 16, md5, 33));
ad8523
+  (void)sum;
ad8523
+
ad8523
+  md5[0] = '\0';
ad8523
+
ad8523
+  return (NULL);
ad8523
 }