xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/crypto/src/wlan_crypto_obj_mgr_i.h (revision 1397a33f48ea6455be40871470b286e535820eb8)
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 #ifdef WLAN_CRYPTO_FILS_OS_DERIVATIVE
84 static inline const struct wlan_crypto_cipher *fils_register(void)
85 {
86 	return NULL;
87 }
88 #else
89 /**
90  * fils_register() - Register all callback functions to Crypto manager
91  *
92  * This function is invoked from crypto object manager to register
93  * FILS specific callbacks.
94  *
95  * Return: Pointer to wlan_crypto_cipher Object
96  */
97 const struct wlan_crypto_cipher *fils_register(void);
98 #endif
99 
100 
101 static inline void *wlan_get_vdev_crypto_obj(struct wlan_objmgr_vdev *vdev)
102 {
103 	void *crypto_priv;
104 	crypto_priv = wlan_objmgr_vdev_get_comp_private_obj(vdev,
105 							WLAN_UMAC_COMP_CRYPTO);
106 
107 	return crypto_priv;
108 }
109 
110 static inline void *wlan_get_peer_crypto_obj(struct wlan_objmgr_peer *peer)
111 {
112 	void *crypto_priv;
113 	crypto_priv = wlan_objmgr_peer_get_comp_private_obj(peer,
114 							WLAN_UMAC_COMP_CRYPTO);
115 
116 	return crypto_priv;
117 }
118 #endif /* end of __WLAN_CRYPTO_OBJ_MGR_I_*/
119