5 #define SHA_DIGEST_LEN 20
7 typedef struct _MD5_CTX
{
8 ULONG Buf
[4]; // buffers of four states
9 UCHAR Input
[64]; // input message
10 ULONG LenInBitCount
[2]; // length counter for input message, 0 up to 64 bits
13 VOID
MD5Init(MD5_CTX
*pCtx
);
14 VOID
MD5Update(MD5_CTX
*pCtx
, UCHAR
*pData
, ULONG LenInBytes
);
15 VOID
MD5Final(UCHAR Digest
[16], MD5_CTX
*pCtx
);
16 VOID
MD5Transform(ULONG Buf
[4], ULONG Mes
[16]);
18 void md5_mac(UCHAR
*key
, ULONG key_len
, UCHAR
*data
, ULONG data_len
, UCHAR
*mac
);
19 void hmac_md5(UCHAR
*key
, ULONG key_len
, UCHAR
*data
, ULONG data_len
, UCHAR
*mac
);
25 /******************************************************************************/
27 VOID
SHAInit(SHA_CTX
*pCtx
);
28 UCHAR
SHAUpdate(SHA_CTX
*pCtx
, UCHAR
*pData
, ULONG LenInBytes
);
29 VOID
SHAFinal(SHA_CTX
*pCtx
, UCHAR Digest
[20]);
30 VOID
SHATransform(ULONG Buf
[5], ULONG Mes
[20]);
32 void hmac_sha1(unsigned char *text
, int text_len
, unsigned char *key
, int key_len
, unsigned char *digest
);
33 void F(char *password
, unsigned char *ssid
, int ssidlength
, int iterations
, int count
, unsigned char *output
);
34 int PasswordHash(char *password
, unsigned char *ssid
, int ssidlength
, unsigned char *output
);
36 /******************************************************************************/
41 #define uint8 unsigned char
45 #define uint32 unsigned long int
50 uint32 erk
[64]; /* encryption round keys */
51 uint32 drk
[64]; /* decryption round keys */
52 int nr
; /* number of rounds */
56 int aes_set_key( aes_context
*ctx
, uint8
*key
, int nbits
);
57 void aes_encrypt( aes_context
*ctx
, uint8 input
[16], uint8 output
[16] );
58 void aes_decrypt( aes_context
*ctx
, uint8 input
[16], uint8 output
[16] );