added pts_dh_group_error_create() and pts_dh_nonce_error_create()

This commit is contained in:
Andreas Steffen
2011-11-28 14:39:50 +01:00
parent d7bc2841ca
commit dc5995fb51
4 changed files with 80 additions and 23 deletions
+41 -1
View File
@@ -56,4 +56,44 @@ pa_tnc_attr_t* pts_hash_alg_error_create(pts_meas_algorithms_t algorithms)
writer->destroy(writer);
return attr;
}
}
/**
* Described in header.
*/
pa_tnc_attr_t* pts_dh_group_error_create(pts_dh_group_t dh_groups)
{
bio_writer_t *writer;
chunk_t msg_info;
pa_tnc_attr_t *attr;
writer = bio_writer_create(4);
writer->write_uint16(writer, 0x0000);
writer->write_uint16(writer, dh_groups);
msg_info = writer->get_buf(writer);
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_DH_GRPS_NOT_SUPPORTED,
msg_info);
writer->destroy(writer);
return attr;
}
/**
* Described in header.
*/
pa_tnc_attr_t* pts_dh_nonce_error_create(int min_nonce_len, int max_nonce_len)
{
bio_writer_t *writer;
chunk_t msg_info;
pa_tnc_attr_t *attr;
writer = bio_writer_create(4);
writer->write_uint16(writer, min_nonce_len);
writer->write_uint16(writer, max_nonce_len);
msg_info = writer->get_buf(writer);
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_BAD_NONCE_LENGTH,
msg_info);
writer->destroy(writer);
return attr;
}
+22 -1
View File
@@ -24,10 +24,14 @@
typedef enum pts_error_code_t pts_error_code_t;
#include "pts_meas_algo.h"
#include "pts_dh_group.h"
#include "pa_tnc/pa_tnc_attr.h"
#include <library.h>
#define PTS_MIN_NONCE_LEN 17
#define PTS_MAX_NONCE_LEN 0xffff
/**
* PTS Attestation Error Codes
* see section 3.14.2 of PTS Protocol: Binding to TNC IF-M Specification
@@ -61,8 +65,25 @@ extern enum_name_t *pts_error_code_names;
* Creates a PTS Hash Algorithm Not Supported Error Attribute
* see section 4.2.2 of PTS Protocol: Binding to TNC IF-M Specification
*
* @param algorithms supported measurement hash algorithms
* @param algorithms supported measurement hash algorithms
*/
pa_tnc_attr_t* pts_hash_alg_error_create(pts_meas_algorithms_t algorithms);
/**
* Creates a PTS DH Group Not Supported Error Attribute
* see section 4.2.4 of PTS Protocol: Binding to TNC IF-M Specification
*
* @param dh_groups supported DH groups
*/
pa_tnc_attr_t* pts_dh_group_error_create(pts_dh_group_t dh_groups);
/**
* Creates a PTS DH PN Nonce Not Supported Error Attribute
* see section 4.2.5 of PTS Protocol: Binding to TNC IF-M Specification
*
* @param min_nonce_len minimum nonce length
* @param max_nonce_len maximum nonce length
*/
pa_tnc_attr_t* pts_dh_nonce_error_create(int min_nonce_len, int max_nonce_len);
#endif /** PTS_ERROR_H_ @}*/