Annotation of embedaddon/strongswan/src/libtls/tls_prf.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2010 Martin Willi
        !             3:  * Copyright (C) 2010 revosec AG
        !             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: /**
        !            17:  * @defgroup tls_prf tls_prf
        !            18:  * @{ @ingroup libtls
        !            19:  */
        !            20: 
        !            21: #ifndef TLS_PRF_H_
        !            22: #define TLS_PRF_H_
        !            23: 
        !            24: typedef struct tls_prf_t tls_prf_t;
        !            25: 
        !            26: #include <crypto/prfs/prf.h>
        !            27: 
        !            28: /**
        !            29:  * The PRF function specified on TLS, based on HMAC.
        !            30:  */
        !            31: struct tls_prf_t {
        !            32: 
        !            33:        /**
        !            34:         * Set the key of the PRF function.
        !            35:         *
        !            36:         * @param key           key to set
        !            37:         * @return                      TRUE if key set successfully
        !            38:         */
        !            39:        bool (*set_key)(tls_prf_t *this, chunk_t key);
        !            40: 
        !            41:        /**
        !            42:         * Generate a series of bytes using a label and a seed.
        !            43:         *
        !            44:         * @param label         ASCII input label
        !            45:         * @param seed          seed input value
        !            46:         * @param bytes         number of bytes to get
        !            47:         * @param out           buffer receiving bytes
        !            48:         * @return                      TRUE if bytes generated successfully
        !            49:         */
        !            50:        bool (*get_bytes)(tls_prf_t *this, char *label, chunk_t seed,
        !            51:                                          size_t bytes, char *out);
        !            52: 
        !            53:        /**
        !            54:         * Destroy a tls_prf_t.
        !            55:         */
        !            56:        void (*destroy)(tls_prf_t *this);
        !            57: };
        !            58: 
        !            59: /**
        !            60:  * Create a tls_prf instance with specific algorithm as in TLS 1.2.
        !            61:  *
        !            62:  * @param prf                  underlying PRF function to use
        !            63:  * @return                             TLS PRF algorithm
        !            64:  */
        !            65: tls_prf_t *tls_prf_create_12(pseudo_random_function_t prf);
        !            66: 
        !            67: /**
        !            68:  * Create a tls_prf instance with XOred SHA1/MD5 as in TLS 1.0/1.1.
        !            69:  *
        !            70:  * @return                             TLS PRF algorithm
        !            71:  */
        !            72: tls_prf_t *tls_prf_create_10();
        !            73: 
        !            74: #endif /** TLS_PRF_H_ @}*/

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