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