static TPM_RESULT execute_TPM_UnBind(TPM_REQUEST *req, TPM_RESPONSE *rsp) { BYTE *ptr; UINT32 len; TPM_KEY_HANDLE keyHandle; UINT32 inDataSize; BYTE *inData; UINT32 outDataSize; BYTE *outData = NULL; TPM_RESULT res; /* compute parameter digest */ tpm_compute_in_param_digest(req); /* unmarshal input */ ptr = req->param; len = req->paramSize; if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle) || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize) || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize) || len != 0) return TPM_BAD_PARAMETER; /* execute command */ res = TPM_UnBind(keyHandle, inDataSize, inData, &req->auth1, &outDataSize, &outData); if (res != TPM_SUCCESS) return res; /* marshal output */ rsp->paramSize = len = 4 + outDataSize; rsp->param = ptr = ExtendBuf; if (ptr == NULL || tpm_marshal_UINT32(&ptr, &len, outDataSize) || tpm_marshal_BLOB(&ptr, &len, outData, outDataSize)) { free(rsp->param); res = TPM_FAIL; } free(outData); return res; }
static TPM_RESULT execute_TPM_MakeIdentity(TPM_REQUEST *req, TPM_RESPONSE *rsp) { BYTE *ptr; UINT32 len; TPM_ENCAUTH identityAuth; TPM_CHOSENID_HASH labelPrivCADigest; TPM_KEY idKeyParams; TPM_KEY idKey; UINT32 identityBindingSize; BYTE *identityBinding = NULL; TPM_RESULT res; /* compute parameter digest */ tpm_compute_in_param_digest(req); /* unmarshal input */ ptr = req->param; len = req->paramSize; if (tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &identityAuth) || tpm_unmarshal_TPM_CHOSENID_HASH(&ptr, &len, &labelPrivCADigest) || tpm_unmarshal_TPM_KEY(&ptr, &len, &idKeyParams) || len != 0) return TPM_BAD_PARAMETER; /* execute command */ res = TPM_MakeIdentity(&identityAuth, &labelPrivCADigest, &idKeyParams, &req->auth1, &req->auth2, &idKey, &identityBindingSize, &identityBinding); if (res != TPM_SUCCESS) return res; /* marshal output */ rsp->paramSize = len = sizeof_TPM_KEY(idKey) + 4 + identityBindingSize; rsp->param = ptr = ExtendBuf; if (tpm_marshal_TPM_KEY(&ptr, &len, &idKey) || tpm_marshal_UINT32(&ptr, &len, identityBindingSize) || tpm_marshal_BLOB(&ptr, &len, identityBinding, identityBindingSize)) { res = TPM_FAIL; } return res; }
static TPM_RESULT execute_MTM_InstallRIM(TPM_REQUEST *req, TPM_RESPONSE *rsp) { BYTE *ptr; UINT32 len; UINT32 rimCertSize; TPM_RIM_CERTIFICATE rimCertIn; TPM_RIM_CERTIFICATE rimCertOut; TPM_RESULT res; /* compute parameter digest */ tpm_compute_in_param_digest(req); /* unmarshal input */ ptr = req->param; len = req->paramSize; if (tpm_unmarshal_UINT32(&ptr, &len, &rimCertSize) || tpm_unmarshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCertIn) || len != 0) return TPM_BAD_PARAMETER; /* execute command */ res = MTM_InstallRIM(&rimCertIn, &req->auth1, &rimCertOut); if (res != TPM_SUCCESS) return res; /* marshal output */ rsp->paramSize = len = 4 + sizeof_TPM_RIM_CERTIFICATE(rimCertOut); rsp->param = ptr = tpm_malloc(len); if (ptr == NULL || tpm_marshal_UINT32(&ptr, &len, sizeof_TPM_RIM_CERTIFICATE(rimCertOut)) || tpm_marshal_TPM_RIM_CERTIFICATE(&ptr, &len, &rimCertOut)) { tpm_free(rsp->param); res = TPM_FAIL; } free_TPM_RIM_CERTIFICATE(rimCertOut); return res; }
inline TPM_RESULT return_UINT32(UINT32 *respSize, BYTE **resp, UINT32 value) { UINT32 len = *respSize = 4; BYTE *ptr = *resp = tpm_malloc(*respSize); if (ptr == NULL || tpm_marshal_UINT32(&ptr, &len, value)) { tpm_free(*resp); return TPM_FAIL; } return TPM_SUCCESS; }
static TPM_RESULT execute_TPM_CertifyKey(TPM_REQUEST *req, TPM_RESPONSE *rsp) { BYTE *ptr; UINT32 len; TPM_KEY_HANDLE certHandle; TPM_KEY_HANDLE keyHandle; TPM_NONCE antiReplay; TPM_CERTIFY_INFO certifyInfo; UINT32 outDataSize; BYTE *outData = NULL; TPM_RESULT res; /* compute parameter digest */ tpm_compute_in_param_digest(req); /* unmarshal input */ ptr = req->param; len = req->paramSize; if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &certHandle) || tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle) || tpm_unmarshal_TPM_NONCE(&ptr, &len, &antiReplay) || len != 0) return TPM_BAD_PARAMETER; /* execute command */ res = TPM_CertifyKey(certHandle, keyHandle, &antiReplay, &req->auth1, &req->auth2, &certifyInfo, &outDataSize, &outData); if (res != TPM_SUCCESS) return res; /* marshal output */ rsp->paramSize = len = sizeof_TPM_CERTIFY_INFO(certifyInfo) + 4 + outDataSize; rsp->param = ptr = ExtendBuf; if (ptr == NULL || tpm_marshal_TPM_CERTIFY_INFO(&ptr, &len, &certifyInfo) || tpm_marshal_UINT32(&ptr, &len, outDataSize) || tpm_marshal_BLOB(&ptr, &len, outData, outDataSize)) { free(rsp->param); res = TPM_FAIL; } free_TPM_CERTIFY_INFO(certifyInfo); free(outData); return res; }
static TPM_RESULT execute_TPM_Quote(TPM_REQUEST *req, TPM_RESPONSE *rsp) { BYTE *ptr; UINT32 len; TPM_KEY_HANDLE keyHandle; TPM_NONCE extrnalData; TPM_PCR_SELECTION targetPCR; TPM_PCR_COMPOSITE *pcrData; UINT32 sigSize; BYTE *sig = NULL; TPM_RESULT res; pcrData = (TPM_PCR_COMPOSITE *)InOutBuf; /* compute parameter digest */ tpm_compute_in_param_digest(req); /* unmarshal input */ ptr = req->param; len = req->paramSize; if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle) || tpm_unmarshal_TPM_NONCE(&ptr, &len, &extrnalData) || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &targetPCR) || len != 0) return TPM_BAD_PARAMETER; /* execute command */ res = TPM_Quote(keyHandle, &extrnalData, &targetPCR, &req->auth1, pcrData, &sigSize, &sig); if (res != TPM_SUCCESS) return res; /* marshal output */ rsp->paramSize = len = sizeof_TPM_PCR_COMPOSITE((*pcrData)) + 4 + sigSize; rsp->param = ptr = ExtendBuf; if (ptr == NULL || tpm_marshal_TPM_PCR_COMPOSITE(&ptr, &len, pcrData) || tpm_marshal_UINT32(&ptr, &len, sigSize) || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { free(rsp->param); res = TPM_FAIL; } free(sig); return res; }
TPM_RESULT TPM_ExecuteTransport(UINT32 inWrappedCmdSize, BYTE *inWrappedCmd, TPM_AUTH *auth1, UINT64 *currentTicks, TPM_MODIFIER_INDICATOR *locality, UINT32 *outWrappedCmdSize, BYTE **outWrappedCmd) { TPM_RESULT res; TPM_SESSION_DATA *session; TPM_REQUEST req; TPM_RESPONSE rsp; BYTE *ptr, buf[4 * 4 + 8 + 20]; UINT32 len, offset; tpm_sha1_ctx_t sha1; info("TPM_ExecuteTransport()"); /* get transport session */ session = tpm_get_transport(auth1->authHandle); if (session == NULL) return TPM_BAD_PARAMETER; /* unmarshal wrapped command */ len = inWrappedCmdSize; ptr = inWrappedCmd; if (tpm_unmarshal_TPM_REQUEST(&ptr, &len, &req)) return TPM_FAIL; /* decrypt wrapped command if needed */ ptr = tpm_malloc(req.paramSize); if (ptr == NULL) return TPM_FAIL; memcpy(ptr, req.param, req.paramSize); if (session->transInternal.transPublic.transAttributes & TPM_TRANSPORT_ENCRYPT) { if (req.ordinal == TPM_ORD_OIAP || req.ordinal == TPM_ORD_OSAP) { offset = req.paramSize; } else if (req.ordinal == TPM_ORD_DSAP) { offset = 30; } else { offset = tpm_get_in_param_offset(req.ordinal); } debug("decrypting %d bytes, starting at pos %d", req.paramSize - offset, offset); decrypt_wrapped_command(ptr + offset, req.paramSize - offset, auth1, session); } req.param = ptr; /* verify authorization */ tpm_compute_in_param_digest(&req); tpm_sha1_init(&sha1); tpm_sha1_update_be32(&sha1, TPM_ORD_ExecuteTransport); tpm_sha1_update_be32(&sha1, inWrappedCmdSize); tpm_sha1_update(&sha1, req.auth1.digest, sizeof(req.auth1.digest)); tpm_sha1_final(&sha1, auth1->digest); res = tpm_verify_auth(auth1, session->transInternal.authData, TPM_INVALID_HANDLE); if (res != TPM_SUCCESS) { tpm_free(req.param); return res; } /* nested transport sessions are not allowed */ if (req.ordinal == TPM_ORD_EstablishTransport || req.ordinal == TPM_ORD_ExecuteTransport || req.ordinal == TPM_ORD_ReleaseTransportSigned) { tpm_free(req.param); return TPM_NO_WRAP_TRANSPORT; } /* log input parameters */ if (session->transInternal.transPublic.transAttributes & TPM_TRANSPORT_LOG) { TPM_DIGEST keyDigest; compute_key_digest(&req, &keyDigest); transport_log_in(req.auth1.digest, keyDigest.digest, &session->transInternal.transDigest); } /* execute and audit command*/ tpm_audit_request(req.ordinal, &req); tpm_execute_command(&req, &rsp); tpm_audit_response(req.ordinal, &rsp); tpm_free(req.param); /* get locality and ticks */ *locality = tpmData.stany.flags.localityModifier; *currentTicks = tpmData.stany.data.currentTicks.currentTicks; /* if required, compute digest of internal output parameters */ debug("result = %d", rsp.result); if (rsp.result == TPM_SUCCESS) { if (rsp.tag == TPM_TAG_RSP_COMMAND) { rsp.auth1 = &req.auth1; tpm_compute_out_param_digest(req.ordinal, &rsp); } /* encrypt parameters */ if (session->transInternal.transPublic.transAttributes & TPM_TRANSPORT_ENCRYPT) { if (req.ordinal == TPM_ORD_OIAP || req.ordinal == TPM_ORD_OSAP) { offset = rsp.paramSize; } else if (req.ordinal == TPM_ORD_DSAP) { offset = rsp.paramSize; } else { offset = tpm_get_out_param_offset(req.ordinal); } debug("encrypting %d bytes, starting at pos %d", rsp.paramSize - offset, offset); encrypt_wrapped_command(rsp.param + offset, rsp.paramSize - offset, auth1, session); } } else { rsp.auth1 = &req.auth1; memset(rsp.auth1->digest, 0, sizeof(*rsp.auth1->digest)); } /* marshal response */ *outWrappedCmdSize = len = rsp.size; *outWrappedCmd = ptr = tpm_malloc(len); if (ptr == NULL) { tpm_free(rsp.param); return TPM_FAIL; } tpm_marshal_TPM_RESPONSE(&ptr, &len, &rsp); debug("marshalling done."); /* log output parameters */ if (session->transInternal.transPublic.transAttributes & TPM_TRANSPORT_LOG) { transport_log_out(rsp.auth1->digest, &session->transInternal.transDigest); } tpm_free(rsp.param); /* compute digest of output parameters */ ptr = buf; len = sizeof(buf); tpm_marshal_UINT32(&ptr, &len, TPM_SUCCESS); tpm_marshal_TPM_COMMAND_CODE(&ptr, &len, TPM_ORD_ExecuteTransport); tpm_marshal_UINT64(&ptr, &len, *currentTicks); tpm_marshal_TPM_MODIFIER_INDICATOR(&ptr, &len, *locality); tpm_marshal_UINT32(&ptr, &len, *outWrappedCmdSize); memcpy(ptr, rsp.auth1->digest, sizeof(rsp.auth1->digest)); tpm_sha1_init(&sha1); tpm_sha1_update(&sha1, buf, sizeof(buf)); tpm_sha1_final(&sha1, auth1->digest); return TPM_SUCCESS; }
TPM_RESULT TPM_EstablishTransport(TPM_KEY_HANDLE encHandle, TPM_TRANSPORT_PUBLIC *transPublic, UINT32 secretSize, BYTE *secret, TPM_AUTH *auth1, TPM_TRANSHANDLE *transHandle, TPM_MODIFIER_INDICATOR *locality, TPM_CURRENT_TICKS *currentTicks, TPM_NONCE *transNonceEven) { TPM_RESULT res; TPM_KEY_DATA *key; TPM_TRANSPORT_AUTH trans_auth; TPM_SESSION_DATA *session; info("TPM_EstablishTransport()"); /* setup authorization data */ if (encHandle == TPM_KH_TRANSPORT) { if (auth1->authHandle != TPM_INVALID_HANDLE) return TPM_BADTAG; if (transPublic->transAttributes & TPM_TRANSPORT_ENCRYPT) return TPM_BAD_SCHEME; if (secretSize != 20) return TPM_BAD_PARAM_SIZE; memcpy(trans_auth.authData, secret, 20); } else { /* get key and verify its usage */ key = tpm_get_key(encHandle); if (key == NULL) return TPM_INVALID_KEYHANDLE; if (key->keyUsage != TPM_KEY_STORAGE && key->keyUsage != TPM_KEY_LEGACY) return TPM_INVALID_KEYUSAGE; /* verify authorization */ if (key->authDataUsage != TPM_AUTH_NEVER) { res = tpm_verify_auth(auth1, key->usageAuth, encHandle); if (res != TPM_SUCCESS) return res; if (decrypt_transport_auth(key, secret, secretSize, &trans_auth)) return TPM_DECRYPT_ERROR; } } /* check whether the transport has to be encrypted */ if (transPublic->transAttributes & TPM_TRANSPORT_ENCRYPT) { if (tpmData.permanent.flags.FIPS && transPublic->algID == TPM_ALG_MGF1) return TPM_INAPPROPRIATE_ENC; /* until now, only MGF1 is supported */ if (transPublic->algID != TPM_ALG_MGF1) return TPM_BAD_KEY_PROPERTY; } /* initialize transport session */ tpm_get_random_bytes(transNonceEven->nonce, sizeof(transNonceEven->nonce)); *transHandle = tpm_get_free_session(TPM_ST_TRANSPORT); session = tpm_get_transport(*transHandle); if (session == NULL) return TPM_RESOURCES; session->transInternal.transHandle = *transHandle; memset(&session->transInternal.transDigest, 0, sizeof(TPM_DIGEST)); memcpy(&session->transInternal.transPublic, transPublic, sizeof_TPM_TRANSPORT_PUBLIC((*transPublic))); memcpy(&session->transInternal.transNonceEven, transNonceEven, sizeof(TPM_NONCE)); memcpy(&session->nonceEven, transNonceEven, sizeof(TPM_NONCE)); memcpy(&session->transInternal.authData, trans_auth.authData, sizeof(TPM_AUTHDATA)); *locality = tpmData.stany.flags.localityModifier; memcpy(currentTicks, &tpmData.stany.data.currentTicks, sizeof(TPM_CURRENT_TICKS)); /* perform transport logging */ if (transPublic->transAttributes & TPM_TRANSPORT_LOG) { tpm_sha1_ctx_t sha1; BYTE *ptr, buf[4 + 4 + 4 + sizeof_TPM_CURRENT_TICKS(x) + 20]; UINT32 len; /* log input */ memset(buf, 0, sizeof(buf)); transport_log_in(auth1->digest, buf, &session->transInternal.transDigest); /* compute digest of output parameters and log output */ ptr = buf; len = sizeof(buf); tpm_marshal_UINT32(&ptr, &len, TPM_SUCCESS); tpm_marshal_TPM_COMMAND_CODE(&ptr, &len, TPM_ORD_EstablishTransport); tpm_marshal_TPM_MODIFIER_INDICATOR(&ptr, &len, *locality); tpm_marshal_TPM_CURRENT_TICKS(&ptr, &len, currentTicks); tpm_marshal_TPM_NONCE(&ptr, &len, transNonceEven); tpm_sha1_init(&sha1); tpm_sha1_update(&sha1, buf, sizeof(buf)); tpm_sha1_final(&sha1, buf); transport_log_out(buf, &session->transInternal.transDigest); } /* check whether this is a exclusive transport session */ if (transPublic->transAttributes & TPM_TRANSPORT_EXCLUSIVE) { tpmData.stany.flags.transportExclusive = TRUE; tpmData.stany.data.transExclusive = *transHandle; } auth1->continueAuthSession = FALSE; return TPM_SUCCESS; }
static TPM_RESULT cap_property(UINT32 subCapSize, BYTE *subCap, UINT32 *respSize, BYTE **resp) { UINT32 i, j, property; if (tpm_unmarshal_UINT32(&subCap, &subCapSize, &property)) return TPM_BAD_MODE; switch (property) { case TPM_CAP_PROP_PCR: debug("[TPM_CAP_PROP_PCR]"); return return_UINT32(respSize, resp, TPM_NUM_PCR); case TPM_CAP_PROP_DIR: debug("[TPM_CAP_PROP_DIR]"); return return_UINT32(respSize, resp, 1); case TPM_CAP_PROP_MANUFACTURER: debug("[TPM_CAP_PROP_MANUFACTURER]"); return return_UINT32(respSize, resp, TPM_MANUFACTURER); case TPM_CAP_PROP_KEYS: debug("[TPM_CAP_PROP_KEYS]"); for (i = 0, j = TPM_MAX_KEYS; i < TPM_MAX_KEYS; i++) if (tpmData.permanent.data.keys[i].valid) j--; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_MIN_COUNTER: debug("[TPM_CAP_PROP_MIN_COUNTER]"); return return_UINT32(respSize, resp, 1); case TPM_CAP_PROP_AUTHSESS: debug("[TPM_CAP_PROP_AUTHSESS]"); for (i = 0, j = TPM_MAX_SESSIONS; i < TPM_MAX_SESSIONS; i++) if (tpmData.stany.data.sessions[i].type != TPM_ST_INVALID) j--; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_TRANSESS: debug("[TPM_CAP_PROP_TRANSESS]"); for (i = 0, j = TPM_MAX_SESSIONS; i < TPM_MAX_SESSIONS; i++) if (tpmData.stany.data.sessions[i].type != TPM_ST_INVALID) j--; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_COUNTERS: debug("[TPM_CAP_PROP_COUNTERS]"); for (i = 0, j = TPM_MAX_COUNTERS; i < TPM_MAX_COUNTERS; i++) if (tpmData.permanent.data.counters[i].valid) j--; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_MAX_AUTHSESS: debug("[TPM_CAP_PROP_MAX_AUTHSESS]"); return return_UINT32(respSize, resp, TPM_MAX_SESSIONS); case TPM_CAP_PROP_MAX_TRANSESS: debug("[TPM_CAP_PROP_MAX_TRANSESS]"); return return_UINT32(respSize, resp, TPM_MAX_SESSIONS); case TPM_CAP_PROP_MAX_COUNTERS: debug("[TPM_CAP_PROP_MAX_COUNTERS]"); return return_UINT32(respSize, resp, TPM_MAX_COUNTERS); case TPM_CAP_PROP_MAX_KEYS: debug("[TPM_CAP_PROP_MAX_KEYS]"); return return_UINT32(respSize, resp, TPM_MAX_KEYS); case TPM_CAP_PROP_OWNER: debug("[TPM_CAP_PROP_OWNER]"); return return_BOOL(respSize, resp, tpmData.permanent.flags.owned); case TPM_CAP_PROP_CONTEXT: debug("[TPM_CAP_PROP_CONTEXT]"); for (i = 0, j = 0; i < TPM_MAX_SESSION_LIST; i++) if (tpmData.stany.data.contextList[i] == 0) j++; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_MAX_CONTEXT: debug("[TPM_CAP_PROP_MAX_CONTEXT]"); return return_UINT32(respSize, resp, TPM_MAX_SESSION_LIST); case TPM_CAP_PROP_FAMILYROWS: debug("[TPM_CAP_PROP_FAMILYROWS]"); /* TODO: TPM_CAP_PROP_FAMILYROWS */ return TPM_FAIL; case TPM_CAP_PROP_TIS_TIMEOUT: debug("[TPM_CAP_PROP_TIS_TIMEOUT]"); /* TODO: TPM_CAP_PROP_TIS_TIMEOUT: Measure these values and determine correct ones */ UINT32 len = *respSize = 16; BYTE *ptr = *resp = tpm_malloc(*respSize); if (ptr == NULL || tpm_marshal_UINT32(&ptr, &len, 200000) || tpm_marshal_UINT32(&ptr, &len, 200000) || tpm_marshal_UINT32(&ptr, &len, 200000) || tpm_marshal_UINT32(&ptr, &len, 200000)) { tpm_free(*resp); return TPM_FAIL; } return TPM_SUCCESS; case TPM_CAP_PROP_STARTUP_EFFECT: debug("[TPM_CAP_PROP_STARTUP_EFFECT]"); /* TODO: TPM_CAP_PROP_STARTUP_EFFECT */ return TPM_FAIL; case TPM_CAP_PROP_DELEGATE_ROW: debug("[TPM_CAP_PROP_DELEGATE_ROW]"); /* TODO: TPM_CAP_PROP_DELEGATE_ROW */ return TPM_FAIL; case TPM_CAP_PROP_DAA_MAX: debug("[TPM_CAP_PROP_DAA_MAX]"); return return_UINT32(respSize, resp, TPM_MAX_SESSIONS_DAA); case TPM_CAP_PROP_SESSION_DAA: debug("[TPM_CAP_PROP_SESSION_DAA]"); for (i = 0, j = TPM_MAX_SESSIONS_DAA; i < TPM_MAX_SESSIONS_DAA; i++) if (tpmData.stany.data.sessionsDAA[i].type != TPM_ST_INVALID) j--; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_CONTEXT_DIST: debug("[TPM_CAP_PROP_CONTEXT_DIST]"); /* TODO: TPM_CAP_PROP_CONTEXT_DIST */ return TPM_FAIL; case TPM_CAP_PROP_DAA_INTERRUPT: debug("[TPM_CAP_PROP_DAA_INTERRUPT]"); /* A value of TRUE indicates that the TPM will accept ANY command * while executing a DAA Join or Sign. A value of FALSE indicates * that the TPM will invalidate the DAA Join or Sign upon the * receipt of any command other than the next join/sign in the * session or a TPM_SaveContext. */ return return_BOOL(respSize, resp, TRUE); case TPM_CAP_PROP_SESSIONS: debug("[TPM_CAP_PROP_SESSIONS]"); for (i = 0, j = TPM_MAX_SESSIONS; i < TPM_MAX_SESSIONS; i++) if (tpmData.stany.data.sessions[i].type != TPM_ST_INVALID) j--; return return_UINT32(respSize, resp, j); case TPM_CAP_PROP_MAX_SESSIONS: debug("[TPM_CAP_PROP_MAX_SESSIONS]"); return return_UINT32(respSize, resp, TPM_MAX_SESSIONS); case TPM_CAP_PROP_CMK_RESTRICTION: debug("[TPM_CAP_PROP_CMK_RESTRICTION]"); /* TODO: TPM_CAP_PROP_CMK_RESTRICTION */ return TPM_FAIL; case TPM_CAP_PROP_DURATION: debug("[TPM_CAP_PROP_DURATION]"); /* TODO: TPM_CAP_PROP_DURATION: Measure these values and return accurate ones */ BYTE dur[]= {0x0,0x0,0x0,0xc,0x0,0x7,0xa1,0x20,0x0,0x1e,0x84,0x80,0x11,0xe1,0xa3,0x0}; *respSize = 16; *resp = tpm_malloc(*respSize); memcpy(*resp,dur,16); return TPM_FAIL; case TPM_CAP_PROP_ACTIVE_COUNTER: debug("[TPM_CAP_PROP_ACTIVE_COUNTER]"); /* TODO: TPM_CAP_PROP_ACTIVE_COUNTER */ return TPM_FAIL; case TPM_CAP_PROP_MAX_NV_AVAILABLE: debug("[TPM_CAP_PROP_MAX_NV_AVAILABLE]"); /* TODO: TPM_CAP_PROP_MAX_NV_AVAILABLE */ return TPM_FAIL; case TPM_CAP_PROP_INPUT_BUFFER: debug("[TPM_CAP_PROP_INPUT_BUFFER]"); /* TODO: TPM_CAP_PROP_INPUT_BUFFER */ return TPM_FAIL; default: return TPM_BAD_MODE; } }