Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2017 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | #include <cds_api.h> |
| 20 | #include <lim_global.h> |
| 21 | #include <ani_global.h> |
| 22 | #include <lim_ser_des_utils.h> |
| 23 | |
| 24 | #ifdef WLAN_FEATURE_FILS_SK |
| 25 | |
| 26 | /** |
| 27 | * lim_process_fils_auth_frame2()- This API processes fils data from auth resp |
| 28 | * @mac_ctx: mac context |
| 29 | * @session: PE session |
| 30 | * @rx_auth_frm_body: pointer to auth frame |
| 31 | * |
| 32 | * Return: true if fils data needs to be processed else false |
| 33 | */ |
| 34 | bool lim_process_fils_auth_frame2(tpAniSirGlobal mac_ctx, |
| 35 | tpPESession pe_session, |
| 36 | tSirMacAuthFrameBody * rx_auth_frm_body); |
| 37 | |
| 38 | /** |
| 39 | * lim_add_fils_data_to_auth_frame()- This API adds fils data to auth frame. |
| 40 | * Following will be added in this. |
| 41 | * 1. RSNIE |
| 42 | * 2. SNonce |
| 43 | * 3. Session |
| 44 | * 4. Wrapped data |
| 45 | * @session: PE session |
| 46 | * @body: pointer to auth frame where data needs to be added |
| 47 | * |
| 48 | * Return: None |
| 49 | */ |
| 50 | void lim_add_fils_data_to_auth_frame(tpPESession session, uint8_t *body); |
| 51 | |
| 52 | /** |
| 53 | * lim_is_valid_fils_auth_frame()- This API checks whether auth frame is a |
| 54 | * valid frame. |
| 55 | * @mac_ctx: mac context |
| 56 | * @pe_session: pe session pointer |
| 57 | * @rx_auth_frm_body: pointer to autherntication frame |
| 58 | * |
| 59 | * Return: true if frame is valid or fils is disable, false otherwise |
| 60 | */ |
| 61 | bool lim_is_valid_fils_auth_frame(tpAniSirGlobal mac_ctx, |
| 62 | tpPESession pe_session, tSirMacAuthFrameBody *rx_auth_frm_body); |
| 63 | |
| 64 | /** |
| 65 | * lim_update_fils_config()- This API updates fils session info to csr config |
| 66 | * from join request. |
| 67 | * @session: PE session |
| 68 | * @sme_join_req: pointer to join request |
| 69 | * |
| 70 | * Return: None |
| 71 | */ |
| 72 | void lim_update_fils_config(tpPESession session, tpSirSmeJoinReq sme_join_req); |
| 73 | |
| 74 | /** |
| 75 | * lim_create_fils_auth_data()- This API creates the fils auth data |
| 76 | * which needs to be sent in auth req. |
| 77 | * @mac_ctx: mac context |
| 78 | * @auth_frame: pointer to auth frame |
| 79 | * @session: PE session |
| 80 | * |
| 81 | * Return: length of fils data |
| 82 | */ |
| 83 | uint32_t lim_create_fils_auth_data(tpAniSirGlobal mac_ctx, |
| 84 | tpSirMacAuthFrameBody auth_frame, tpPESession session); |
| 85 | |
| 86 | /** |
| 87 | * lim_increase_fils_sequence_number: this API increases fils sequence number in |
| 88 | * the event of resending auth packet |
| 89 | * @session_entry: pointer to PE session |
| 90 | * |
| 91 | * Return: None |
| 92 | */ |
| 93 | static inline void lim_increase_fils_sequence_number(tpPESession session_entry) |
| 94 | { |
| 95 | if (!session_entry->fils_info) |
| 96 | return; |
| 97 | |
| 98 | if (session_entry->fils_info->is_fils_connection) |
| 99 | session_entry->fils_info->sequence_number++; |
| 100 | } |
| 101 | |
| 102 | #else |
| 103 | static inline bool lim_process_fils_auth_frame2(tpAniSirGlobal mac_ctx, |
| 104 | tpPESession pe_session, tSirMacAuthFrameBody *rx_auth_frm_body) |
| 105 | { |
| 106 | return false; |
| 107 | } |
| 108 | |
| 109 | static inline void |
| 110 | lim_increase_fils_sequence_number(tpPESession session_entry) |
| 111 | { } |
| 112 | |
| 113 | static inline void |
| 114 | lim_add_fils_data_to_auth_frame(tpPESession session, uint8_t *body) |
| 115 | { |
| 116 | } |
| 117 | |
| 118 | static inline bool lim_is_valid_fils_auth_frame(tpAniSirGlobal mac_ctx, |
| 119 | tpPESession pe_session, tSirMacAuthFrameBody *rx_auth_frm_body) |
| 120 | { |
| 121 | return true; |
| 122 | } |
| 123 | |
| 124 | static inline void |
| 125 | lim_update_fils_config(tpPESession session, tpSirSmeJoinReq sme_join_req) |
| 126 | { } |
| 127 | |
| 128 | static inline uint32_t lim_create_fils_auth_data(tpAniSirGlobal mac_ctx, |
| 129 | tpSirMacAuthFrameBody auth_frame, tpPESession session) |
| 130 | { |
| 131 | return 0; |
| 132 | } |
| 133 | #endif |