Annotation of embedaddon/strongswan/src/libcharon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_functions.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2008-2009 Martin Willi
        !             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: /**
        !            17:  * @defgroup eap_aka_3gpp2_functions eap_aka_3gpp2_functions
        !            18:  * @{ @ingroup eap_aka_3gpp2
        !            19:  */
        !            20: 
        !            21: #ifndef EAP_AKA_3GPP2_FUNCTIONS_H_
        !            22: #define EAP_AKA_3GPP2_FUNCTIONS_H_
        !            23: 
        !            24: #include <simaka_manager.h>
        !            25: 
        !            26: #define AKA_SQN_LEN             6
        !            27: #define AKA_K_LEN              16
        !            28: #define AKA_MAC_LEN     8
        !            29: #define AKA_AK_LEN              6
        !            30: #define AKA_AMF_LEN             2
        !            31: #define AKA_FMK_LEN             4
        !            32: 
        !            33: typedef struct eap_aka_3gpp2_functions_t eap_aka_3gpp2_functions_t;
        !            34: 
        !            35: /**
        !            36:  * f1-f5(), f1*() and f5*() functions from the 3GPP2 (S.S0055) standard.
        !            37:  */
        !            38: struct eap_aka_3gpp2_functions_t {
        !            39: 
        !            40:        /**
        !            41:         * Calculate MAC from RAND, SQN, AMF using K.
        !            42:         *
        !            43:         * @param k             secret key K
        !            44:         * @param rand  random value rand
        !            45:         * @param sqn   sequence number
        !            46:         * @param amf   authentication management field
        !            47:         * @param mac   buffer receiving mac MAC
        !            48:         * @return              TRUE if calculations successful
        !            49:         */
        !            50:        bool (*f1)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !            51:                                u_char rand[AKA_RAND_LEN], u_char sqn[AKA_SQN_LEN],
        !            52:                                u_char amf[AKA_AMF_LEN], u_char mac[AKA_MAC_LEN]);
        !            53: 
        !            54:        /**
        !            55:         * Calculate MACS from RAND, SQN, AMF using K
        !            56:         *
        !            57:         * @param k             secret key K
        !            58:         * @param rand  random value RAND
        !            59:         * @param sqn   sequence number
        !            60:         * @param amf   authentication management field
        !            61:         * @param macs  buffer receiving resynchronization mac MACS
        !            62:         * @return              TRUE if calculations successful
        !            63:         */
        !            64:        bool (*f1star)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !            65:                                u_char rand[AKA_RAND_LEN], u_char sqn[AKA_SQN_LEN],
        !            66:                                u_char amf[AKA_AMF_LEN], u_char macs[AKA_MAC_LEN]);
        !            67: 
        !            68:        /**
        !            69:         * Calculate RES from RAND using K
        !            70:         *
        !            71:         * @param k             secret key K
        !            72:         * @param rand  random value RAND
        !            73:         * @param res   buffer receiving result RES, uses full 128 bit
        !            74:         * @return              TRUE if calculations successful
        !            75:         */
        !            76:        bool (*f2)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !            77:                                u_char rand[AKA_RAND_LEN], u_char res[AKA_RES_MAX]);
        !            78:        /**
        !            79:         * Calculate CK from RAND using K
        !            80:         *
        !            81:         * @param k             secret key K
        !            82:         * @param rand  random value RAND
        !            83:         * @param macs  buffer receiving encryption key CK
        !            84:         * @return              TRUE if calculations successful
        !            85:         */
        !            86:        bool (*f3)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !            87:                                u_char rand[AKA_RAND_LEN], u_char ck[AKA_CK_LEN]);
        !            88:        /**
        !            89:         * Calculate IK from RAND using K
        !            90:         *
        !            91:         * @param k             secret key K
        !            92:         * @param rand  random value RAND
        !            93:         * @param macs  buffer receiving integrity key IK
        !            94:         * @return              TRUE if calculations successful
        !            95:         */
        !            96:        bool (*f4)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !            97:                                u_char rand[AKA_RAND_LEN], u_char ik[AKA_IK_LEN]);
        !            98:        /**
        !            99:         * Calculate AK from a RAND using K
        !           100:         *
        !           101:         * @param k             secret key K
        !           102:         * @param rand  random value RAND
        !           103:         * @param macs  buffer receiving anonymity key AK
        !           104:         * @return              TRUE if calculations successful
        !           105:         */
        !           106:        bool (*f5)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !           107:                                u_char rand[AKA_RAND_LEN], u_char ak[AKA_AK_LEN]);
        !           108:        /**
        !           109:         * Calculate AKS from a RAND using K
        !           110:         *
        !           111:         * @param k             secret key K
        !           112:         * @param rand  random value RAND
        !           113:         * @param macs  buffer receiving resynchronization anonymity key AKS
        !           114:         * @return              TRUE if calculations successful
        !           115:         */
        !           116:        bool (*f5star)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
        !           117:                                u_char rand[AKA_RAND_LEN], u_char aks[AKA_AK_LEN]);
        !           118: 
        !           119:        /**
        !           120:         * Destroy a eap_aka_3gpp2_functions_t.
        !           121:         */
        !           122:        void (*destroy)(eap_aka_3gpp2_functions_t *this);
        !           123: };
        !           124: 
        !           125: /**
        !           126:  * Create a eap_aka_3gpp2_functions instance.
        !           127:  *
        !           128:  * @return                     function set, NULL on error
        !           129:  */
        !           130: eap_aka_3gpp2_functions_t *eap_aka_3gpp2_functions_create();
        !           131: 
        !           132: #endif /** EAP_AKA_3GPP2_FUNCTIONS_H_ @}*/

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