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. 2007
8 *
9 */
10
11#ifndef _AUTHSESS_H_
12#define _AUTHSESS_H_
13
14struct authsess {
15	TPM_AUTH *pAuth;
16	TPM_AUTH auth;
17
18	/* XOR masks created before each use of an OSAP session */
19	TPM_ENCAUTH encAuthUse;
20	TPM_ENCAUTH encAuthMig;
21
22	TSS_HCONTEXT tspContext;
23	TPM_COMMAND_CODE command;
24
25	TSS_HOBJECT obj_parent;
26	TSS_HPOLICY hUsageParent;
27	UINT32 parentMode;
28	TPM_SECRET parentSecret;
29	TSS_CALLBACK cb_xor, cb_hmac, cb_sealx;
30
31	TPM_ENTITY_TYPE entity_type;
32	UINT32 entityValueSize;
33	BYTE *entityValue;
34
35	TSS_HOBJECT obj_child;
36	TSS_HPOLICY hUsageChild, hMigChild;
37	UINT32 uMode, mMode;
38
39	/* Created during OSAP or DSAP protocol initiation */
40	TPM_NONCE nonceOddxSAP;
41	TPM_NONCE nonceEvenxSAP;
42	TPM_HMAC sharedSecret;
43
44	//MUTEX_DECLARE(lock);
45	//struct authsess *next;
46};
47
48TSS_RESULT authsess_oiap_get(TSS_HOBJECT, TPM_COMMAND_CODE, TPM_DIGEST *, TPM_AUTH *);
49TSS_RESULT authsess_oiap_put(TPM_AUTH *, TPM_DIGEST *);
50
51TSS_RESULT authsess_xsap_init(TSS_HCONTEXT, TSS_HOBJECT, TSS_HOBJECT, TSS_BOOL, TPM_COMMAND_CODE, TPM_ENTITY_TYPE, struct authsess **);
52TSS_RESULT authsess_xsap_hmac(struct authsess *, TPM_DIGEST *);
53TSS_RESULT authsess_xsap_verify(struct authsess *, TPM_DIGEST *);
54void       authsess_free(struct authsess *);
55
56#define TSS_AUTH_POLICY_REQUIRED	TRUE
57#define TSS_AUTH_POLICY_NOT_REQUIRED	FALSE
58
59#endif
60