Annotation of embedaddon/strongswan/src/libimcv/pts/pts_error.c, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2011 Sansar Choinyambuu
        !             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: #include "pts_error.h"
        !            17: 
        !            18: #include <bio/bio_writer.h>
        !            19: #include <ietf/ietf_attr_pa_tnc_error.h>
        !            20: 
        !            21: ENUM(pts_error_code_names, TCG_PTS_RESERVED_ERROR, TCG_PTS_UNABLE_DET_PCR,
        !            22:        "Reserved Error",
        !            23:        "Hash Algorithm Not Supported",
        !            24:        "Invalid Path",
        !            25:        "File Not Found",
        !            26:        "Registry Not Supported",
        !            27:        "Registry Key Not Found",
        !            28:        "D-H Group Not Supported",
        !            29:        "DH-PN Nonce Not Acceptable",
        !            30:        "Invalid Functional Name Family",
        !            31:        "TPM Version Information Unavailable",
        !            32:        "Invalid File Pathname Delimiter",
        !            33:        "PTS Operation Not Supported",
        !            34:        "Unable To Update Reference Manifest",
        !            35:        "Unable To Perform Local Validation",
        !            36:        "Unable To Collect Current Evidence",
        !            37:        "Unable To Determine Transitive Trust Chain",
        !            38:        "Unable To Determine PCR"
        !            39: );
        !            40: 
        !            41: /**
        !            42:  * Described in header.
        !            43:  */
        !            44: pa_tnc_attr_t* pts_hash_alg_error_create(pts_meas_algorithms_t algorithms)
        !            45: {
        !            46:        bio_writer_t *writer;
        !            47:        chunk_t msg_info;
        !            48:        pa_tnc_attr_t *attr;
        !            49:        pen_type_t error_code = { PEN_TCG, TCG_PTS_HASH_ALG_NOT_SUPPORTED };
        !            50: 
        !            51:        writer = bio_writer_create(4);
        !            52:        writer->write_uint16(writer, 0x0000);
        !            53:        writer->write_uint16(writer, algorithms);
        !            54:        msg_info = writer->get_buf(writer);
        !            55:        attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
        !            56:        writer->destroy(writer);
        !            57: 
        !            58:        return attr;
        !            59: }
        !            60: 
        !            61: /**
        !            62:  * Described in header.
        !            63:  */
        !            64: pa_tnc_attr_t* pts_dh_group_error_create(pts_dh_group_t dh_groups)
        !            65: {
        !            66:        bio_writer_t *writer;
        !            67:        chunk_t msg_info;
        !            68:        pa_tnc_attr_t *attr;
        !            69:        pen_type_t error_code = { PEN_TCG, TCG_PTS_DH_GRPS_NOT_SUPPORTED };
        !            70: 
        !            71:        writer = bio_writer_create(4);
        !            72:        writer->write_uint16(writer, 0x0000);
        !            73:        writer->write_uint16(writer, dh_groups);
        !            74:        msg_info = writer->get_buf(writer);
        !            75:        attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
        !            76:        writer->destroy(writer);
        !            77: 
        !            78:        return attr;
        !            79: }
        !            80: 
        !            81: /**
        !            82:  * Described in header.
        !            83:  */
        !            84: pa_tnc_attr_t* pts_dh_nonce_error_create(int min_nonce_len, int max_nonce_len)
        !            85: {
        !            86:        bio_writer_t *writer;
        !            87:        chunk_t msg_info;
        !            88:        pa_tnc_attr_t *attr;
        !            89:        pen_type_t error_code = { PEN_TCG, TCG_PTS_BAD_NONCE_LENGTH };
        !            90: 
        !            91:        writer = bio_writer_create(4);
        !            92:        writer->write_uint16(writer, min_nonce_len);
        !            93:        writer->write_uint16(writer, max_nonce_len);
        !            94:        msg_info = writer->get_buf(writer);
        !            95:        attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
        !            96:        writer->destroy(writer);
        !            97: 
        !            98:        return attr;
        !            99: }

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