From: Sansar Choinyambuu Date: Wed, 16 Nov 2011 15:42:47 +0000 (+0100) Subject: Functional Component Evidence Request object X-Git-Tag: 4.6.2~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42b08a4d05588ec3378e55ee8d399d3f90cb2d93;p=thirdparty%2Fstrongswan.git Functional Component Evidence Request object --- diff --git a/src/libpts/Makefile.am b/src/libpts/Makefile.am index bf0cbf920d..12bd2a7cfd 100644 --- a/src/libpts/Makefile.am +++ b/src/libpts/Makefile.am @@ -10,6 +10,7 @@ libpts_la_SOURCES = \ pts/pts.h pts/pts.c \ pts/pts_error.h pts/pts_error.c \ pts/pts_proto_caps.h pts/pts_funct_comp_name.h \ + pts/pts_funct_comp_evid_req.h pts/pts_funct_comp_evid_req.c \ pts/pts_creds.h pts/pts_creds.c \ pts/pts_database.h pts/pts_database.c \ pts/pts_dh_group.h pts/pts_dh_group.c \ diff --git a/src/libpts/pts/pts_funct_comp_evid_req.c b/src/libpts/pts/pts_funct_comp_evid_req.c new file mode 100644 index 0000000000..47641fe407 --- /dev/null +++ b/src/libpts/pts/pts_funct_comp_evid_req.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011 Sansar Choinyambuu + * HSR Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "pts_funct_comp_evid_req.h" + +#include +#include + +typedef struct private_pts_funct_comp_evid_req_t private_pts_funct_comp_evid_req_t; + +/** + * Private data of a private_pts_funct_comp_evid_req_t object. + * + */ +struct private_pts_funct_comp_evid_req_t { + + /** + * Public pts_funct_comp_evid_req_t interface. + */ + pts_funct_comp_evid_req_t public; + + /** + * List of Functional Component Evidence Requests + */ + linked_list_t *list; +}; + +METHOD(pts_funct_comp_evid_req_t, get_req_count, int, + private_pts_funct_comp_evid_req_t *this) +{ + return this->list->get_count(this->list); +} + +METHOD(pts_funct_comp_evid_req_t, add, void, + private_pts_funct_comp_evid_req_t *this, + funct_comp_evid_req_entry_t *entry) +{ + this->list->insert_last(this->list, entry); +} + +METHOD(pts_funct_comp_evid_req_t, create_enumerator, enumerator_t*, + private_pts_funct_comp_evid_req_t *this) +{ + return this->list->create_enumerator(this->list); +} + +METHOD(pts_funct_comp_evid_req_t, destroy, void, + private_pts_funct_comp_evid_req_t *this) +{ + this->list->destroy(this->list); + free(this); +} + +/** + * See header + */ +pts_funct_comp_evid_req_t *pts_funct_comp_evid_req_create() +{ + private_pts_funct_comp_evid_req_t *this; + + INIT(this, + .public = { + .get_req_count = _get_req_count, + .add = _add, + .create_enumerator = _create_enumerator, + .destroy = _destroy, + }, + .list = linked_list_create(), + ); + + return &this->public; +} + diff --git a/src/libpts/pts/pts_funct_comp_evid_req.h b/src/libpts/pts/pts_funct_comp_evid_req.h new file mode 100644 index 0000000000..7e2dbd33db --- /dev/null +++ b/src/libpts/pts/pts_funct_comp_evid_req.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2011 Sansar Choinyambuu + * HSR Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +/** + * @defgroup pts_funct_comp_evid_req pts_funct_comp_evid_req + * @{ @ingroup pts + */ + +#ifndef PTS_FUNCT_COMP_EVID_REQ_H_ +#define PTS_FUNCT_COMP_EVID_REQ_H_ + +typedef struct pts_funct_comp_evid_req_t pts_funct_comp_evid_req_t; +typedef enum pts_attr_req_funct_comp_evid_flag_t pts_attr_req_funct_comp_evid_flag_t; +typedef struct funct_comp_evid_req_entry_t funct_comp_evid_req_entry_t; + +#include +#include "pts_funct_comp_name.h" + +#define PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM 0x00 + +/** + * PTS Request Functional Component Evidence Flags + */ +enum pts_attr_req_funct_comp_evid_flag_t { + /** Transitive Trust Chain flag */ + PTS_REQ_FUNC_COMP_FLAG_TTC = (1<<7), + /** Verify Component flag */ + PTS_REQ_FUNC_COMP_FLAG_VER = (1<<6), + /** Current Evidence flag */ + PTS_REQ_FUNC_COMP_FLAG_CURR = (1<<5), + /** PCR Information flag */ + PTS_REQ_FUNC_COMP_FLAG_PCR = (1<<4), +}; + +/** + * PTS Functional Component Evidence Request entry + */ +struct funct_comp_evid_req_entry_t { + pts_attr_req_funct_comp_evid_flag_t flags; + u_int32_t sub_comp_depth; + u_int32_t vendor_id; + u_int8_t family; + pts_qualifier_t qualifier; + pts_ita_funct_comp_name_t name; +}; + +/** + * Class storing PTS Functional Component Evidence Request + */ +struct pts_funct_comp_evid_req_t { + + /** + * Get the number of requested components + * + * @return Number of requested components + */ + int (*get_req_count)(pts_funct_comp_evid_req_t *this); + + /** + * Add a PTS File Measurement + * + * @param entry PTS Functional Component Evidence Request entry + */ + void (*add)(pts_funct_comp_evid_req_t *this, + funct_comp_evid_req_entry_t *entry); + + /** + * Create a PTS Functional Component Evidence Request enumerator + * + * @return Enumerator returning flags, sub-component depth and + * functional component name + */ + enumerator_t* (*create_enumerator)(pts_funct_comp_evid_req_t *this); + + /** + * Destroys a pts_funct_comp_evid_req_t object. + */ + void (*destroy)(pts_funct_comp_evid_req_t *this); + +}; + +/** + * Creates a pts_funct_comp_evid_req_t object + */ +pts_funct_comp_evid_req_t* pts_funct_comp_evid_req_create(); + +#endif /** PTS_FUNCT_COMP_EVID_REQ_H_ @}*/