1*758e9fbaSOystein Eftevaag /* SPDX-License-Identifier: BSD-2-Clause */ 2*758e9fbaSOystein Eftevaag /******************************************************************************* 3*758e9fbaSOystein Eftevaag * Copyright 2018-2019, Fraunhofer SIT sponsored by Infineon Technologies AG 4*758e9fbaSOystein Eftevaag * All rights reserved. 5*758e9fbaSOystein Eftevaag ******************************************************************************/ 6*758e9fbaSOystein Eftevaag 7*758e9fbaSOystein Eftevaag #ifndef IFAPI_PROFILES_H 8*758e9fbaSOystein Eftevaag #define IFAPI_PROFILES_H 9*758e9fbaSOystein Eftevaag 10*758e9fbaSOystein Eftevaag #include "ifapi_io.h" 11*758e9fbaSOystein Eftevaag #include "ifapi_policy_types.h" 12*758e9fbaSOystein Eftevaag 13*758e9fbaSOystein Eftevaag /** Internal structure for FAPI profiles 14*758e9fbaSOystein Eftevaag */ 15*758e9fbaSOystein Eftevaag typedef struct IFAPI_PROFILE { 16*758e9fbaSOystein Eftevaag TPMI_ALG_PUBLIC type; /**< The algorithm used for key creation */ 17*758e9fbaSOystein Eftevaag char *srk_template; /**< name of SRK template */ 18*758e9fbaSOystein Eftevaag char *ek_template; /**< name of EK template */ 19*758e9fbaSOystein Eftevaag TPMT_SIG_SCHEME ecc_signing_scheme; /**< < Signing scheme for the ECC key. */ 20*758e9fbaSOystein Eftevaag TPMT_SIG_SCHEME rsa_signing_scheme; /**< < Signing scheme for the RSA key. */ 21*758e9fbaSOystein Eftevaag TPMT_RSA_DECRYPT rsa_decrypt_scheme; /**< < Decrypt scheme for the RSA key. */ 22*758e9fbaSOystein Eftevaag TPMI_ALG_SYM_MODE sym_mode; /**< < Mode for symmectric encryption. */ 23*758e9fbaSOystein Eftevaag TPMT_SYM_DEF_OBJECT sym_parameters; /**< < Parameters for symmectric encryption. */ 24*758e9fbaSOystein Eftevaag UINT16 sym_block_size; /**< < Block size for symmectric encryption. */ 25*758e9fbaSOystein Eftevaag TPML_PCR_SELECTION pcr_selection; /**< < Parameters for symmectric encryption. */ 26*758e9fbaSOystein Eftevaag TPMI_ALG_HASH nameAlg; 27*758e9fbaSOystein Eftevaag TPMI_RSA_KEY_BITS keyBits; 28*758e9fbaSOystein Eftevaag UINT32 exponent; 29*758e9fbaSOystein Eftevaag TPMI_ECC_CURVE curveID; 30*758e9fbaSOystein Eftevaag TPMT_SYM_DEF session_symmetric; 31*758e9fbaSOystein Eftevaag TPMS_POLICY *eh_policy; 32*758e9fbaSOystein Eftevaag TPMS_POLICY *sh_policy; 33*758e9fbaSOystein Eftevaag TPMS_POLICY *ek_policy; 34*758e9fbaSOystein Eftevaag TPMS_POLICY *srk_policy; 35*758e9fbaSOystein Eftevaag TPMS_POLICY *lockout_policy; 36*758e9fbaSOystein Eftevaag UINT32 newMaxTries; 37*758e9fbaSOystein Eftevaag UINT32 newRecoveryTime; 38*758e9fbaSOystein Eftevaag UINT32 lockoutRecovery; 39*758e9fbaSOystein Eftevaag } IFAPI_PROFILE; 40*758e9fbaSOystein Eftevaag 41*758e9fbaSOystein Eftevaag /* An entry for the dictionary of loaded profiles */ 42*758e9fbaSOystein Eftevaag typedef struct IFAPI_PROFILE_ENTRY { 43*758e9fbaSOystein Eftevaag /** Name of a profile */ 44*758e9fbaSOystein Eftevaag char *name; 45*758e9fbaSOystein Eftevaag /** Values for a profile */ 46*758e9fbaSOystein Eftevaag struct IFAPI_PROFILE profile; 47*758e9fbaSOystein Eftevaag } IFAPI_PROFILE_ENTRY; 48*758e9fbaSOystein Eftevaag 49*758e9fbaSOystein Eftevaag typedef struct IFAPI_PROFILES { 50*758e9fbaSOystein Eftevaag char *default_name; 51*758e9fbaSOystein Eftevaag struct IFAPI_PROFILE default_profile; 52*758e9fbaSOystein Eftevaag /* Dictionary of loaded profiles */ 53*758e9fbaSOystein Eftevaag struct IFAPI_PROFILE_ENTRY *profiles; 54*758e9fbaSOystein Eftevaag char **filenames; 55*758e9fbaSOystein Eftevaag /* Size of the loaded profiles dictionary */ 56*758e9fbaSOystein Eftevaag size_t num_profiles; 57*758e9fbaSOystein Eftevaag size_t profiles_idx; 58*758e9fbaSOystein Eftevaag } IFAPI_PROFILES; 59*758e9fbaSOystein Eftevaag 60*758e9fbaSOystein Eftevaag TSS2_RC 61*758e9fbaSOystein Eftevaag ifapi_profiles_initialize_async( 62*758e9fbaSOystein Eftevaag IFAPI_PROFILES *profiles, 63*758e9fbaSOystein Eftevaag IFAPI_IO *io, 64*758e9fbaSOystein Eftevaag const char *profilesdir, 65*758e9fbaSOystein Eftevaag const char *defaultprofile); 66*758e9fbaSOystein Eftevaag 67*758e9fbaSOystein Eftevaag TSS2_RC 68*758e9fbaSOystein Eftevaag ifapi_profiles_initialize_finish( 69*758e9fbaSOystein Eftevaag IFAPI_PROFILES *profiles, 70*758e9fbaSOystein Eftevaag IFAPI_IO *io); 71*758e9fbaSOystein Eftevaag 72*758e9fbaSOystein Eftevaag TSS2_RC 73*758e9fbaSOystein Eftevaag ifapi_profiles_get( 74*758e9fbaSOystein Eftevaag const IFAPI_PROFILES *profiles, 75*758e9fbaSOystein Eftevaag const char *name, 76*758e9fbaSOystein Eftevaag const IFAPI_PROFILE **profile); 77*758e9fbaSOystein Eftevaag 78*758e9fbaSOystein Eftevaag void 79*758e9fbaSOystein Eftevaag ifapi_profiles_finalize( 80*758e9fbaSOystein Eftevaag IFAPI_PROFILES *profiles); 81*758e9fbaSOystein Eftevaag 82*758e9fbaSOystein Eftevaag #endif /* IFAPI_OBJECT_H */ 83