Annotation of embedaddon/strongswan/src/libimcv/pts/pts_ima_event_list.h, revision 1.1.1.2

1.1       misho       1: /*
                      2:  * Copyright (C) 2014 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_ima_event_list pts_ima_event_list
                     18:  * @{ @ingroup pts
                     19:  */
                     20: 
                     21: #ifndef PTS_IMA_EVENT_LIST_H_
                     22: #define PTS_IMA_EVENT_LIST_H_
                     23: 
1.1.1.2 ! misho      24: #include "pts_meas_algo.h"
        !            25: 
1.1       misho      26: #include <time.h>
                     27: 
                     28: #include <library.h>
                     29: 
                     30: typedef struct pts_ima_event_list_t pts_ima_event_list_t;
                     31: 
                     32: #define IMA_PCR                                10
                     33: #define IMA_ALGO_LEN_MIN       5
                     34: #define IMA_ALGO_LEN_MAX       8
                     35: 
                     36: 
                     37: /**
                     38:  * Class retrieving Linux IMA file measurements
                     39:  *
                     40:  */
                     41: struct pts_ima_event_list_t {
                     42: 
                     43:        /**
                     44:         * Get the time the file measurements were taken
                     45:         *
                     46:         * @return                              Measurement time
                     47:         */
                     48:        time_t (*get_time)(pts_ima_event_list_t *this);
                     49: 
                     50:        /**
                     51:         * Get the number of non-processed file measurements
                     52:         *
                     53:         * @return                              Number of measurements left
                     54:         */
                     55:        int (*get_count)(pts_ima_event_list_t *this);
                     56: 
                     57:        /**
                     58:         * Get the next file measurement and remove it from the list
                     59:         *
                     60:         * @param measurement   Measurement hash
1.1.1.2 ! misho      61:         * @param algo                  Algorithm used to compute file digests
1.1       misho      62:         " @param name                  Event name (absolute filename or boot_aggregate)
                     63:         * @return                              Return code
                     64:         */
                     65:        status_t (*get_next)(pts_ima_event_list_t *this, chunk_t *measurement,
                     66:                                                 char **algo, char **name);
                     67: 
                     68:        /**
                     69:         * Destroys a pts_ima_event_list_t object.
                     70:         */
                     71:        void (*destroy)(pts_ima_event_list_t *this);
                     72: 
                     73: };
                     74: 
                     75: /**
                     76:  * Create a PTS IMA runtime file measurement object
                     77:  *
                     78:  * @param file                         Pathname pointing to the IMA runtime measurements
1.1.1.2 ! misho      79:  * @param pcr_algo                     PCR hash measurement algorithm to be used
        !            80:  * @param pcr_padding          Apply PCR hash padding if hash algorithm is lacking
        !            81:  */
        !            82: pts_ima_event_list_t* pts_ima_event_list_create(char *file,
        !            83:                                                        pts_meas_algorithms_t pcr_algo, bool pcr_padding);
        !            84: 
        !            85: /**
        !            86:  * Generate an IMA or IMA-NG hash from an event digest and event name
        !            87:  *
        !            88:  * @param digest               event digest
        !            89:  * @param ima_algo             event digest algorithm string ("sha1:", "sha256:", etc.)
        !            90:  * @param ima_name             event name
        !            91:  * @param pcr_algo             hash algorithm used by TPM PCR extension
        !            92:  * @param hash_buf             hash value to be compared with TPM measurement
        !            93:  * @return                             TRUE if computation successful
1.1       misho      94:  */
1.1.1.2 ! misho      95: bool pts_ima_event_hash(chunk_t digest, char *ima_algo, char *ima_name,
        !            96:                                                pts_meas_algorithms_t pcr_algo, char *hash_buf);
1.1       misho      97: 
                     98: #endif /** PTS_IMA_EVENT_LIST_H_ @}*/

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