xref: /onnv-gate/usr/src/cmd/cmd-crypto/tpmadm/tpmadm.h (revision 11070:3ac202191cfa)
19126SWyllys.Ingersoll@Sun.COM /*
29126SWyllys.Ingersoll@Sun.COM  * CDDL HEADER START
39126SWyllys.Ingersoll@Sun.COM  *
49126SWyllys.Ingersoll@Sun.COM  * The contents of this file are subject to the terms of the
59126SWyllys.Ingersoll@Sun.COM  * Common Development and Distribution License (the "License").
69126SWyllys.Ingersoll@Sun.COM  * You may not use this file except in compliance with the License.
79126SWyllys.Ingersoll@Sun.COM  *
89126SWyllys.Ingersoll@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99126SWyllys.Ingersoll@Sun.COM  * or http://www.opensolaris.org/os/licensing.
109126SWyllys.Ingersoll@Sun.COM  * See the License for the specific language governing permissions
119126SWyllys.Ingersoll@Sun.COM  * and limitations under the License.
129126SWyllys.Ingersoll@Sun.COM  *
139126SWyllys.Ingersoll@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
149126SWyllys.Ingersoll@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
159126SWyllys.Ingersoll@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
169126SWyllys.Ingersoll@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
179126SWyllys.Ingersoll@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
189126SWyllys.Ingersoll@Sun.COM  *
199126SWyllys.Ingersoll@Sun.COM  * CDDL HEADER END
209126SWyllys.Ingersoll@Sun.COM  */
219126SWyllys.Ingersoll@Sun.COM 
229126SWyllys.Ingersoll@Sun.COM /*
239126SWyllys.Ingersoll@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
249126SWyllys.Ingersoll@Sun.COM  * Use is subject to license terms.
259126SWyllys.Ingersoll@Sun.COM  */
269126SWyllys.Ingersoll@Sun.COM 
279126SWyllys.Ingersoll@Sun.COM #ifndef _TPMADM_H
289126SWyllys.Ingersoll@Sun.COM #define	_TPMADM_H
299126SWyllys.Ingersoll@Sun.COM 
309126SWyllys.Ingersoll@Sun.COM #define	ERR_FAIL 1
319126SWyllys.Ingersoll@Sun.COM #define	ERR_USAGE 2
329126SWyllys.Ingersoll@Sun.COM 
339126SWyllys.Ingersoll@Sun.COM typedef int (*cmdfunc_t)(TSS_HCONTEXT hContext, TSS_HTPM hTPM,
349126SWyllys.Ingersoll@Sun.COM     int argc, char *argv[]);
359126SWyllys.Ingersoll@Sun.COM 
369126SWyllys.Ingersoll@Sun.COM typedef struct {
379126SWyllys.Ingersoll@Sun.COM 	char *name;
389126SWyllys.Ingersoll@Sun.COM 	char *args;
399126SWyllys.Ingersoll@Sun.COM 	cmdfunc_t func;
409126SWyllys.Ingersoll@Sun.COM } cmdtable_t;
419126SWyllys.Ingersoll@Sun.COM 
429126SWyllys.Ingersoll@Sun.COM /* Utility functions */
439126SWyllys.Ingersoll@Sun.COM void print_bytes(BYTE *bytes, size_t len, int formatted);
449126SWyllys.Ingersoll@Sun.COM void print_error(TSS_RESULT ret, char *msg);
459126SWyllys.Ingersoll@Sun.COM int get_tpm_capability(TSS_HCONTEXT hContext, TSS_HOBJECT hTPM,
469126SWyllys.Ingersoll@Sun.COM     UINT32 cap, UINT32 subcap, void *buf, size_t bufsize);
47*11070SScott.Rotondo@Sun.COM int set_policy_options(TSS_HPOLICY hPolicy, TSS_FLAG mode, char *prompt,
48*11070SScott.Rotondo@Sun.COM     UINT32 secret_len, BYTE *secret);
49*11070SScott.Rotondo@Sun.COM int set_object_policy(TSS_HOBJECT handle, TSS_FLAG mode, char *prompt,
50*11070SScott.Rotondo@Sun.COM     UINT32 secret_len, BYTE *secret);
519126SWyllys.Ingersoll@Sun.COM int tpm_preamble(TSS_HCONTEXT *hContext, TSS_HOBJECT *hTPM);
529126SWyllys.Ingersoll@Sun.COM int tpm_postamble(TSS_HCONTEXT hContext);
539126SWyllys.Ingersoll@Sun.COM 
549126SWyllys.Ingersoll@Sun.COM #define	UUID_PARSE(str, uuid)	uuid_parse(str, *(uuid_t *)&uuid)
559126SWyllys.Ingersoll@Sun.COM #define	UUID_UNPARSE(uuid, str)	uuid_unparse(*(uuid_t *)&uuid, str)
569126SWyllys.Ingersoll@Sun.COM #define	UUID_COPY(source, dest)  \
579126SWyllys.Ingersoll@Sun.COM 	bcopy((BYTE*)&(source), (BYTE*)&(dest), sizeof (TSS_UUID))
589126SWyllys.Ingersoll@Sun.COM #endif /* _TPMADM_H */
59