Annotation of embedaddon/strongswan/src/libimcv/pts/pts_meas_algo.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2011 Sansar Choinyambuu
        !             3:  * Copyright (C) 2011-2014 Andreas Steffen
        !             4:  * HSR Hochschule fuer Technik Rapperswil
        !             5:  *
        !             6:  * This program is free software; you can redistribute it and/or modify it
        !             7:  * under the terms of the GNU General Public License as published by the
        !             8:  * Free Software Foundation; either version 2 of the License, or (at your
        !             9:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
        !            10:  *
        !            11:  * This program is distributed in the hope that it will be useful, but
        !            12:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
        !            13:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        !            14:  * for more details.
        !            15:  */
        !            16: 
        !            17: /**
        !            18:  * @defgroup pts_meas_algo pts_meas_algo
        !            19:  * @{ @ingroup pts
        !            20:  */
        !            21: 
        !            22: #ifndef PTS_MEAS_ALGO_H_
        !            23: #define PTS_MEAS_ALGO_H_
        !            24: 
        !            25: #include <library.h>
        !            26: #include <crypto/hashers/hasher.h>
        !            27: 
        !            28: typedef enum pts_meas_algorithms_t pts_meas_algorithms_t;
        !            29: 
        !            30: /**
        !            31:  * PTS Measurement Algorithms
        !            32:  */
        !            33: enum pts_meas_algorithms_t {
        !            34:        PTS_MEAS_ALGO_NONE     =      0,
        !            35:        PTS_MEAS_ALGO_SHA384   = (1<<13),
        !            36:        PTS_MEAS_ALGO_SHA256   = (1<<14),
        !            37:        PTS_MEAS_ALGO_SHA1     = (1<<15)
        !            38: };
        !            39: 
        !            40: /**
        !            41:  * enum name for pts_meas_algorithms_t.
        !            42:  */
        !            43: extern enum_name_t *pts_meas_algorithm_names;
        !            44: 
        !            45: /**
        !            46:  * Diffie-Hellman Hash Algorithm Values
        !            47:  * see section 3.8.5 of PTS Protocol: Binding to TNC IF-M Specification
        !            48:  *
        !            49:  *                                        1
        !            50:  *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
        !            51:  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        !            52:  *  |1|2|3|R|R|R|R|R|R|R|R|R|R|R|R|R|
        !            53:  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        !            54:  *
        !            55:  */
        !            56: 
        !            57: /**
        !            58:  * Probe available PTS measurement algorithms
        !            59:  *
        !            60:  * @param algorithms   set of available algorithms
        !            61:  * @return                             TRUE if mandatory algorithms are available
        !            62:  */
        !            63: bool pts_meas_algo_probe(pts_meas_algorithms_t *algorithms);
        !            64: 
        !            65: /**
        !            66:  * Update supported PTS measurement algorithms according to configuration
        !            67:  *
        !            68:  * sha1 :  PTS_MEAS_ALGO_SHA1
        !            69:  * sha256: PTS_MEAS_ALGO_SHA1 | PTS_MEAS_ALGO_SHA256
        !            70:  * sha384: PTS_MEAS_ALGO_SHA1 | PTS_MEAS_ALGO_SHA256 | PTS_MEAS_ALGO_SHA384
        !            71:  *
        !            72:  * The PTS-IMC is expected to select the strongest supported algorithm
        !            73:  *
        !            74:  * @param hash_alg             configured hash algorithm
        !            75:  * @param algorithms   returns set of available PTS measurement algorithms
        !            76:  */
        !            77: bool pts_meas_algo_update(char *hash_alg, pts_meas_algorithms_t *algorithms);
        !            78: 
        !            79: /**
        !            80:  * Select the strongest PTS measurement algorithm
        !            81:  * among a set of offered PTS measurement algorithms
        !            82:  *
        !            83:  * @param supported_algos      set of supported PTS measurement algorithms
        !            84:  * @param offered_algos                set of offered PTS measurements algorithms
        !            85:  * @return                                     selected algorithm
        !            86:  */
        !            87: pts_meas_algorithms_t pts_meas_algo_select(pts_meas_algorithms_t supported_algos,
        !            88:                                                                                   pts_meas_algorithms_t offered_algos);
        !            89: 
        !            90: /**
        !            91:  * Convert pts_meas_algorithms_t to hash_algorithm_t
        !            92:  *
        !            93:  * @param algorithm            PTS measurement algorithm type
        !            94:  * @return                             libstrongswan hash algorithm type
        !            95:  */
        !            96: hash_algorithm_t pts_meas_algo_to_hash(pts_meas_algorithms_t algorithm);
        !            97: 
        !            98: /**
        !            99:  * Convert hash_algorithm_t to pts_meas_algorithms_t
        !           100:  *
        !           101:  * @param algorithm            PTS measurement algorithm type
        !           102:  * @return                             libstrongswan hash algorithm type
        !           103:  */
        !           104: pts_meas_algorithms_t pts_meas_algo_from_hash(hash_algorithm_t algorithm);
        !           105: 
        !           106: /**
        !           107:  * Return the hash size of a pts_meas_algorithm
        !           108:  *
        !           109:  * @param algorithm            PTS measurement algorithm type
        !           110:  * @return                             hash size in bytes
        !           111:  */
        !           112: size_t pts_meas_algo_hash_size(pts_meas_algorithms_t algorithm);
        !           113: 
        !           114: #endif /** PTS_MEAS_ALGO_H_ @}*/

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