2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
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.
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.
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/>.
17 /**************************************************************
18 * This file defines the driver FIPS functions that should be
19 * implemented by the driver user. Current implementation is sample code only.
20 ***************************************************************/
22 #include <linux/module.h>
23 #include "ssi_fips_local.h"
24 #include "ssi_driver.h"
27 static bool tee_error
;
28 module_param(tee_error
, bool, 0644);
29 MODULE_PARM_DESC(tee_error
, "Simulate TEE library failure flag: 0 - no error (default), 1 - TEE error occured ");
31 static ssi_fips_state_t fips_state
= CC_FIPS_STATE_NOT_SUPPORTED
;
32 static ssi_fips_error_t fips_error
= CC_REE_FIPS_ERROR_OK
;
35 * This function returns the FIPS REE state.
36 * The function should be implemented by the driver user, depends on where
37 * the state value is stored.
38 * The reference code uses global variable.
40 int ssi_fips_ext_get_state(ssi_fips_state_t
*p_state
)
44 if (p_state
== NULL
) {
48 *p_state
= fips_state
;
54 * This function returns the FIPS REE error.
55 * The function should be implemented by the driver user, depends on where
56 * the error value is stored.
57 * The reference code uses global variable.
59 int ssi_fips_ext_get_error(ssi_fips_error_t
*p_err
)
73 * This function sets the FIPS REE state.
74 * The function should be implemented by the driver user, depends on where
75 * the state value is stored.
76 * The reference code uses global variable.
78 int ssi_fips_ext_set_state(ssi_fips_state_t state
)
85 * This function sets the FIPS REE error.
86 * The function should be implemented by the driver user, depends on where
87 * the error value is stored.
88 * The reference code uses global variable.
90 int ssi_fips_ext_set_error(ssi_fips_error_t err
)