Staging: rt3090: remove private ioctls
[sfrench/cifs-2.6.git] / drivers / staging / rt2860 / md5.h
1 /*
2  *************************************************************************
3  * Ralink Tech Inc.
4  * 5F., No.36, Taiyuan St., Jhubei City,
5  * Hsinchu County 302,
6  * Taiwan, R.O.C.
7  *
8  * (c) Copyright 2002-2007, Ralink Technology, Inc.
9  *
10  * This program is free software; you can redistribute it and/or modify  *
11  * it under the terms of the GNU General Public License as published by  *
12  * the Free Software Foundation; either version 2 of the License, or     *
13  * (at your option) any later version.                                   *
14  *                                                                       *
15  * This program is distributed in the hope that it will be useful,       *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18  * GNU General Public License for more details.                          *
19  *                                                                       *
20  * You should have received a copy of the GNU General Public License     *
21  * along with this program; if not, write to the                         *
22  * Free Software Foundation, Inc.,                                       *
23  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
24  *                                                                       *
25  *************************************************************************
26
27         Module Name:
28         md5.h
29
30         Abstract:
31
32         Revision History:
33         Who                     When                    What
34         --------        ----------              ----------------------------------------------
35         Name            Date                    Modification logs
36         jan                     10-28-03                Initial
37         Rita            11-23-04                Modify MD5 and SHA-1
38 */
39
40 #ifndef uint8
41 #define uint8  unsigned char
42 #endif
43
44 #ifndef uint32
45 #define uint32 unsigned long int
46 #endif
47
48
49 #ifndef __MD5_H__
50 #define __MD5_H__
51
52 #define MD5_MAC_LEN 16
53
54 typedef struct _MD5_CTX {
55     UINT32   Buf[4];             // buffers of four states
56         UCHAR   Input[64];          // input message
57         UINT32   LenInBitCount[2];   // length counter for input message, 0 up to 64 bits
58 }   MD5_CTX;
59
60 VOID MD5Init(MD5_CTX *pCtx);
61 VOID MD5Update(MD5_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes);
62 VOID MD5Final(UCHAR Digest[16], MD5_CTX *pCtx);
63 VOID MD5Transform(UINT32 Buf[4], UINT32 Mes[16]);
64
65 void md5_mac(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac);
66 void hmac_md5(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac);
67
68 //
69 // SHA context
70 //
71 typedef struct _SHA_CTX
72 {
73         UINT32   Buf[5];             // buffers of five states
74         UCHAR   Input[80];          // input message
75         UINT32   LenInBitCount[2];   // length counter for input message, 0 up to 64 bits
76
77 }       SHA_CTX;
78
79 VOID SHAInit(SHA_CTX *pCtx);
80 UCHAR SHAUpdate(SHA_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes);
81 VOID SHAFinal(SHA_CTX *pCtx, UCHAR Digest[20]);
82 VOID SHATransform(UINT32 Buf[5], UINT32 Mes[20]);
83
84 #define SHA_DIGEST_LEN 20
85 #endif // __MD5_H__
86
87 /******************************************************************************/
88 #ifndef _AES_H
89 #define _AES_H
90
91 typedef struct
92 {
93         uint32 erk[64];         /* encryption round     keys */
94         uint32 drk[64];         /* decryption round     keys */
95         int     nr;                             /* number of rounds     */
96 }
97 aes_context;
98
99 int      rtmp_aes_set_key( aes_context *ctx,    uint8 *key,     int     nbits );
100 void rtmp_aes_encrypt( aes_context *ctx,        uint8 input[16], uint8 output[16] );
101 void rtmp_aes_decrypt( aes_context *ctx,        uint8 input[16], uint8 output[16] );
102
103 void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output);
104 int PasswordHash(char *password, unsigned char *ssid, int ssidlength, unsigned char *output);
105
106 #endif /* aes.h */
107