1 /* 2 * Copyright (c) 2017-2018 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 /** 20 * DOC: Public API intialization of crypto service with object manager 21 */ 22 23 #ifndef __WLAN_CRYPTO_OBJ_MGR_I_ 24 #define __WLAN_CRYPTO_OBJ_MGR_I_ 25 26 #ifdef WLAN_CRYPTO_WEP_OS_DERIVATIVE 27 static inline const struct wlan_crypto_cipher *wep_register(void) 28 { 29 return NULL; 30 } 31 #else 32 const struct wlan_crypto_cipher *wep_register(void); 33 #endif 34 35 #ifdef WLAN_CRYPTO_TKIP_OS_DERIVATIVE 36 static inline const struct wlan_crypto_cipher *tkip_register(void) 37 { 38 return NULL; 39 } 40 #else 41 const struct wlan_crypto_cipher *tkip_register(void); 42 #endif 43 44 #ifdef WLAN_CRYPTO_CCMP_OS_DERIVATIVE 45 static inline const struct wlan_crypto_cipher *ccmp_register(void) 46 { 47 return NULL; 48 } 49 50 static inline const struct wlan_crypto_cipher *ccmp256_register(void) 51 { 52 return NULL; 53 } 54 #else 55 const struct wlan_crypto_cipher *ccmp_register(void); 56 const struct wlan_crypto_cipher *ccmp256_register(void); 57 #endif 58 59 #ifdef WLAN_CRYPTO_GCMP_OS_DERIVATIVE 60 static inline const struct wlan_crypto_cipher *gcmp_register(void) 61 { 62 return NULL; 63 } 64 65 static inline const struct wlan_crypto_cipher *gcmp256_register(void) 66 { 67 return NULL; 68 } 69 #else 70 const struct wlan_crypto_cipher *gcmp_register(void); 71 const struct wlan_crypto_cipher *gcmp256_register(void); 72 #endif 73 74 #ifdef WLAN_CRYPTO_WAPI_OS_DERIVATIVE 75 static inline const struct wlan_crypto_cipher *wapi_register(void) 76 { 77 return NULL; 78 } 79 #else 80 const struct wlan_crypto_cipher *wapi_register(void); 81 #endif 82 83 84 static inline void *wlan_get_vdev_crypto_obj(struct wlan_objmgr_vdev *vdev) 85 { 86 void *crypto_priv; 87 crypto_priv = wlan_objmgr_vdev_get_comp_private_obj(vdev, 88 WLAN_UMAC_COMP_CRYPTO); 89 90 return crypto_priv; 91 } 92 93 static inline void *wlan_get_peer_crypto_obj(struct wlan_objmgr_peer *peer) 94 { 95 void *crypto_priv; 96 crypto_priv = wlan_objmgr_peer_get_comp_private_obj(peer, 97 WLAN_UMAC_COMP_CRYPTO); 98 99 return crypto_priv; 100 } 101 #endif /* end of __WLAN_CRYPTO_OBJ_MGR_I_*/ 102