ikev1: Handle queued TRANSACTION messages only after processing replies
[strongswan.git] / src / libimcv / pts / pts_pcr.h
1 /*
2 * Copyright (C) 2012 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
26 #include <library.h>
27
28 /**
29 * Maximum number of PCR's of TPM, TPM Spec 1.2
30 */
31 #define PTS_PCR_MAX_NUM 24
32
33 /**
34 * Number of bytes that can be saved in a PCR of TPM, TPM Spec 1.2
35 */
36 #define PTS_PCR_LEN 20
37
38 /**
39 * Class implementing a shadow PCR register set
40 */
41 struct pts_pcr_t {
42
43 /**
44 * Get the number of selected PCRs
45 *
46 * @return number of selected PCRs
47 */
48 u_int32_t (*get_count)(pts_pcr_t *this);
49
50 /**
51 * Mark a PCR as selected
52 *
53 * @param pcr index of PCR
54 * @return TRUE if PCR index exists
55 */
56 bool (*select_pcr)(pts_pcr_t *this, u_int32_t pcr);
57
58 /**
59 * Get the size of the selection field in bytes
60 *
61 * @return number of bytes written
62 */
63 size_t (*get_selection_size)(pts_pcr_t *this);
64
65 /**
66 * Create an enumerator over all selected PCR indexes
67 *
68 * @return enumerator
69 */
70 enumerator_t* (*create_enumerator)(pts_pcr_t *this);
71
72 /**
73 * Get the current content of a PCR
74 *
75 * @param pcr index of PCR
76 * @return content of PCR
77 */
78 chunk_t (*get)(pts_pcr_t *this, u_int32_t pcr);
79
80 /**
81 * Set the content of a PCR
82 *
83 * @param pcr index of PCR
84 * @param value new value of PCR
85 * @return TRUE if value could be set
86 */
87 bool (*set)(pts_pcr_t *this, u_int32_t pcr, chunk_t value);
88
89 /**
90 * Extend the content of a PCR
91 *
92 * @param pcr index of PCR
93 * @param measurement measurment value to be extended into PCR
94 * @return new content of PCR
95 */
96 chunk_t (*extend)(pts_pcr_t *this, u_int32_t pcr, chunk_t measurement);
97
98 /**
99 * Create a PCR Composite object over all selected PCRs
100 *
101 * @return PCR Composite object (must be freed)
102 */
103 chunk_t (*get_composite)(pts_pcr_t *this);
104
105 /**
106
107 * Destroys a pts_pcr_t object.
108 */
109 void (*destroy)(pts_pcr_t *this);
110
111 };
112
113 /**
114 * Creates an pts_pcr_t object
115 */
116 pts_pcr_t* pts_pcr_create(void);
117
118 #endif /** PTS_PCR_H_ @}*/