/****************************************************************
 ****************************************************************
 **                                                            **
 **    (C)Copyright 2005-2006, American Megatrends Inc.        **
 **                                                            **
 **            All Rights Reserved.                            **
 **                                                            **
 **        6145-F, Northbelt Parkway, Norcross,                **
 **                                                            **
 **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
 **                                                            **
 ****************************************************************
 ****************************************************************/
/*****************************************************************
 *
 * MD.h
 * Message Digest Functions
 *
 * Author: Govind Kothandapani <govindk@ami.com>
 * 		 : Rama Bisa <ramab@ami.com>
 *       : Basavaraj Astekar <basavaraja@ami.com>
 *       : Bakka Ravinder Reddy <bakkar@ami.com>
 *
 *****************************************************************/
#ifndef MD_H
#define MD_H
#include <stdint.h>
#include "com_BmcType.h"
#include "com_IPMIDefs.h"

#pragma pack( 1 )

/* Authentication Type */
#define		AUTH_TYPE_NONE							0
#define		AUTH_TYPE_MD2							1
#define		AUTH_TYPE_MD5							2
#define		AUTH_TYPE_PASSWORD						4
#define		AUTH_TYPE_OEM							5


/* MD2Context_T */
typedef struct 
{
    uint8_t		State[16];      /* state */
    uint8_t		Checksum[16];   /* checksum */
    uint8_t		Count;			/* number of bytes, modulo 16 */
    uint8_t		Buffer[16];     /* input buffer */
}    MD2Context_T;


/* MD5Context_T */
typedef struct 
{
    uint32_t	state[4];		/* state (ABCD) */
    uint32_t	count[2];		/* number of bits, modulo 2^64 (lsb first) */
    uint8_t		buffer[64];		/* input buffer */
}    MD5Context_T;

#pragma pack( )

/*--------------------------
 * Extern Declarations
 *--------------------------*/
extern void AuthCodeCalMD2 (  uint8_t* String,   uint8_t*	MD2Result, uint8_t StrLen);
extern void AuthCodeCalMD5 (  uint8_t* Str,   uint8_t* MD5Result, uint16_t StrLen);

#endif	/* MD_H */

