ANSIfy sys/kern/md4c.c
PR: 223453 Submitted by: ota@j.email.ne.jp MFC After: 2 weeks
This commit is contained in:
parent
571e134eea
commit
80dc9f8888
@ -90,8 +90,8 @@ static unsigned char PADDING[64] = {
|
|||||||
|
|
||||||
/* MD4 initialization. Begins an MD4 operation, writing a new context.
|
/* MD4 initialization. Begins an MD4 operation, writing a new context.
|
||||||
*/
|
*/
|
||||||
void MD4Init (context)
|
void
|
||||||
MD4_CTX *context; /* context */
|
MD4Init(MD4_CTX *context)
|
||||||
{
|
{
|
||||||
context->count[0] = context->count[1] = 0;
|
context->count[0] = context->count[1] = 0;
|
||||||
|
|
||||||
@ -107,10 +107,9 @@ MD4_CTX *context; /* context */
|
|||||||
operation, processing another message block, and updating the
|
operation, processing another message block, and updating the
|
||||||
context.
|
context.
|
||||||
*/
|
*/
|
||||||
void MD4Update (context, input, inputLen)
|
void
|
||||||
MD4_CTX *context; /* context */
|
MD4Update(MD4_CTX *context, const unsigned char *input,
|
||||||
const unsigned char *input; /* input block */
|
unsigned int inputLen)
|
||||||
unsigned int inputLen; /* length of input block */
|
|
||||||
{
|
{
|
||||||
unsigned int i, index, partLen;
|
unsigned int i, index, partLen;
|
||||||
|
|
||||||
@ -142,8 +141,8 @@ unsigned int inputLen; /* length of input block */
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* MD4 padding. */
|
/* MD4 padding. */
|
||||||
void MD4Pad (context)
|
void
|
||||||
MD4_CTX *context; /* context */
|
MD4Pad(MD4_CTX *context)
|
||||||
{
|
{
|
||||||
unsigned char bits[8];
|
unsigned char bits[8];
|
||||||
unsigned int index, padLen;
|
unsigned int index, padLen;
|
||||||
@ -164,7 +163,8 @@ MD4_CTX *context; /* context */
|
|||||||
/* MD4 finalization. Ends an MD4 message-digest operation, writing the
|
/* MD4 finalization. Ends an MD4 message-digest operation, writing the
|
||||||
the message digest and zeroizing the context.
|
the message digest and zeroizing the context.
|
||||||
*/
|
*/
|
||||||
void MD4Final (unsigned char digest[static 16], MD4_CTX *context)
|
void
|
||||||
|
MD4Final(unsigned char digest[static 16], MD4_CTX *context)
|
||||||
{
|
{
|
||||||
/* Do padding */
|
/* Do padding */
|
||||||
MD4Pad (context);
|
MD4Pad (context);
|
||||||
@ -179,9 +179,8 @@ void MD4Final (unsigned char digest[static 16], MD4_CTX *context)
|
|||||||
|
|
||||||
/* MD4 basic transformation. Transforms state based on block.
|
/* MD4 basic transformation. Transforms state based on block.
|
||||||
*/
|
*/
|
||||||
static void MD4Transform (state, block)
|
static void
|
||||||
UINT4 state[4];
|
MD4Transform(UINT4 state[4], const unsigned char block[64])
|
||||||
const unsigned char block[64];
|
|
||||||
{
|
{
|
||||||
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
||||||
|
|
||||||
@ -254,10 +253,8 @@ const unsigned char block[64];
|
|||||||
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
|
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
|
||||||
a multiple of 4.
|
a multiple of 4.
|
||||||
*/
|
*/
|
||||||
static void Encode (output, input, len)
|
static void
|
||||||
unsigned char *output;
|
Encode(unsigned char *output, UINT4 *input, unsigned int len)
|
||||||
UINT4 *input;
|
|
||||||
unsigned int len;
|
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
@ -272,11 +269,8 @@ unsigned int len;
|
|||||||
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
|
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
|
||||||
a multiple of 4.
|
a multiple of 4.
|
||||||
*/
|
*/
|
||||||
static void Decode (output, input, len)
|
static void
|
||||||
|
Decode(UINT4 *output, const unsigned char *input, unsigned int len)
|
||||||
UINT4 *output;
|
|
||||||
const unsigned char *input;
|
|
||||||
unsigned int len;
|
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user