Annotation of embedaddon/strongswan/src/libimcv/pts/pts_pcr.h, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>