mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
tweaks to the MD5 routines; they need to be exported when building a windows DLL since the seekable stream decoder in libOggFLAC secretly uses them
This commit is contained in:
@@ -59,7 +59,7 @@ static FLAC__bool is_big_endian_host_;
|
||||
*/
|
||||
FLaC__INLINE
|
||||
void
|
||||
MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
|
||||
FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
|
||||
{
|
||||
register FLAC__uint32 a, b, c, d;
|
||||
|
||||
@@ -163,7 +163,7 @@ byteSwap(FLAC__uint32 *buf, unsigned words)
|
||||
* initialization constants.
|
||||
*/
|
||||
void
|
||||
MD5Init(struct MD5Context *ctx)
|
||||
FLAC__MD5Init(struct FLAC__MD5Context *ctx)
|
||||
{
|
||||
FLAC__uint32 test = 1;
|
||||
|
||||
@@ -186,7 +186,7 @@ MD5Init(struct MD5Context *ctx)
|
||||
* of bytes.
|
||||
*/
|
||||
void
|
||||
MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
FLAC__MD5Update(struct FLAC__MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
{
|
||||
FLAC__uint32 t;
|
||||
|
||||
@@ -204,7 +204,7 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
/* First chunk is an odd size */
|
||||
memcpy((md5byte *)ctx->in + 64 - t, buf, t);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
|
||||
@@ -212,7 +212,7 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
@@ -222,10 +222,10 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the incoming audio signal to a byte stream and MD5Update it.
|
||||
* Convert the incoming audio signal to a byte stream and FLAC__MD5Update it.
|
||||
*/
|
||||
FLAC__bool
|
||||
FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
|
||||
FLAC__MD5Accumulate(struct FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
|
||||
{
|
||||
unsigned channel, sample, a_byte;
|
||||
FLAC__int32 a_word;
|
||||
@@ -268,7 +268,7 @@ FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 * const signal[],
|
||||
}
|
||||
}
|
||||
|
||||
MD5Update(ctx, ctx->internal_buf, bytes_needed);
|
||||
FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 * const signal[],
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void
|
||||
MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
||||
FLAC__MD5Final(md5byte digest[16], struct FLAC__MD5Context *ctx)
|
||||
{
|
||||
int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
|
||||
md5byte *p = (md5byte *)ctx->in + count;
|
||||
@@ -292,7 +292,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
||||
if (count < 0) { /* Padding forces an extra block */
|
||||
memset(p, 0, count + 8);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
p = (md5byte *)ctx->in;
|
||||
count = 56;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
||||
/* Append length in bits and transform */
|
||||
ctx->in[14] = ctx->bytes[0] << 3;
|
||||
ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
|
||||
byteSwap(ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
|
||||
Reference in New Issue
Block a user