1 2/* 3 * Licensed Materials - Property of IBM 4 * 5 * trousers - An open source TCG Software Stack 6 * 7 * (C) Copyright International Business Machines Corp. 2004-2007 8 * 9 */ 10 11#ifndef _OBJ_RSAKEY_H_ 12#define _OBJ_RSAKEY_H_ 13 14#ifdef TSS_BUILD_RSAKEY_LIST 15 16/* rsakey specific flags */ 17#define TSS_RSAKEY_FLAG_OWNEREVICT (0x00000001) 18 19/* structures */ 20struct tr_rsakey_obj { 21 int type; 22 TSS_KEY key; 23 TSS_FLAG flags; 24 TSS_HPOLICY usagePolicy; 25 TSS_HPOLICY migPolicy; 26 TSS_UUID uuid; 27 TCS_KEY_HANDLE tcsHandle; 28#ifdef TSS_BUILD_CMK 29 TPM_HMAC msaApproval; 30 TPM_DIGEST msaDigest; 31#endif 32 union { 33 TPM_PCR_INFO info11; 34 TPM_PCR_INFO_LONG infolong; 35 } pcrInfo; 36 UINT32 pcrInfoType; 37}; 38 39/* obj_rsakey.c */ 40void __tspi_rsakey_free(void *data); 41TSS_BOOL obj_is_rsakey(TSS_HOBJECT); 42TSS_RESULT obj_rsakey_add(TSS_HCONTEXT, TSS_FLAG, TSS_HOBJECT *); 43TSS_RESULT obj_rsakey_add_by_key(TSS_HCONTEXT, TSS_UUID *, BYTE *, TSS_FLAG, TSS_HKEY *); 44TSS_RESULT obj_rsakey_set_policy(TSS_HKEY, TSS_HPOLICY); 45TSS_RESULT obj_rsakey_remove(TSS_HOBJECT, TSS_HCONTEXT); 46TSS_RESULT obj_rsakey_get_tsp_context(TSS_HKEY, TSS_HCONTEXT *); 47TSS_RESULT obj_rsakey_set_pstype(TSS_HKEY, UINT32); 48TSS_RESULT obj_rsakey_get_pstype(TSS_HKEY, UINT32 *); 49TSS_RESULT obj_rsakey_get_usage(TSS_HKEY, UINT32 *); 50TSS_RESULT obj_rsakey_set_usage(TSS_HKEY, UINT32); 51TSS_RESULT obj_rsakey_set_migratable(TSS_HKEY, UINT32); 52TSS_RESULT obj_rsakey_set_redirected(TSS_HKEY, UINT32); 53TSS_RESULT obj_rsakey_set_volatile(TSS_HKEY, UINT32); 54TSS_RESULT obj_rsakey_get_authdata_usage(TSS_HKEY, UINT32 *); 55TSS_RESULT obj_rsakey_set_authdata_usage(TSS_HKEY, UINT32); 56TSS_RESULT obj_rsakey_get_alg(TSS_HKEY, UINT32 *); 57TSS_RESULT obj_rsakey_set_alg(TSS_HKEY, UINT32); 58TSS_RESULT obj_rsakey_get_es(TSS_HKEY, UINT32 *); 59TSS_RESULT obj_rsakey_set_es(TSS_HKEY, UINT32); 60TSS_RESULT obj_rsakey_get_ss(TSS_HKEY, UINT32 *); 61TSS_RESULT obj_rsakey_set_ss(TSS_HKEY, UINT32); 62TSS_RESULT obj_rsakey_set_num_primes(TSS_HKEY, UINT32); 63TSS_RESULT obj_rsakey_get_num_primes(TSS_HKEY, UINT32 *); 64TSS_RESULT obj_rsakey_set_flags(TSS_HKEY, UINT32); 65TSS_RESULT obj_rsakey_get_flags(TSS_HKEY, UINT32 *); 66TSS_RESULT obj_rsakey_set_size(TSS_HKEY, UINT32); 67TSS_RESULT obj_rsakey_get_size(TSS_HKEY, UINT32 *); 68TSS_BOOL obj_rsakey_is_migratable(TSS_HKEY); 69TSS_BOOL obj_rsakey_is_redirected(TSS_HKEY); 70TSS_BOOL obj_rsakey_is_volatile(TSS_HKEY); 71TSS_RESULT obj_rsakey_get_policy(TSS_HKEY, UINT32, TSS_HPOLICY *, TSS_BOOL *); 72TSS_RESULT obj_rsakey_get_policies(TSS_HKEY, TSS_HPOLICY *, TSS_HPOLICY *, TSS_BOOL *); 73TSS_RESULT obj_rsakey_get_blob(TSS_HKEY, UINT32 *, BYTE **); 74TSS_RESULT obj_rsakey_get_priv_blob(TSS_HKEY, UINT32 *, BYTE **); 75TSS_RESULT obj_rsakey_get_pub_blob(TSS_HKEY, UINT32 *, BYTE **); 76TSS_RESULT obj_rsakey_get_version(TSS_HKEY, UINT32 *, BYTE **); 77TSS_RESULT obj_rsakey_get_exponent(TSS_HKEY, UINT32 *, BYTE **); 78TSS_RESULT obj_rsakey_set_exponent(TSS_HKEY, UINT32, BYTE *); 79TSS_RESULT obj_rsakey_get_modulus(TSS_HKEY, UINT32 *, BYTE **); 80TSS_RESULT obj_rsakey_set_modulus(TSS_HKEY, UINT32, BYTE *); 81TSS_RESULT obj_rsakey_get_uuid(TSS_HKEY, UINT32 *, BYTE **); 82TSS_RESULT obj_rsakey_get_parent_uuid(TSS_HKEY, TSS_FLAG *, TSS_UUID *); 83TSS_RESULT obj_rsakey_set_uuids(TSS_HKEY, TSS_FLAG, TSS_UUID *, TSS_FLAG, TSS_UUID *); 84TSS_RESULT obj_rsakey_set_uuid(TSS_HKEY, TSS_FLAG, TSS_UUID *); 85TSS_RESULT obj_rsakey_set_tcpakey(TSS_HKEY, UINT32 , BYTE *); 86TSS_RESULT obj_rsakey_get_pcr_digest(TSS_HKEY, UINT32, TSS_FLAG, UINT32 *, BYTE **); 87TSS_RESULT obj_rsakey_get_pcr_selection(TSS_HKEY, UINT32, TSS_FLAG, UINT32 *, BYTE **); 88TSS_RESULT obj_rsakey_get_pcr_locality(TSS_HKEY, TSS_FLAG, UINT32 *); 89TSS_RESULT obj_rsakey_set_pubkey(TSS_HKEY, UINT32, BYTE *); 90TSS_RESULT obj_rsakey_set_privkey(TSS_HKEY, UINT32, UINT32, BYTE *); 91TSS_RESULT obj_rsakey_set_pcr_data(TSS_HKEY, TSS_HPOLICY); 92TSS_RESULT obj_rsakey_set_key_parms(TSS_HKEY, TCPA_KEY_PARMS *); 93TSS_RESULT obj_rsakey_get_by_uuid(TSS_UUID *, TSS_HKEY *); 94TSS_RESULT obj_rsakey_get_by_pub(UINT32, BYTE *, TSS_HKEY *); 95TSS_RESULT obj_rsakey_get_tcs_handle(TSS_HKEY, TCS_KEY_HANDLE *); 96TSS_RESULT obj_rsakey_set_tcs_handle(TSS_HKEY, TCS_KEY_HANDLE); 97void obj_rsakey_remove_policy_refs(TSS_HPOLICY, TSS_HCONTEXT); 98TSS_RESULT obj_rsakey_get_transport_attribs(TSS_HKEY, TCS_KEY_HANDLE *, TPM_DIGEST *); 99#ifdef TSS_BUILD_CMK 100TSS_BOOL obj_rsakey_is_cmk(TSS_HKEY); 101TSS_RESULT obj_rsakey_set_cmk(TSS_HKEY, UINT32); 102TSS_RESULT obj_rsakey_set_msa_approval(TSS_HKEY, UINT32, BYTE *); 103TSS_RESULT obj_rsakey_get_msa_approval(TSS_HKEY, UINT32 *, BYTE **); 104TSS_RESULT obj_rsakey_set_msa_digest(TSS_HKEY, UINT32, BYTE *); 105TSS_RESULT obj_rsakey_get_msa_digest(TSS_HKEY, UINT32 *, BYTE **); 106#endif 107TSS_RESULT obj_rsakey_get_ownerevict(TSS_HKEY, UINT32 *); 108TSS_RESULT obj_rsakey_set_ownerevict(TSS_HKEY, TSS_BOOL); 109TSS_RESULT obj_rsakey_set_srk_pubkey(BYTE *); 110 111#define RSAKEY_LIST_DECLARE struct obj_list rsakey_list 112#define RSAKEY_LIST_DECLARE_EXTERN extern struct obj_list rsakey_list 113#define RSAKEY_LIST_INIT() tspi_list_init(&rsakey_list) 114#define RSAKEY_LIST_CONNECT(a,b) obj_connectContext_list(&rsakey_list, a, b) 115#define RSAKEY_LIST_CLOSE(a) obj_list_close(&rsakey_list, &__tspi_rsakey_free, a) 116 117#else 118 119#define obj_is_rsakey(a) FALSE 120 121#define RSAKEY_LIST_DECLARE 122#define RSAKEY_LIST_DECLARE_EXTERN 123#define RSAKEY_LIST_INIT() 124#define RSAKEY_LIST_CONNECT(a,b) 125#define RSAKEY_LIST_CLOSE(a) 126 127#endif 128 129#endif 130