Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 672998
Collapse All | Expand All

(-)a/src/cmsmd5.c (-12 / +11 lines)
Lines 29-35 Link Here
29
#ifdef CMS_USE_BIG_ENDIAN
29
#ifdef CMS_USE_BIG_ENDIAN
30
30
31
static
31
static
32
void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
32
void byteReverse(cmsContext ContextID, cmsUInt8Number * buf, cmsUInt32Number longs)
33
{
33
{
34
    do {
34
    do {
35
35
Lines 42-48 void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs) Link Here
42
}
42
}
43
43
44
#else
44
#else
45
#define byteReverse(buf, len)
45
#define byteReverse(ContextID, buf, len)
46
#endif
46
#endif
47
47
48
48
Lines 172-178 cmsHANDLE MD5alloc(cmsContext ContextID) Link Here
172
172
173
173
174
static
174
static
175
void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
175
void MD5add(cmsContext ContextID, cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
176
{
176
{
177
    _cmsMD5* ctx = (_cmsMD5*) Handle;
177
    _cmsMD5* ctx = (_cmsMD5*) Handle;
178
    cmsUInt32Number t;
178
    cmsUInt32Number t;
Lines 196-202 void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) Link Here
196
        }
196
        }
197
197
198
        memmove(p, buf, t);
198
        memmove(p, buf, t);
199
        byteReverse(ctx->in, 16);
199
        byteReverse(ContextID, ctx->in, 16);
200
200
201
        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
201
        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
202
        buf += t;
202
        buf += t;
Lines 205-211 void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) Link Here
205
205
206
    while (len >= 64) {
206
    while (len >= 64) {
207
        memmove(ctx->in, buf, 64);
207
        memmove(ctx->in, buf, 64);
208
        byteReverse(ctx->in, 16);
208
        byteReverse(ContextID, ctx->in, 16);
209
        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
209
        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
210
        buf += 64;
210
        buf += 64;
211
        len -= 64;
211
        len -= 64;
Lines 216-222 void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) Link Here
216
216
217
// Destroy the object and return the checksum
217
// Destroy the object and return the checksum
218
static
218
static
219
void MD5finish(cmsProfileID* ProfileID,  cmsHANDLE Handle)
219
void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID,  cmsHANDLE Handle)
220
{
220
{
221
    _cmsMD5* ctx = (_cmsMD5*) Handle;
221
    _cmsMD5* ctx = (_cmsMD5*) Handle;
222
    cmsUInt32Number count;
222
    cmsUInt32Number count;
Lines 232-252 void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle) Link Here
232
    if (count < 8) {
232
    if (count < 8) {
233
233
234
        memset(p, 0, count);
234
        memset(p, 0, count);
235
        byteReverse(ctx->in, 16);
235
        byteReverse(ContextID, ctx->in, 16);
236
        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
236
        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
237
237
238
        memset(ctx->in, 0, 56);
238
        memset(ctx->in, 0, 56);
239
    } else {
239
    } else {
240
        memset(p, 0, count - 8);
240
        memset(p, 0, count - 8);
241
    }
241
    }
242
    byteReverse(ctx->in, 14);
242
    byteReverse(ContextID, ctx->in, 14);
243
243
244
    ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0];
244
    ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0];
245
    ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1];
245
    ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1];
246
246
247
    MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
247
    MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
248
248
249
    byteReverse((cmsUInt8Number *) ctx->buf, 4);
249
    byteReverse(ContextID, (cmsUInt8Number *) ctx->buf, 4);
250
    memmove(ProfileID ->ID8, ctx->buf, 16);
250
    memmove(ProfileID ->ID8, ctx->buf, 16);
251
251
252
    _cmsFree(ctx ->ContextID, ctx);
252
    _cmsFree(ctx ->ContextID, ctx);
Lines 291-297 cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile) Link Here
291
    if (MD5 == NULL) goto Error;
291
    if (MD5 == NULL) goto Error;
292
292
293
    // Add all bytes
293
    // Add all bytes
294
    MD5add(MD5, Mem, BytesNeeded);
294
    MD5add(ContextID,MD5, Mem, BytesNeeded);
295
295
296
    // Temp storage is no longer needed
296
    // Temp storage is no longer needed
297
    _cmsFree(ContextID, Mem);
297
    _cmsFree(ContextID, Mem);
Lines 300-306 cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile) Link Here
300
    memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
300
    memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
301
301
302
    // And store the ID
302
    // And store the ID
303
    MD5finish(&Icc ->ProfileID,  MD5);
303
    MD5finish(ContextID, &Icc ->ProfileID,  MD5);
304
    return TRUE;
304
    return TRUE;
305
305
306
Error:
306
Error:
307
- 

Return to bug 672998