Implemented Diffie Hellman Nonce attributes
This commit is contained in:
committed by
Andreas Steffen
parent
4ec5d26fdf
commit
9a49d2e065
@@ -26,6 +26,9 @@
|
||||
#include <pts/pts_error.h>
|
||||
|
||||
#include <tcg/tcg_pts_attr_proto_caps.h>
|
||||
#include <tcg/tcg_pts_attr_dh_nonce_params_req.h>
|
||||
#include <tcg/tcg_pts_attr_dh_nonce_params_resp.h>
|
||||
#include <tcg/tcg_pts_attr_dh_nonce_finish.h>
|
||||
#include <tcg/tcg_pts_attr_meas_algo.h>
|
||||
#include <tcg/tcg_pts_attr_get_tpm_version_info.h>
|
||||
#include <tcg/tcg_pts_attr_tpm_version_info.h>
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
#include <tcg/tcg_attr.h>
|
||||
#include <tcg/tcg_pts_attr_proto_caps.h>
|
||||
#include <tcg/tcg_pts_attr_dh_nonce_params_req.h>
|
||||
#include <tcg/tcg_pts_attr_dh_nonce_params_resp.h>
|
||||
#include <tcg/tcg_pts_attr_dh_nonce_finish.h>
|
||||
#include <tcg/tcg_pts_attr_meas_algo.h>
|
||||
#include <tcg/tcg_pts_attr_get_tpm_version_info.h>
|
||||
#include <tcg/tcg_pts_attr_tpm_version_info.h>
|
||||
|
||||
@@ -17,6 +17,9 @@ libpts_la_SOURCES = \
|
||||
pts/pts_meas_algo.h pts/pts_meas_algo.c \
|
||||
tcg/tcg_attr.h tcg/tcg_attr.c \
|
||||
tcg/tcg_pts_attr_proto_caps.h tcg/tcg_pts_attr_proto_caps.c \
|
||||
tcg/tcg_pts_attr_dh_nonce_params_req.h tcg/tcg_pts_attr_dh_nonce_params_req.c \
|
||||
tcg/tcg_pts_attr_dh_nonce_params_resp.h tcg/tcg_pts_attr_dh_nonce_params_resp.c \
|
||||
tcg/tcg_pts_attr_dh_nonce_finish.h tcg/tcg_pts_attr_dh_nonce_finish.c \
|
||||
tcg/tcg_pts_attr_meas_algo.h tcg/tcg_pts_attr_meas_algo.c \
|
||||
tcg/tcg_pts_attr_get_tpm_version_info.h tcg/tcg_pts_attr_get_tpm_version_info.c \
|
||||
tcg/tcg_pts_attr_tpm_version_info.h tcg/tcg_pts_attr_tpm_version_info.c \
|
||||
@@ -30,3 +33,4 @@ libpts_la_SOURCES = \
|
||||
tcg/tcg_pts_attr_file_meas.h tcg/tcg_pts_attr_file_meas.c \
|
||||
tcg/tcg_pts_attr_req_file_meta.h tcg/tcg_pts_attr_req_file_meta.c \
|
||||
tcg/tcg_pts_attr_unix_file_meta.h tcg/tcg_pts_attr_unix_file_meta.c
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#include "tcg_attr.h"
|
||||
#include "tcg/tcg_pts_attr_proto_caps.h"
|
||||
#include "tcg/tcg_pts_attr_dh_nonce_params_req.h"
|
||||
#include "tcg/tcg_pts_attr_dh_nonce_params_resp.h"
|
||||
#include "tcg/tcg_pts_attr_dh_nonce_finish.h"
|
||||
#include "tcg/tcg_pts_attr_meas_algo.h"
|
||||
#include "tcg/tcg_pts_attr_get_tpm_version_info.h"
|
||||
#include "tcg/tcg_pts_attr_tpm_version_info.h"
|
||||
@@ -156,6 +159,12 @@ pa_tnc_attr_t* tcg_attr_create_from_data(u_int32_t type, chunk_t value)
|
||||
return tcg_pts_attr_proto_caps_create_from_data(value, TRUE);
|
||||
case TCG_PTS_PROTO_CAPS:
|
||||
return tcg_pts_attr_proto_caps_create_from_data(value, FALSE);
|
||||
case TCG_PTS_DH_NONCE_PARAMS_REQ:
|
||||
return tcg_pts_attr_dh_nonce_params_req_create(value);
|
||||
case TCG_PTS_DH_NONCE_PARAMS_RESP:
|
||||
return tcg_pts_attr_dh_nonce_params_resp_create(value);
|
||||
case TCG_PTS_DH_NONCE_FINISH:
|
||||
return tcg_pts_attr_dh_nonce_finish_create(value);
|
||||
case TCG_PTS_MEAS_ALGO:
|
||||
return tcg_pts_attr_meas_algo_create_from_data(value, FALSE);
|
||||
case TCG_PTS_MEAS_ALGO_SELECTION:
|
||||
@@ -184,9 +193,6 @@ pa_tnc_attr_t* tcg_attr_create_from_data(u_int32_t type, chunk_t value)
|
||||
return tcg_pts_attr_req_file_meta_create_from_data(value);
|
||||
case TCG_PTS_UNIX_FILE_META:
|
||||
return tcg_pts_attr_unix_file_meta_create_from_data(value);
|
||||
case TCG_PTS_DH_NONCE_PARAMS_REQ:
|
||||
case TCG_PTS_DH_NONCE_PARAMS_RESP:
|
||||
case TCG_PTS_DH_NONCE_FINISH:
|
||||
case TCG_PTS_REQ_TEMPL_REF_MANI_SET_META:
|
||||
case TCG_PTS_TEMPL_REF_MANI_SET_META:
|
||||
case TCG_PTS_UPDATE_TEMPL_REF_MANI:
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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 "tcg_pts_attr_dh_nonce_finish.h"
|
||||
|
||||
#include <pa_tnc/pa_tnc_msg.h>
|
||||
#include <bio/bio_writer.h>
|
||||
#include <bio/bio_reader.h>
|
||||
#include <debug.h>
|
||||
|
||||
typedef struct private_tcg_pts_attr_dh_nonce_finish_t private_tcg_pts_attr_dh_nonce_finish_t;
|
||||
|
||||
/**
|
||||
* PTS DH Nonce Finish
|
||||
* see section 3.8.3 of PTS Protocol: Binding to TNC IF-M Specification
|
||||
*
|
||||
* 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Reserved | Nonce Len | Selected Hash Algorithm |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | D-H Initiator Public Value ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | D-H Initiator Nonce ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*
|
||||
*/
|
||||
|
||||
#define PTS_DH_NONCE_FINISH_SIZE 12
|
||||
#define PTS_DH_NONCE_FINISH_RESERVED 0x00
|
||||
|
||||
/**
|
||||
* Private data of an tcg_pts_attr_dh_nonce_finish_t object.
|
||||
*/
|
||||
struct private_tcg_pts_attr_dh_nonce_finish_t {
|
||||
|
||||
/**
|
||||
* Public members of tcg_pts_attr_dh_nonce_finish_t
|
||||
*/
|
||||
tcg_pts_attr_dh_nonce_finish_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
*/
|
||||
chunk_t value;
|
||||
|
||||
/**
|
||||
* Noskip flag
|
||||
*/
|
||||
bool noskip_flag;
|
||||
|
||||
/**
|
||||
* Length of nonce
|
||||
*/
|
||||
u_int8_t nonce_len;
|
||||
|
||||
/**
|
||||
* Selected Hashing Algorithm
|
||||
*/
|
||||
pts_meas_algorithms_t hash_algo;
|
||||
|
||||
/**
|
||||
* DH Initiator Public Value
|
||||
*/
|
||||
chunk_t initiator_pub_val;
|
||||
|
||||
/**
|
||||
* DH Initiator Nonce
|
||||
*/
|
||||
chunk_t initiator_nonce;
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->type;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_value, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_noskip_flag, bool,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->noskip_flag;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, set_noskip_flag,void,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this, bool noskip)
|
||||
{
|
||||
this->noskip_flag = noskip;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, build, void,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
bio_writer_t *writer;
|
||||
|
||||
writer = bio_writer_create(PTS_DH_NONCE_FINISH_SIZE);
|
||||
writer->write_uint8 (writer, PTS_DH_NONCE_FINISH_RESERVED);
|
||||
writer->write_uint8 (writer, this->nonce_len);
|
||||
writer->write_uint16(writer, this->hash_algo);
|
||||
writer->write_data (writer, this->initiator_pub_val);
|
||||
writer->write_data (writer, this->initiator_nonce);
|
||||
|
||||
this->value = chunk_clone(writer->get_buf(writer));
|
||||
writer->destroy(writer);
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, process, status_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this, u_int32_t *offset)
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
u_int8_t reserved;
|
||||
u_int16_t hash_algo;
|
||||
|
||||
if (this->value.len < PTS_DH_NONCE_FINISH_SIZE)
|
||||
{
|
||||
DBG1(DBG_TNC, "insufficient data for PTS DH Nonce Finish");
|
||||
*offset = 0;
|
||||
return FAILED;
|
||||
}
|
||||
reader = bio_reader_create(this->value);
|
||||
reader->read_uint8 (reader, &reserved);
|
||||
reader->read_uint8 (reader, &this->nonce_len);
|
||||
reader->read_uint16(reader, &hash_algo);
|
||||
this->hash_algo = hash_algo;
|
||||
reader->read_data(reader, reader->remaining(reader) - this->nonce_len,
|
||||
&this->initiator_pub_val);
|
||||
reader->read_data(reader, this->nonce_len, &this->initiator_nonce);
|
||||
|
||||
reader->destroy(reader);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, destroy, void,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
free(this->value.ptr);
|
||||
free(this->initiator_pub_val.ptr);
|
||||
free(this->initiator_nonce.ptr);
|
||||
free(this);
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_finish_t, get_nonce_len, u_int8_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->nonce_len;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_finish_t, get_hash_algo, pts_meas_algorithms_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->hash_algo;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_finish_t, get_initiator_pub_val, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->initiator_pub_val;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_finish_t, get_initiator_nonce, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this)
|
||||
{
|
||||
return this->initiator_nonce;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_dh_nonce_finish_create(u_int8_t nonce_len,
|
||||
pts_meas_algorithms_t hash_algo,
|
||||
chunk_t initiator_nonce,
|
||||
chunk_t initiator_pub_val)
|
||||
{
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
.set_noskip_flag = _set_noskip_flag,
|
||||
.build = _build,
|
||||
.process = _process,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_nonce_len = _get_nonce_len,
|
||||
.get_hash_algo = _get_hash_algo,
|
||||
.get_initiator_nonce = _get_initiator_nonce,
|
||||
.get_initiator_pub_val = _get_initiator_pub_val,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_DH_NONCE_FINISH,
|
||||
.nonce_len = nonce_len,
|
||||
.hash_algo = hash_algo,
|
||||
.initiator_nonce = initiator_nonce,
|
||||
.initiator_pub_val = initiator_pub_val,
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_dh_nonce_finish_create_from_data(chunk_t value)
|
||||
{
|
||||
private_tcg_pts_attr_dh_nonce_finish_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
.set_noskip_flag = _set_noskip_flag,
|
||||
.build = _build,
|
||||
.process = _process,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_nonce_len = _get_nonce_len,
|
||||
.get_hash_algo = _get_hash_algo,
|
||||
.get_initiator_nonce = _get_initiator_nonce,
|
||||
.get_initiator_pub_val = _get_initiator_pub_val,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_DH_NONCE_FINISH,
|
||||
.value = chunk_clone(value),
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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 tcg_pts_attr_dh_nonce_finish tcg_pts_attr_dh_nonce_finish
|
||||
* @{ @ingroup tcg_pts_attr_dh_nonce_finish
|
||||
*/
|
||||
|
||||
#ifndef TCG_PTS_ATTR_DH_NONCE_FINISH_H_
|
||||
#define TCG_PTS_ATTR_DH_NONCE_FINISH_H_
|
||||
|
||||
typedef struct tcg_pts_attr_dh_nonce_finish_t tcg_pts_attr_dh_nonce_finish_t;
|
||||
|
||||
#include "tcg_attr.h"
|
||||
#include "pa_tnc/pa_tnc_attr.h"
|
||||
#include "pts/pts_meas_algo.h"
|
||||
|
||||
/**
|
||||
* Class implementing the TCG PTS DH Nonce Finish Attribute
|
||||
*/
|
||||
struct tcg_pts_attr_dh_nonce_finish_t {
|
||||
|
||||
/**
|
||||
* Public PA-TNC attribute interface
|
||||
*/
|
||||
pa_tnc_attr_t pa_tnc_attribute;
|
||||
|
||||
/**
|
||||
* Get nonce length
|
||||
*
|
||||
* @return Length of nonce
|
||||
*/
|
||||
u_int8_t (*get_nonce_len)(tcg_pts_attr_dh_nonce_finish_t *this);
|
||||
|
||||
/**
|
||||
* Get selected hash algorithm
|
||||
*
|
||||
* @return Selected hash algorithm
|
||||
*/
|
||||
pts_meas_algorithms_t (*get_hash_algo)(tcg_pts_attr_dh_nonce_finish_t *this);
|
||||
|
||||
/**
|
||||
* Get DH Initiator Public Value
|
||||
*
|
||||
* @return DH Initiator Public Value
|
||||
*/
|
||||
chunk_t (*get_initiator_pub_val)(tcg_pts_attr_dh_nonce_finish_t *this);
|
||||
|
||||
/**
|
||||
* Get DH Initiator Nonce
|
||||
*
|
||||
* @return DH Initiator Nonce
|
||||
*/
|
||||
chunk_t (*get_initiator_nonce)(tcg_pts_attr_dh_nonce_finish_t *this);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_dh_nonce_finish_t object
|
||||
*
|
||||
* @param nonce_len Length of nonce
|
||||
* @param hash_algo Selected hash algorithm
|
||||
* @param initiator_nonce DH Initiator Nonce
|
||||
* @param initiator_pub_val DH Initiator Public value
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_dh_nonce_finish_create(u_int8_t nonce_len,
|
||||
pts_meas_algorithms_t hash_algo,
|
||||
chunk_t initiator_nonce,
|
||||
chunk_t initiator_pub_val);
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_dh_nonce_finish_t object from received data
|
||||
*
|
||||
* @param value unparsed attribute value
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_dh_nonce_finish_create_from_data(chunk_t value);
|
||||
|
||||
#endif /** TCG_PTS_ATTR_DH_NONCE_FINISH_H_ @}*/
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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 "tcg_pts_attr_dh_nonce_params_req.h"
|
||||
|
||||
#include <pa_tnc/pa_tnc_msg.h>
|
||||
#include <bio/bio_writer.h>
|
||||
#include <bio/bio_reader.h>
|
||||
#include <debug.h>
|
||||
|
||||
typedef struct private_tcg_pts_attr_dh_nonce_params_req_t private_tcg_pts_attr_dh_nonce_params_req_t;
|
||||
|
||||
/**
|
||||
* PTS DH Nonce Parameters Request
|
||||
* see section 3.8.1 of PTS Protocol: Binding to TNC IF-M Specification
|
||||
*
|
||||
* 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Reserved | Min. Nonce Len | D-H Group Set |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*
|
||||
*/
|
||||
|
||||
#define PTS_DH_NONCE_PARAMS_REQ_SIZE 4
|
||||
#define PTS_DH_NONCE_PARAMS_REQ_RESERVED 0x00
|
||||
|
||||
/**
|
||||
* Private data of an tcg_pts_attr_dh_nonce_params_req_t object.
|
||||
*/
|
||||
struct private_tcg_pts_attr_dh_nonce_params_req_t {
|
||||
|
||||
/**
|
||||
* Public members of tcg_pts_attr_dh_nonce_params_req_t
|
||||
*/
|
||||
tcg_pts_attr_dh_nonce_params_req_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
*/
|
||||
chunk_t value;
|
||||
|
||||
/**
|
||||
* Noskip flag
|
||||
*/
|
||||
bool noskip_flag;
|
||||
|
||||
/**
|
||||
* Minimum acceptable length of nonce
|
||||
*/
|
||||
u_int8_t min_nonce_len;
|
||||
|
||||
/**
|
||||
* Diffie Hellman group set
|
||||
*/
|
||||
pts_dh_group_t dh_groups;
|
||||
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
return this->type;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_value, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_noskip_flag, bool,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
return this->noskip_flag;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, set_noskip_flag,void,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this, bool noskip)
|
||||
{
|
||||
this->noskip_flag = noskip;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, build, void,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
bio_writer_t *writer;
|
||||
|
||||
writer = bio_writer_create(PTS_DH_NONCE_PARAMS_REQ_SIZE);
|
||||
writer->write_uint8(writer, PTS_DH_NONCE_PARAMS_REQ_RESERVED);
|
||||
writer->write_uint8(writer, this->min_nonce_len);
|
||||
writer->write_uint8(writer, this->dh_groups);
|
||||
|
||||
this->value = chunk_clone(writer->get_buf(writer));
|
||||
writer->destroy(writer);
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, process, status_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this, u_int32_t *offset)
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
u_int8_t reserved;
|
||||
u_int16_t dh_groups;
|
||||
|
||||
if (this->value.len < PTS_DH_NONCE_PARAMS_REQ_SIZE)
|
||||
{
|
||||
DBG1(DBG_TNC, "insufficient data for PTS DH Nonce Parameters Request");
|
||||
*offset = 0;
|
||||
return FAILED;
|
||||
}
|
||||
reader = bio_reader_create(this->value);
|
||||
reader->read_uint8(reader, &reserved);
|
||||
reader->read_uint8(reader, &this->min_nonce_len);
|
||||
reader->read_uint16(reader, &dh_groups);
|
||||
this->dh_groups = dh_groups;
|
||||
reader->destroy(reader);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, destroy, void,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
free(this->value.ptr);
|
||||
free(this);
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_req_t, get_min_nonce_len, u_int8_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
return this->min_nonce_len;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_req_t, get_dh_groups, pts_dh_group_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this)
|
||||
{
|
||||
return this->dh_groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_req_create(u_int8_t min_nonce_len,
|
||||
pts_dh_group_t dh_groups)
|
||||
{
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
.set_noskip_flag = _set_noskip_flag,
|
||||
.build = _build,
|
||||
.process = _process,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_min_nonce_len = _get_min_nonce_len,
|
||||
.get_dh_groups = _get_dh_groups,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_DH_NONCE_PARAMS_REQ,
|
||||
.min_nonce_len = min_nonce_len,
|
||||
.dh_groups = dh_groups,
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_req_create_from_data(chunk_t value)
|
||||
{
|
||||
private_tcg_pts_attr_dh_nonce_params_req_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
.set_noskip_flag = _set_noskip_flag,
|
||||
.build = _build,
|
||||
.process = _process,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_min_nonce_len = _get_min_nonce_len,
|
||||
.get_dh_groups = _get_dh_groups,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_DH_NONCE_PARAMS_REQ,
|
||||
.value = chunk_clone(value),
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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 tcg_pts_attr_dh_nonce_params_req tcg_pts_attr_dh_nonce_params_req
|
||||
* @{ @ingroup tcg_pts_attr_dh_nonce_params_req
|
||||
*/
|
||||
|
||||
#ifndef TCG_PTS_ATTR_DH_NONCE_PARAMS_REQ_H_
|
||||
#define TCG_PTS_ATTR_DH_NONCE_PARAMS_REQ_H_
|
||||
|
||||
typedef struct tcg_pts_attr_dh_nonce_params_req_t tcg_pts_attr_dh_nonce_params_req_t;
|
||||
typedef enum pts_dh_group_t pts_dh_group_t;
|
||||
|
||||
#include "tcg_attr.h"
|
||||
#include "pa_tnc/pa_tnc_attr.h"
|
||||
|
||||
/**
|
||||
* PTS Diffie Hellman Group Values
|
||||
*/
|
||||
enum pts_dh_group_t {
|
||||
/** IKE Group 2 */
|
||||
PTS_DH_GROUP_IKE2 = (1<<15),
|
||||
/** IKE Group 5 */
|
||||
PTS_DH_GROUP_IKE5 = (1<<14),
|
||||
/** IKE Group 14 */
|
||||
PTS_DH_GROUP_IKE14 = (1<<13),
|
||||
/** IKE Group 19, Elliptic curves using NIST 256 bit prime modules */
|
||||
PTS_DH_GROUP_IKE19 = (1<<12),
|
||||
/** IKE Group 20, Elliptic curves using NIST 384 bit prime modules */
|
||||
PTS_DH_GROUP_IKE20 = (1<<11),
|
||||
};
|
||||
|
||||
/**
|
||||
* Class implementing the TCG PTS DH Nonce Parameters Request Attribute
|
||||
*/
|
||||
struct tcg_pts_attr_dh_nonce_params_req_t {
|
||||
|
||||
/**
|
||||
* Public PA-TNC attribute interface
|
||||
*/
|
||||
pa_tnc_attr_t pa_tnc_attribute;
|
||||
|
||||
/**
|
||||
* Get Minimum nonce length
|
||||
*
|
||||
* @return Minimum acceptable length of nonce
|
||||
*/
|
||||
u_int8_t (*get_min_nonce_len)(tcg_pts_attr_dh_nonce_params_req_t *this);
|
||||
|
||||
/**
|
||||
* Get supported Diffie Hellman Groups
|
||||
*
|
||||
* @return Supported Diffie Hellman Groups
|
||||
*/
|
||||
pts_dh_group_t (*get_dh_groups)(tcg_pts_attr_dh_nonce_params_req_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_dh_nonce_params_req_t object
|
||||
*
|
||||
* @param min_nonce_len Minimum acceptable length of nonce
|
||||
* @param dh_groups Initiator's supported DH groups
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_dh_nonce_params_req_create(u_int8_t min_nonce_len,
|
||||
pts_dh_group_t dh_groups);
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_dh_nonce_params_req_t object from received data
|
||||
*
|
||||
* @param value unparsed attribute value
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_dh_nonce_params_req_create_from_data(chunk_t value);
|
||||
|
||||
#endif /** TCG_PTS_ATTR_DH_NONCE_PARAMS_REQ_H_ @}*/
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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 "tcg_pts_attr_dh_nonce_params_resp.h"
|
||||
|
||||
#include <pa_tnc/pa_tnc_msg.h>
|
||||
#include <bio/bio_writer.h>
|
||||
#include <bio/bio_reader.h>
|
||||
#include <debug.h>
|
||||
|
||||
typedef struct private_tcg_pts_attr_dh_nonce_params_resp_t private_tcg_pts_attr_dh_nonce_params_resp_t;
|
||||
|
||||
/**
|
||||
* PTS DH Nonce Parameters Response
|
||||
* see section 3.8.2 of PTS Protocol: Binding to TNC IF-M Specification
|
||||
*
|
||||
* 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Reserved | Nonce Len |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Selected D-H Group | Hash Algorithm Set |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | D-H Responder Nonce ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | D-H Responder Public Value ... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*
|
||||
*/
|
||||
|
||||
#define PTS_DH_NONCE_PARAMS_RESP_SIZE 16
|
||||
#define PTS_DH_NONCE_PARAMS_RESP_RESERVED 0x0000
|
||||
|
||||
/**
|
||||
* Private data of an tcg_pts_attr_dh_nonce_params_resp_t object.
|
||||
*/
|
||||
struct private_tcg_pts_attr_dh_nonce_params_resp_t {
|
||||
|
||||
/**
|
||||
* Public members of tcg_pts_attr_dh_nonce_params_resp_t
|
||||
*/
|
||||
tcg_pts_attr_dh_nonce_params_resp_t public;
|
||||
|
||||
/**
|
||||
* Attribute vendor ID
|
||||
*/
|
||||
pen_t vendor_id;
|
||||
|
||||
/**
|
||||
* Attribute type
|
||||
*/
|
||||
u_int32_t type;
|
||||
|
||||
/**
|
||||
* Attribute value
|
||||
*/
|
||||
chunk_t value;
|
||||
|
||||
/**
|
||||
* Noskip flag
|
||||
*/
|
||||
bool noskip_flag;
|
||||
|
||||
/**
|
||||
* Length of nonce
|
||||
*/
|
||||
u_int8_t nonce_len;
|
||||
|
||||
/**
|
||||
* Selected Diffie Hellman group
|
||||
*/
|
||||
pts_dh_group_t dh_group;
|
||||
|
||||
/**
|
||||
* Supported Hashing Algorithms
|
||||
*/
|
||||
pts_meas_algorithms_t hash_algo_set;
|
||||
|
||||
/**
|
||||
* DH Responder Nonce
|
||||
*/
|
||||
chunk_t responder_nonce;
|
||||
|
||||
/**
|
||||
* DH Responder Public Value
|
||||
*/
|
||||
chunk_t responder_pub_val;
|
||||
|
||||
};
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->vendor_id;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->type;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_value, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, get_noskip_flag, bool,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->noskip_flag;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, set_noskip_flag,void,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this, bool noskip)
|
||||
{
|
||||
this->noskip_flag = noskip;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, build, void,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
bio_writer_t *writer;
|
||||
|
||||
writer = bio_writer_create(PTS_DH_NONCE_PARAMS_RESP_SIZE);
|
||||
writer->write_uint24(writer, PTS_DH_NONCE_PARAMS_RESP_RESERVED);
|
||||
writer->write_uint8 (writer, this->nonce_len);
|
||||
writer->write_uint16(writer, this->dh_group);
|
||||
writer->write_uint16(writer, this->hash_algo_set);
|
||||
writer->write_data (writer, this->responder_nonce);
|
||||
writer->write_data (writer, this->responder_pub_val);
|
||||
|
||||
this->value = chunk_clone(writer->get_buf(writer));
|
||||
writer->destroy(writer);
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, process, status_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this, u_int32_t *offset)
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
u_int32_t reserved;
|
||||
u_int16_t dh_group, hash_algo_set;
|
||||
|
||||
if (this->value.len < PTS_DH_NONCE_PARAMS_RESP_SIZE)
|
||||
{
|
||||
DBG1(DBG_TNC, "insufficient data for PTS DH Nonce Parameters Response");
|
||||
*offset = 0;
|
||||
return FAILED;
|
||||
}
|
||||
reader = bio_reader_create(this->value);
|
||||
reader->read_uint24(reader, &reserved);
|
||||
reader->read_uint8 (reader, &this->nonce_len);
|
||||
reader->read_uint16(reader, &dh_group);
|
||||
this->dh_group = dh_group;
|
||||
reader->read_uint16(reader, &hash_algo_set);
|
||||
this->hash_algo_set = hash_algo_set;
|
||||
reader->read_data(reader, this->nonce_len, &this->responder_nonce);
|
||||
reader->read_data(reader, reader->remaining(reader), &this->responder_pub_val);
|
||||
reader->destroy(reader);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, destroy, void,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
free(this->value.ptr);
|
||||
free(this->responder_nonce.ptr);
|
||||
free(this->responder_pub_val.ptr);
|
||||
free(this);
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_resp_t, get_nonce_len, u_int8_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->nonce_len;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_resp_t, get_dh_group, pts_dh_group_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->dh_group;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_resp_t, get_hash_algo_set, pts_meas_algorithms_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->hash_algo_set;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_resp_t, get_responder_nonce, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->responder_nonce;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_dh_nonce_params_resp_t, get_responder_pub_val, chunk_t,
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
|
||||
{
|
||||
return this->responder_pub_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create(u_int8_t nonce_len,
|
||||
pts_dh_group_t dh_group,
|
||||
pts_meas_algorithms_t hash_algo_set,
|
||||
chunk_t responder_nonce,
|
||||
chunk_t responder_pub_val)
|
||||
{
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
.set_noskip_flag = _set_noskip_flag,
|
||||
.build = _build,
|
||||
.process = _process,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_nonce_len = _get_nonce_len,
|
||||
.get_dh_group = _get_dh_group,
|
||||
.get_hash_algo_set = _get_hash_algo_set,
|
||||
.get_responder_nonce = _get_responder_nonce,
|
||||
.get_responder_pub_val = _get_responder_pub_val,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_DH_NONCE_PARAMS_RESP,
|
||||
.nonce_len = nonce_len,
|
||||
.dh_group = dh_group,
|
||||
.hash_algo_set = hash_algo_set,
|
||||
.responder_nonce = responder_nonce,
|
||||
.responder_pub_val = responder_pub_val,
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create_from_data(chunk_t value)
|
||||
{
|
||||
private_tcg_pts_attr_dh_nonce_params_resp_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
.get_vendor_id = _get_vendor_id,
|
||||
.get_type = _get_type,
|
||||
.get_value = _get_value,
|
||||
.get_noskip_flag = _get_noskip_flag,
|
||||
.set_noskip_flag = _set_noskip_flag,
|
||||
.build = _build,
|
||||
.process = _process,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_nonce_len = _get_nonce_len,
|
||||
.get_dh_group = _get_dh_group,
|
||||
.get_hash_algo_set = _get_hash_algo_set,
|
||||
.get_responder_nonce = _get_responder_nonce,
|
||||
.get_responder_pub_val = _get_responder_pub_val,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_DH_NONCE_PARAMS_RESP,
|
||||
.value = chunk_clone(value),
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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 tcg_pts_attr_dh_nonce_params_resp tcg_pts_attr_dh_nonce_params_resp
|
||||
* @{ @ingroup tcg_pts_attr_dh_nonce_params_resp
|
||||
*/
|
||||
|
||||
#ifndef TCG_PTS_ATTR_DH_NONCE_PARAMS_RESP_H_
|
||||
#define TCG_PTS_ATTR_DH_NONCE_PARAMS_RESP_H_
|
||||
|
||||
typedef struct tcg_pts_attr_dh_nonce_params_resp_t tcg_pts_attr_dh_nonce_params_resp_t;
|
||||
|
||||
#include "tcg_attr.h"
|
||||
#include "pa_tnc/pa_tnc_attr.h"
|
||||
#include "tcg_pts_attr_dh_nonce_params_req.h"
|
||||
#include "pts/pts_meas_algo.h"
|
||||
|
||||
/**
|
||||
* Class implementing the TCG PTS DH Nonce Parameters Response Attribute
|
||||
*/
|
||||
struct tcg_pts_attr_dh_nonce_params_resp_t {
|
||||
|
||||
/**
|
||||
* Public PA-TNC attribute interface
|
||||
*/
|
||||
pa_tnc_attr_t pa_tnc_attribute;
|
||||
|
||||
/**
|
||||
* Get nonce length
|
||||
*
|
||||
* @return Length of nonce
|
||||
*/
|
||||
u_int8_t (*get_nonce_len)(tcg_pts_attr_dh_nonce_params_resp_t *this);
|
||||
|
||||
/**
|
||||
* Get selected Diffie Hellman Group
|
||||
*
|
||||
* @return Selected Diffie Hellman Group
|
||||
*/
|
||||
pts_dh_group_t (*get_dh_group)(tcg_pts_attr_dh_nonce_params_resp_t *this);
|
||||
|
||||
/**
|
||||
* Get supported hash algorithms
|
||||
*
|
||||
* @return Hash algorithm set
|
||||
*/
|
||||
pts_meas_algorithms_t (*get_hash_algo_set)(tcg_pts_attr_dh_nonce_params_resp_t *this);
|
||||
|
||||
/**
|
||||
* Get DH Responder Nonce
|
||||
*
|
||||
* @return DH Responder Nonce
|
||||
*/
|
||||
chunk_t (*get_responder_nonce)(tcg_pts_attr_dh_nonce_params_resp_t *this);
|
||||
|
||||
/**
|
||||
* Get DH Responder Public Value
|
||||
*
|
||||
* @return DH Responder Public Value
|
||||
*/
|
||||
chunk_t (*get_responder_pub_val)(tcg_pts_attr_dh_nonce_params_resp_t *this);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_dh_nonce_params_resp_t object
|
||||
*
|
||||
* @param nonce_len Length of nonce
|
||||
* @param dh_group Selected DH group
|
||||
* @param hash_algo_set Set of supported hash algorithms
|
||||
* @param responder_nonce DH Responder Nonce
|
||||
* @param responder_pub_val DH Responder Public value
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_dh_nonce_params_resp_create(u_int8_t nonce_len,
|
||||
pts_dh_group_t dh_group,
|
||||
pts_meas_algorithms_t hash_algo_set,
|
||||
chunk_t responder_nonce,
|
||||
chunk_t responder_pub_val);
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_dh_nonce_params_resp_t object from received data
|
||||
*
|
||||
* @param value unparsed attribute value
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_dh_nonce_params_resp_create_from_data(chunk_t value);
|
||||
|
||||
#endif /** TCG_PTS_ATTR_DH_NONCE_PARAMS_RESP_H_ @}*/
|
||||
Reference in New Issue
Block a user