added pts_dh_group_error_create() and pts_dh_nonce_error_create()
[strongswan.git] / src / libpts / pts / pts_error.c
index ec1e6c0..6e914b2 100644 (file)
@@ -56,4 +56,44 @@ pa_tnc_attr_t* pts_hash_alg_error_create(pts_meas_algorithms_t algorithms)
        writer->destroy(writer);
 
        return attr;
-}
\ No newline at end of file
+}
+
+/**
+ * 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;
+}