blob: 7c60d558961ec0b6991a0bf645f542ca26a6927e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
6/*
Jeff Johnson295189b2012-06-20 16:38:30 -07007 * Woodside Networks, Inc proprietary. All rights reserved.
8 * $File: //depot/software/projects/feature_branches/gen5_phase1/os/linux/classic/ap/apps/ssm/auth8021x/ani8021xPrf.h $
9 *
10 * Contains declarations for routines to calculate the 802.11i PRF
11 * functions.
12 *
13 * Author: Mayank D. Upadhyay
14 * Date: 19-March-2003
15 * History:-
16 * Date Modified by Modification Information
17 * ------------------------------------------------------
18 */
19
20#ifndef __AAG_PRF_H_
21#define __AAG_PRF_H_
22
23#include "vos_types.h"
24#include <bapRsnAsfPacket.h>
25#include <bapRsnSsmEapol.h>
26#include "csrApi.h"
27
28
29/*
30 * Define the maximum size needed for the result array so that SHA-1
31 * overflow is accounted for.
32 */
33#define AAG_PRF_MAX_OUTPUT_SIZE 80
34
35#define AAG_RSN_PTK_TK1_OFFSET \
36 (AAG_RSN_EAPOL_MIC_KEY_LEN + AAG_RSN_EAPOL_ENC_KEY_LEN)
37
38// Pairwise key related definitions...
39
40#define AAG_RSN_PTK_PRF_LEN_TKIP 512 //bits
41#define AAG_RSN_PTK_PRF_LEN_CCMP 384 //bits
42#define AAG_RSN_PTK_PRF_LEN_WEP104 384 //bits
43#define AAG_RSN_PTK_PRF_LEN_WEP40 384 //bits
44
45// Group key related definitions...
46
47#define AAG_RSN_GMK_SIZE 16
48
49#define AAG_RSN_GTK_PRF_LEN_TKIP 256 //bits
50#define AAG_RSN_GTK_PRF_LEN_CCMP 128 //bits
51#define AAG_RSN_GTK_PRF_LEN_WEP104 128 //bits
52#define AAG_RSN_GTK_PRF_LEN_WEP40 128 //bits
53
54// Key material length that is sent to the MAC layer...
55
56#define AAG_RSN_KEY_MATERIAL_LEN_CCMP 16
57#define AAG_RSN_KEY_MATERIAL_LEN_TKIP 32
58#define AAG_RSN_KEY_MATERIAL_LEN_WEP104 13
59#define AAG_RSN_KEY_MATERIAL_LEN_WEP40 5
60
61/**
62 * aagGetKeyMaterialLen
63 *
64 * Returns the number of bytes of the PTK that have to be provided to
65 * the MAC layer for a given cipher type.
66 *
67 * @param cipherType the cipher-type
68 *
69 * @return the number of bytes of key material for this cipher type,
70 * or 0 for invalid cipher types.
71 */
72int
73aagGetKeyMaterialLen(eCsrEncryptionType cipherType);
74
75/**
76 * aagPtkPrf
77 *
78 * The PRF used for calculating the pairwise temporal key under IEEE
79 * 802.11i.
80 *
81 * @param result a fixed size array where the outputis stored. Should
82 * have enough place for the SHA-1 overflow.
83 * @param prfLen the number of BITS desired from the PRF result
84 * @param pmk the pairwise master-key
85 * @param authAddr the MAC address of the authenticator
86 * @param suppAddr the MAC address of the supplicant
87 * @param aNonce the nonce generated by the authenticator
88 * @param sNonce the nonce generated by the supplicant
89 *
90 * @return ANI_OK if the operation succeeds
91 */
92int
93aagPtkPrf(v_U32_t cryptHandle,
94 v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
95 v_U32_t prfLen,
96 tAniPacket *pmk,
97 tAniMacAddr authAddr,
98 tAniMacAddr suppAddr,
99 v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE],
100 v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]);
101
102
103/**
104 * aagGtkPrf
105 *
106 * The PRF used for calculating the group temporal key under IEEE
107 * 802.11i.
108 *
109 * @param result a fixed size array where the outputis stored. Should
110 * have enough place for the SHA-1 overflow.
111 * @param prfLen the number of BITS desired from the PRF result
112 * @param gmk the group master-key
113 * @param authAddr the MAC address of the authenticator
114 * @param gNonce the nonce generated by the authenticator for this purpose
115 *
116 * @return ANI_OK if the operation succeeds
117 */
118int
119aagGtkPrf(v_U32_t cryptHandle,
120 v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
121 v_U32_t prfLen,
122 v_U8_t gmk[AAG_RSN_GMK_SIZE],
123 tAniMacAddr authAddr,
124 v_U8_t gNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE]);
125
126/**
127 * aagPrf
128 *
129 * The raw PRF function that is used in IEEE 802.11i.
130 *
131 * @param result a fixed size array where the outputis stored. Should
132 * have enough place for the SHA-1 overflow.
133 * @param key the key to use in the PRF
134 * @param keyLen the length of the key
135 * @param a the parameter A which is usually a unique label
136 * @param aLen the length of the parameter A
137 * @ param b the parameter B
138 * @param bLen the length of parameter B
139 * @param prfLen the number to BITS desired from the PRF result
140 *
141 * @return ANI_OK if the operation succeeds
142 */
143int
144aagPrf(v_U32_t cryptHandle,
145 v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
146 v_U8_t *key, v_U8_t keyLen,
147 v_U8_t *a, v_U8_t aLen,
148 v_U8_t *b, v_U8_t bLen,
149 v_U32_t prfLen);
150
151#endif //__AAG_PRF_H_