Annotation of embedaddon/strongswan/src/libcharon/plugins/eap_aka/eap_aka_plugin.c, 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: #include "eap_aka_plugin.h"
        !            17: 
        !            18: #include "eap_aka_peer.h"
        !            19: #include "eap_aka_server.h"
        !            20: 
        !            21: #include <daemon.h>
        !            22: #include <simaka_manager.h>
        !            23: 
        !            24: typedef struct private_eap_aka_plugin_t private_eap_aka_plugin_t;
        !            25: 
        !            26: /**
        !            27:  * Private data of an eap_sim_plugin_t object.
        !            28:  */
        !            29: struct private_eap_aka_plugin_t {
        !            30: 
        !            31:        /**
        !            32:         * Public interface.
        !            33:         */
        !            34:        eap_aka_plugin_t public;
        !            35: 
        !            36:        /**
        !            37:         * EAP-AKA backend manager
        !            38:         */
        !            39:        simaka_manager_t *mgr;
        !            40: };
        !            41: 
        !            42: METHOD(plugin_t, get_name, char*,
        !            43:        private_eap_aka_plugin_t *this)
        !            44: {
        !            45:        return "eap-aka";
        !            46: }
        !            47: 
        !            48: METHOD(plugin_t, get_features, int,
        !            49:        private_eap_aka_plugin_t *this, plugin_feature_t *features[])
        !            50: {
        !            51:        static plugin_feature_t f[] = {
        !            52:                PLUGIN_PROVIDE(CUSTOM, "aka-manager"),
        !            53:                PLUGIN_CALLBACK(eap_method_register, eap_aka_server_create),
        !            54:                        PLUGIN_PROVIDE(EAP_SERVER, EAP_AKA),
        !            55:                                PLUGIN_DEPENDS(RNG, RNG_WEAK),
        !            56:                                PLUGIN_DEPENDS(HASHER, HASH_SHA1),
        !            57:                                PLUGIN_DEPENDS(PRF, PRF_FIPS_SHA1_160),
        !            58:                                PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA1_128),
        !            59:                                PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 16),
        !            60:                PLUGIN_CALLBACK(eap_method_register, eap_aka_peer_create),
        !            61:                        PLUGIN_PROVIDE(EAP_PEER, EAP_AKA),
        !            62:                                PLUGIN_DEPENDS(RNG, RNG_WEAK),
        !            63:                                PLUGIN_DEPENDS(HASHER, HASH_SHA1),
        !            64:                                PLUGIN_DEPENDS(PRF, PRF_FIPS_SHA1_160),
        !            65:                                PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA1_128),
        !            66:                                PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 16),
        !            67:        };
        !            68:        *features = f;
        !            69:        return countof(f);
        !            70: }
        !            71: 
        !            72: METHOD(plugin_t, destroy, void,
        !            73:        private_eap_aka_plugin_t *this)
        !            74: {
        !            75:        lib->set(lib, "aka-manager", NULL);
        !            76:        this->mgr->destroy(this->mgr);
        !            77:        free(this);
        !            78: }
        !            79: 
        !            80: /*
        !            81:  * see header file
        !            82:  */
        !            83: plugin_t *eap_aka_plugin_create()
        !            84: {
        !            85:        private_eap_aka_plugin_t *this;
        !            86: 
        !            87:        INIT(this,
        !            88:                .public = {
        !            89:                        .plugin = {
        !            90:                                .get_name = _get_name,
        !            91:                                .get_features = _get_features,
        !            92:                                .destroy = _destroy,
        !            93:                        },
        !            94:                },
        !            95:                .mgr = simaka_manager_create(),
        !            96:        );
        !            97:        lib->set(lib, "aka-manager", this->mgr);
        !            98: 
        !            99:        return &this->public.plugin;
        !           100: }

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