Annotation of embedaddon/strongswan/src/libimcv/plugins/imv_attestation/attest_db.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2011-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 attest_db_t attest_db
                     18:  * @{ @ingroup libimcv
                     19:  */
                     20: 
                     21: #ifndef ATTEST_DB_H_
                     22: #define ATTEST_DB_H_
                     23: 
                     24: #include <pts/pts_meas_algo.h>
                     25: #include <os_info/os_info.h>
                     26: #include <library.h>
                     27: 
                     28: typedef struct attest_db_t attest_db_t;
                     29: 
                     30: /**
                     31:  * Attestation database object
                     32:  */
                     33: struct attest_db_t {
                     34: 
                     35:        /**
                     36:         * Set functional component to be queried
                     37:         *
                     38:         * @param comp                  functional component
                     39:         * @param create                if TRUE create database entry if it doesn't exist
                     40:         * @return                              TRUE if successful
                     41:         */
                     42:        bool (*set_component)(attest_db_t *this, char *comp, bool create);
                     43: 
                     44:        /**
                     45:         * Set primary key of the functional component to be queried
                     46:         *
                     47:         * @param fid                   primary key of functional component
                     48:         * @return                              TRUE if successful
                     49:         */
                     50:        bool (*set_cid)(attest_db_t *this, int fid);
                     51: 
                     52:        /**
                     53:         * Set directory to be queried
                     54:         *
                     55:         * @param dir                   directory
                     56:         * @param create                if TRUE create database entry if it doesn't exist
                     57:         * @return                              TRUE if successful
                     58:         */
                     59:        bool (*set_directory)(attest_db_t *this, char *dir, bool create);
                     60: 
                     61:        /**
                     62:         * Set primary key of the directory to be queried
                     63:         *
                     64:         * @param did                   primary key of directory
                     65:         * @return                              TRUE if successful
                     66:         */
                     67:        bool (*set_did)(attest_db_t *this, int did);
                     68: 
                     69:        /**
                     70:         * Set measurement file to be queried
                     71:         *
                     72:         * @param file                  measurement file
                     73:         * @param create                if TRUE create database entry if it doesn't exist
                     74:         * @return                              TRUE if successful
                     75:         */
                     76:        bool (*set_file)(attest_db_t *this, char *file, bool create);
                     77: 
                     78:        /**
                     79:         * Set primary key of the measurement file to be queried
                     80:         *
                     81:         * @param fid                   primary key of measurement file
                     82:         * @return                              TRUE if successful
                     83:         */
                     84:        bool (*set_fid)(attest_db_t *this, int fid);
                     85: 
                     86:        /**
                     87:         * Set path to directory where file[s] are to be measured
                     88:         *
                     89:         * @param meas_dir              measurement directory
                     90:         * @return                              TRUE if successful
                     91:         */
                     92:        bool (*set_meas_directory)(attest_db_t *this, char *dir);
                     93: 
                     94:        /**
                     95:         * Set functional component to be queried
                     96:         *
                     97:         * @param key                   AIK
                     98:         * @param create                if TRUE create database entry if it doesn't exist
                     99:         * @return                              TRUE if successful
                    100:         */
                    101:        bool (*set_key)(attest_db_t *this, chunk_t key, bool create);
                    102: 
                    103:        /**
                    104:         * Set primary key of the AIK to be queried
                    105:         *
                    106:         * @param kid                   primary key of AIK
                    107:         * @return                              TRUE if successful
                    108:         */
                    109:        bool (*set_kid)(attest_db_t *this, int kid);
                    110: 
                    111:        /**
                    112:         * Set software package to be queried
                    113:         *
                    114:         * @param product               software package
                    115:         * @param create                if TRUE create database entry if it doesn't exist
                    116:         * @return                              TRUE if successful
                    117:         */
                    118:        bool (*set_package)(attest_db_t *this, char *package, bool create);
                    119: 
                    120:        /**
                    121:         * Set primary key of the software package to be queried
                    122:         *
                    123:         * @param gid                   primary key of software package
                    124:         * @return                              TRUE if successful
                    125:         */
                    126:        bool (*set_gid)(attest_db_t *this, int gid);
                    127: 
                    128:        /**
                    129:         * Set software product to be queried
                    130:         *
                    131:         * @param product               software product
                    132:         * @param create                if TRUE create database entry if it doesn't exist
                    133:         * @return                              TRUE if successful
                    134:         */
                    135:        bool (*set_product)(attest_db_t *this, char *product, bool create);
                    136: 
                    137:        /**
                    138:         * Set primary key of the software product to be queried
                    139:         *
                    140:         * @param pid                   primary key of software product
                    141:         * @return                              TRUE if successful
                    142:         */
                    143:        bool (*set_pid)(attest_db_t *this, int pid);
                    144: 
                    145:        /**
                    146:         * Set software package version to be queried
                    147:         *
                    148:         * @param version               software package version
                    149:         * @return                              TRUE if successful
                    150:         */
                    151:        bool (*set_version)(attest_db_t *this, char *version);
                    152: 
                    153:        /**
                    154:         * Set measurement hash algorithm
                    155:         *
                    156:         * @param algo                  hash algorithm
                    157:         */
                    158:        void (*set_algo)(attest_db_t *this, pts_meas_algorithms_t algo);
                    159: 
                    160:        /**
                    161:         * Set that the IMA-specific SHA-1 template hash be computed
                    162:         */
                    163:        void (*set_ima)(attest_db_t *this);
                    164: 
                    165:        /**
                    166:         * Set that relative filenames are to be used
                    167:         */
                    168:        void (*set_relative)(attest_db_t *this);
                    169: 
                    170:        /**
                    171:         * Set the package security or blacklist state
                    172:         */
                    173:        void (*set_package_state)(attest_db_t *this, os_package_state_t package_state);
                    174: 
                    175:        /**
                    176:         * Set the sequence number
                    177:         */
                    178:        void (*set_sequence)(attest_db_t *this, int seq_no);
                    179: 
                    180:        /**
                    181:         * Set owner [user/host] of an AIK
                    182:         *
                    183:         * @param owner                 user/host name
                    184:         * @return                              TRUE if successful
                    185:         */
                    186:        void (*set_owner)(attest_db_t *this, char *owner);
                    187: 
                    188:        /**
                    189:         * Display all dates in UTC
                    190:         */
                    191:        void (*set_utc)(attest_db_t *this);
                    192: 
                    193:        /**
                    194:         * List all packages stored in the database
                    195:         */
                    196:        void (*list_packages)(attest_db_t *this);
                    197: 
                    198:        /**
                    199:         * List all products stored in the database
                    200:         */
                    201:        void (*list_products)(attest_db_t *this);
                    202: 
                    203:        /**
                    204:         * List all directories stored in the database
                    205:         */
                    206:        void (*list_directories)(attest_db_t *this);
                    207: 
                    208:        /**
                    209:         * List selected files stored in the database
                    210:         */
                    211:        void (*list_files)(attest_db_t *this);
                    212: 
                    213:        /**
                    214:         * List all components stored in the database
                    215:         */
                    216:        void (*list_components)(attest_db_t *this);
                    217: 
                    218:        /**
                    219:         * List all devices stored in the database
                    220:         */
                    221:        void (*list_devices)(attest_db_t *this);
                    222: 
                    223:        /**
                    224:         * List all AIKs stored in the database
                    225:         */
                    226:        void (*list_keys)(attest_db_t *this);
                    227: 
                    228:        /**
                    229:         * List selected measurement hashes stored in the database
                    230:         */
                    231:        void (*list_hashes)(attest_db_t *this);
                    232: 
                    233:        /**
                    234:         * List selected component measurement stored in the database
                    235:         */
                    236:        void (*list_measurements)(attest_db_t *this);
                    237: 
                    238:        /**
                    239:         * List sessions stored in the database
                    240:         */
                    241:        void (*list_sessions)(attest_db_t *this);
                    242: 
                    243:        /**
                    244:         * Add an entry to the database
                    245:         */
                    246:        bool (*add)(attest_db_t *this);
                    247: 
                    248:        /**
                    249:         * Delete an entry from the database
                    250:         */
                    251:        bool (*delete)(attest_db_t *this);
                    252: 
                    253:        /**
                    254:         * Destroy attest_db_t object
                    255:         */
                    256:        void (*destroy)(attest_db_t *this);
                    257: 
                    258: };
                    259: 
                    260: /**
                    261:  * Create an attest_db_t instance
                    262:  *
                    263:  * @param uri                          database URI
                    264:  */
                    265: attest_db_t* attest_db_create(char *uri);
                    266: 
                    267: #endif /** ATTEST_DB_H_ @}*/

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