/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* MD4C.C - RSA Data Security, Inc., MD4 message-digest algorithm
*/
/*
* Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD4 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
*/
#ifdef _KERNEL
#else
#include <strings.h>
#endif /* _KERNEL */
#define UNALIGNED_POINTERS_PERMITTED
#endif
/*
* Constants for MD4Transform routine.
*/
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/*
* F, G and H are basic MD4 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
/*
* ROTATE_LEFT rotates x left n bits.
*/
/* FF, GG and HH are transformations for rounds 1, 2 and 3 */
/* Rotation is separate from addition to prevent recomputation */
#define FF(a, b, c, d, x, s) { \
(a) += F((b), (c), (d)) + (x); \
(a) = ROTATE_LEFT((a), (s)); \
}
#define GG(a, b, c, d, x, s) { \
(a) += G((b), (c), (d)) + (x) + (uint32_t)0x5a827999; \
(a) = ROTATE_LEFT((a), (s)); \
}
#define HH(a, b, c, d, x, s) { \
(a) += H((b), (c), (d)) + (x) + (uint32_t)0x6ed9eba1; \
(a) = ROTATE_LEFT((a), (s)); \
}
/*
* MD4 initialization. Begins an MD4 operation, writing a new context.
*/
void
{
/*
* Load magic initialization constants.
*/
}
/*
* MD4 block update operation. Continues an MD4 message-digest
* operation, processing another message block, and updating the
* context.
*/
void
{
/* Compute number of bytes mod 64 */
/* Update number of bits */
/*
* Transform as many times as possible.
*/
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
}
/*
* MD4 finalization. Ends an MD4 message-digest operation, writing the
* the message digest and zeroizing the context.
*/
void
{
/* Save number of bits */
/*
* Pad out to 56 mod 64.
*/
/* Append length (before padding) */
/* Store state in digest */
/* zeroize sensitive information */
}
/*
* MD4 basic transformation. Transforms state based on block.
*/
static void
{
/* Round 1 */
/* Round 2 */
/* Round 3 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* zeroize sensitive information */
bzero(x, sizeof (*x));
}
/*
* Encodes input (uint32_t) into output (unsigned char). Assumes len is
* a multiple of 4.
*/
static void
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
#if defined(_LITTLE_ENDIAN) && defined(UNALIGNED_POINTERS_PERMITTED)
#else
/* endian-independent code */
#endif /* _LITTLE_ENDIAN && UNALIGNED_POINTERS_PERMITTED */
}
}
/*
* Decodes input (unsigned char) into output (uint32_t). Assumes len is
* a multiple of 4.
*/
static void
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
#if defined(_LITTLE_ENDIAN) && defined(UNALIGNED_POINTERS_PERMITTED)
#else
/* endian-independent code */
#endif /* _LITTLE_ENDIAN && UNALIGNED_POINTERS_PERMITTED */
}
}