]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/staging/ccree/ssi_fips_local.h
Merge tag 'omap-for-v4.13/fixes-merge-window' of git://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / ccree / ssi_fips_local.h
1 /*
2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #ifndef __SSI_FIPS_LOCAL_H__
18 #define __SSI_FIPS_LOCAL_H__
19
20 #ifdef CONFIG_CCX7REE_FIPS_SUPPORT
21
22 #include "ssi_fips.h"
23 struct ssi_drvdata;
24
25 #define CHECK_AND_RETURN_UPON_FIPS_ERROR() {\
26 if (ssi_fips_check_fips_error() != 0) {\
27 return -ENOEXEC;\
28 } \
29 }
30
31 #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR() {\
32 if (ssi_fips_check_fips_error() != 0) {\
33 return;\
34 } \
35 }
36
37 #define SSI_FIPS_INIT(p_drvData) (ssi_fips_init(p_drvData))
38 #define SSI_FIPS_FINI(p_drvData) (ssi_fips_fini(p_drvData))
39
40 #define FIPS_LOG(...) SSI_LOG(KERN_INFO, __VA_ARGS__)
41 #define FIPS_DBG(...) //SSI_LOG(KERN_INFO, __VA_ARGS__)
42
43 /* FIPS functions */
44 int ssi_fips_init(struct ssi_drvdata *p_drvdata);
45 void ssi_fips_fini(struct ssi_drvdata *drvdata);
46 int ssi_fips_check_fips_error(void);
47 int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, enum cc_fips_error err);
48 void fips_handler(struct ssi_drvdata *drvdata);
49
50 #else /* CONFIG_CC7XXREE_FIPS_SUPPORT */
51
52 #define CHECK_AND_RETURN_UPON_FIPS_ERROR()
53 #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR()
54
55 static inline int ssi_fips_init(struct ssi_drvdata *p_drvdata)
56 {
57 return 0;
58 }
59
60 static inline void ssi_fips_fini(struct ssi_drvdata *drvdata) {}
61
62 void fips_handler(struct ssi_drvdata *drvdata);
63
64 #endif /* CONFIG_CC7XXREE_FIPS_SUPPORT */
65
66 #endif /*__SSI_FIPS_LOCAL_H__*/
67