From ea2fba125c79be72d339b49aa83bde88103ce68c Mon Sep 17 00:00:00 2001
Message-Id: <ea2fba125c79be72d339b49aa83bde88103ce68c.1556708736.git.mjg@fedoraproject.org>
From: Michael J Gruber <mjg@fedoraproject.org>
Date: Sun, 3 Jun 2018 17:55:46 +0200
Subject: [PATCH] fix build on big endian

0dc1153 ("Spread of context into all procedures and removal from
structures", 2017-04-26) missed a few spots that are relevant on big
endian only.

Add the missing ContextIDs in the call chain so that the build succeeds
again.

Signed-off-by: Michael J Gruber <mjg@fedoraproject.org>
---
 src/cmsmd5.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/cmsmd5.c b/src/cmsmd5.c
index d3017ab..75caacb 100644
--- a/src/cmsmd5.c
+++ b/src/cmsmd5.c
@@ -29,7 +29,7 @@
 #ifdef CMS_USE_BIG_ENDIAN
 
 static
-void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
+void byteReverse(cmsContext ContextID, cmsUInt8Number * buf, cmsUInt32Number longs)
 {
     do {
 
@@ -42,7 +42,7 @@ void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
 }
 
 #else
-#define byteReverse(buf, len)
+#define byteReverse(ContextID, buf, len)
 #endif
 
 
@@ -169,7 +169,7 @@ cmsHANDLE  MD5alloc(cmsContext ContextID)
 
 
 static
-void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
+void MD5add(cmsContext ContextID, cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
 {
     _cmsMD5* ctx = (_cmsMD5*) Handle;
     cmsUInt32Number t;
@@ -193,7 +193,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
         }
 
         memmove(p, buf, t);
-        byteReverse(ctx->in, 16);
+        byteReverse(ContextID, ctx->in, 16);
 
         MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
         buf += t;
@@ -202,7 +202,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
 
     while (len >= 64) {
         memmove(ctx->in, buf, 64);
-        byteReverse(ctx->in, 16);
+        byteReverse(ContextID, ctx->in, 16);
         MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
         buf += 64;
         len -= 64;
@@ -229,21 +229,21 @@ void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID,  cmsHANDLE Handle)
     if (count < 8) {
 
         memset(p, 0, count);
-        byteReverse(ctx->in, 16);
+        byteReverse(ContextID, ctx->in, 16);
         MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
 
         memset(ctx->in, 0, 56);
     } else {
         memset(p, 0, count - 8);
     }
-    byteReverse(ctx->in, 14);
+    byteReverse(ContextID, ctx->in, 14);
 
     ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0];
     ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1];
 
     MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
 
-    byteReverse((cmsUInt8Number *) ctx->buf, 4);
+    byteReverse(ContextID, (cmsUInt8Number *) ctx->buf, 4);
     memmove(ProfileID ->ID8, ctx->buf, 16);
 
     _cmsFree(ContextID, ctx);
@@ -288,7 +288,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile)
     if (MD5 == NULL) goto Error;
 
     // Add all bytes
-    MD5add(MD5, Mem, BytesNeeded);
+    MD5add(ContextID,MD5, Mem, BytesNeeded);
 
     // Temp storage is no longer needed
     _cmsFree(ContextID, Mem);
-- 
2.21.0.1043.g4a4bfeb487

