Annotation of embedaddon/strongswan/src/libimcv/pts/pts_pcr.h, revision 1.1.1.2
1.1 misho 1: /*
2: * Copyright (C) 2012-2016 Andreas Steffen
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * @defgroup pts_pcr pts_pcr
18: * @{ @ingroup pts
19: */
20:
21: #ifndef PTS_PCR_H_
22: #define PTS_PCR_H_
23:
24: typedef struct pts_pcr_t pts_pcr_t;
25:
1.1.1.2 ! misho 26: #include "pts_meas_algo.h"
! 27:
1.1 misho 28: #include <library.h>
29:
1.1.1.2 ! misho 30: #include <tpm_tss.h>
1.1 misho 31: #include <tpm_tss_quote_info.h>
32:
33: /**
34: * Maximum number of PCR's of TPM, TPM Spec 1.2
35: */
36: #define PTS_PCR_MAX_NUM 24
37:
38: /**
39: * Class implementing a shadow PCR register set
40: */
41: struct pts_pcr_t {
42:
43: /**
1.1.1.2 ! misho 44: * Get the hash algorithm used by the PCR bank
! 45: *
! 46: * @return hash_measurement algorithm
! 47: */
! 48: pts_meas_algorithms_t(*get_pcr_algo)(pts_pcr_t *this);
! 49:
! 50: /**
1.1 misho 51: * Get the number of selected PCRs
52: *
53: * @return number of selected PCRs
54: */
55: uint32_t (*get_count)(pts_pcr_t *this);
56:
57: /**
58: * Mark a PCR as selected
59: *
60: * @param pcr index of PCR
61: * @return TRUE if PCR index exists
62: */
63: bool (*select_pcr)(pts_pcr_t *this, uint32_t pcr);
64:
65: /**
66: * Get the size of the selection field in bytes
67: *
68: * @return number of bytes written
69: */
70: size_t (*get_selection_size)(pts_pcr_t *this);
71:
72: /**
73: * Create an enumerator over all selected PCR indexes
74: *
75: * @return enumerator
76: */
77: enumerator_t* (*create_enumerator)(pts_pcr_t *this);
78:
79: /**
80: * Get the current content of a PCR
81: *
82: * @param pcr index of PCR
83: * @return content of PCR
84: */
85: chunk_t (*get)(pts_pcr_t *this, uint32_t pcr);
86:
87: /**
88: * Set the content of a PCR
89: *
90: * @param pcr index of PCR
91: * @param value new value of PCR
92: * @return TRUE if value could be set
93: */
94: bool (*set)(pts_pcr_t *this, uint32_t pcr, chunk_t value);
95:
96: /**
97: * Extend the content of a PCR
98: *
99: * @param pcr index of PCR
100: * @param measurement measurement value to be extended into PCR
101: * @return new content of PCR
102: */
103: chunk_t (*extend)(pts_pcr_t *this, uint32_t pcr, chunk_t measurement);
104:
105: /**
106: * Create a PCR Composite object over all selected PCRs
107: *
108: * @return PCR Composite object (must be freed)
109: */
110: tpm_tss_pcr_composite_t* (*get_composite)(pts_pcr_t *this);
111:
112: /**
113:
114: * Destroys a pts_pcr_t object.
115: */
116: void (*destroy)(pts_pcr_t *this);
117:
118: };
119:
120: /**
121: * Creates an pts_pcr_t object
1.1.1.2 ! misho 122: *
! 123: * @param tpm_version TPM version
! 124: * @param algo Hash algorithm used by PCR bank
! 125: * @param locality TPM locality in which the PCR bank was initialized
1.1 misho 126: */
1.1.1.2 ! misho 127: pts_pcr_t* pts_pcr_create(tpm_version_t tpm_version, pts_meas_algorithms_t algo,
! 128: uint8_t locality);
1.1 misho 129:
130: #endif /** PTS_PCR_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>