key.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. *
  20. * File: key.h
  21. *
  22. * Purpose: Implement functions for 802.11i Key management
  23. *
  24. * Author: Jerry Chen
  25. *
  26. * Date: May 29, 2003
  27. *
  28. */
  29. #ifndef __KEY_H__
  30. #define __KEY_H__
  31. #include "ttype.h"
  32. #include "tether.h"
  33. #include "80211mgr.h"
  34. /*--------------------- Export Definitions -------------------------*/
  35. #define MAX_GROUP_KEY 4
  36. #define MAX_KEY_TABLE 11
  37. #define MAX_KEY_LEN 32
  38. #define AES_KEY_LEN 16
  39. #define AUTHENTICATOR_KEY 0x10000000
  40. #define USE_KEYRSC 0x20000000
  41. #define PAIRWISE_KEY 0x40000000
  42. #define TRANSMIT_KEY 0x80000000
  43. #define GROUP_KEY 0x00000000
  44. #define KEY_CTL_WEP 0x00
  45. #define KEY_CTL_NONE 0x01
  46. #define KEY_CTL_TKIP 0x02
  47. #define KEY_CTL_CCMP 0x03
  48. #define KEY_CTL_INVALID 0xFF
  49. typedef struct tagSKeyItem {
  50. bool bKeyValid;
  51. unsigned long uKeyLength;
  52. unsigned char abyKey[MAX_KEY_LEN];
  53. u64 KeyRSC;
  54. unsigned long dwTSC47_16;
  55. unsigned short wTSC15_0;
  56. unsigned char byCipherSuite;
  57. unsigned char byReserved0;
  58. unsigned long dwKeyIndex;
  59. void *pvKeyTable;
  60. } SKeyItem, *PSKeyItem; //64
  61. typedef struct tagSKeyTable {
  62. unsigned char abyBSSID[ETH_ALEN]; //6
  63. unsigned char byReserved0[2]; //8
  64. SKeyItem PairwiseKey;
  65. SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328
  66. unsigned long dwGTKeyIndex; // GroupTransmitKey Index
  67. bool bInUse;
  68. //2006-1116-01,<Modify> by NomadZhao
  69. bool bSoftWEP;
  70. unsigned short wKeyCtl; // for address of wKeyCtl at align 4
  71. unsigned char byReserved1[6];
  72. } SKeyTable, *PSKeyTable; //348
  73. typedef struct tagSKeyManagement {
  74. SKeyTable KeyTable[MAX_KEY_TABLE];
  75. } SKeyManagement, *PSKeyManagement;
  76. /*--------------------- Export Types ------------------------------*/
  77. /*--------------------- Export Macros ------------------------------*/
  78. /*--------------------- Export Classes ----------------------------*/
  79. /*--------------------- Export Variables --------------------------*/
  80. /*--------------------- Export Functions --------------------------*/
  81. void KeyvInitTable(PSKeyManagement pTable, void __iomem *dwIoBase);
  82. bool KeybGetKey(
  83. PSKeyManagement pTable,
  84. unsigned char *pbyBSSID,
  85. unsigned long dwKeyIndex,
  86. PSKeyItem *pKey
  87. );
  88. bool KeybSetKey(
  89. PSKeyManagement pTable,
  90. unsigned char *pbyBSSID,
  91. unsigned long dwKeyIndex,
  92. unsigned long uKeyLength,
  93. u64 *pKeyRSC,
  94. unsigned char *pbyKey,
  95. unsigned char byKeyDecMode,
  96. void __iomem *dwIoBase,
  97. unsigned char byLocalID
  98. );
  99. bool KeybSetDefaultKey(
  100. PSKeyManagement pTable,
  101. unsigned long dwKeyIndex,
  102. unsigned long uKeyLength,
  103. u64 *pKeyRSC,
  104. unsigned char *pbyKey,
  105. unsigned char byKeyDecMode,
  106. void __iomem *dwIoBase,
  107. unsigned char byLocalID
  108. );
  109. bool KeybRemoveKey(
  110. PSKeyManagement pTable,
  111. unsigned char *pbyBSSID,
  112. unsigned long dwKeyIndex,
  113. void __iomem *dwIoBase
  114. );
  115. bool KeybGetTransmitKey(
  116. PSKeyManagement pTable,
  117. unsigned char *pbyBSSID,
  118. unsigned long dwKeyType,
  119. PSKeyItem *pKey
  120. );
  121. bool KeybCheckPairewiseKey(
  122. PSKeyManagement pTable,
  123. PSKeyItem *pKey
  124. );
  125. bool KeybRemoveAllKey(
  126. PSKeyManagement pTable,
  127. unsigned char *pbyBSSID,
  128. void __iomem *dwIoBase
  129. );
  130. void KeyvRemoveWEPKey(
  131. PSKeyManagement pTable,
  132. unsigned long dwKeyIndex,
  133. void __iomem *dwIoBase
  134. );
  135. void KeyvRemoveAllWEPKey(
  136. PSKeyManagement pTable,
  137. void __iomem *dwIoBase
  138. );
  139. bool KeybSetAllGroupKey(
  140. PSKeyManagement pTable,
  141. unsigned long dwKeyIndex,
  142. unsigned long uKeyLength,
  143. u64 *pKeyRSC,
  144. unsigned char *pbyKey,
  145. unsigned char byKeyDecMode,
  146. void __iomem *dwIoBase,
  147. unsigned char byLocalID
  148. );
  149. #endif // __KEY_H__