xref: /wlan-driver/qcacld-3.0/core/hdd/src/wlan_hdd_fips.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2017 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: wlan_hdd_fips.h
22*5113495bSYour Name  *
23*5113495bSYour Name  * WLAN Host Device Driver FIPS Certification Feature
24*5113495bSYour Name  */
25*5113495bSYour Name 
26*5113495bSYour Name #ifndef __WLAN_HDD_FIPS_H__
27*5113495bSYour Name #define __WLAN_HDD_FIPS_H__
28*5113495bSYour Name 
29*5113495bSYour Name struct net_device;
30*5113495bSYour Name struct iw_request_info;
31*5113495bSYour Name union iwreq_data;
32*5113495bSYour Name struct hdd_adapter;
33*5113495bSYour Name void fips_test(struct hdd_adapter *adapter);
34*5113495bSYour Name 
35*5113495bSYour Name #define FIPS_KEY_LEN 32
36*5113495bSYour Name struct iw_fips_test_request {
37*5113495bSYour Name 	uint32_t operation;
38*5113495bSYour Name 	uint32_t mode;
39*5113495bSYour Name 	uint32_t key_len;
40*5113495bSYour Name 	uint8_t  key[FIPS_KEY_LEN];
41*5113495bSYour Name 	uint32_t data_len;
42*5113495bSYour Name 	uint8_t data[];
43*5113495bSYour Name };
44*5113495bSYour Name 
45*5113495bSYour Name struct iw_fips_test_response {
46*5113495bSYour Name 	uint32_t status;
47*5113495bSYour Name 	uint32_t data_len;
48*5113495bSYour Name 	uint8_t data[];
49*5113495bSYour Name };
50*5113495bSYour Name 
51*5113495bSYour Name 
52*5113495bSYour Name /**
53*5113495bSYour Name  * hdd_fips_test() - Perform FIPS test
54*5113495bSYour Name  * @dev: netdev upon which the FIPS test ioctl was received
55*5113495bSYour Name  * @info: ioctl request information
56*5113495bSYour Name  * @wrqu: ioctl request data structure
57*5113495bSYour Name  * @extra: extra payload for wireless extensions ioctl
58*5113495bSYour Name  *
59*5113495bSYour Name  * This API implements the FIPS test interface. Upon entry the @extra
60*5113495bSYour Name  * buffer will contain a FIPS test vector formatted as a &struct
61*5113495bSYour Name  * iw_fips_test_request. This vector will be sent to firmware where it
62*5113495bSYour Name  * will be run through the appropriate hardware. The result of the
63*5113495bSYour Name  * operation will be sent back to userspace via @extra encoded as a
64*5113495bSYour Name  * &struct iw_fips_test_response.
65*5113495bSYour Name  *
66*5113495bSYour Name  * Return: 0 if the test vector was processed, otherwise a negative
67*5113495bSYour Name  *         errno.
68*5113495bSYour Name  */
69*5113495bSYour Name 
70*5113495bSYour Name int hdd_fips_test(struct net_device *dev,
71*5113495bSYour Name 		  struct iw_request_info *info,
72*5113495bSYour Name 		  union iwreq_data *wrqu, char *extra);
73*5113495bSYour Name 
74*5113495bSYour Name #endif /* __WLAN_HDD_FIPS_H__ */
75