merged the modularization branch (credentials) back to trunk
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file authenticator.c
|
||||
*
|
||||
* @brief Generic constructor for authenticators.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,6 +11,8 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file authenticator.h
|
||||
*
|
||||
* @brief Interface of authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005-2006 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
@@ -19,6 +12,13 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup authenticator authenticator
|
||||
* @{ @ingroup authenticators
|
||||
*/
|
||||
|
||||
#ifndef AUTHENTICATOR_H_
|
||||
@@ -33,8 +33,6 @@ typedef struct authenticator_t authenticator_t;
|
||||
|
||||
/**
|
||||
* Method to use for authentication.
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
enum auth_method_t {
|
||||
/**
|
||||
@@ -65,29 +63,21 @@ enum auth_method_t {
|
||||
|
||||
/**
|
||||
* enum names for auth_method_t.
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
extern enum_name_t *auth_method_names;
|
||||
|
||||
/**
|
||||
* @brief Authenticator interface implemented by the various authenticators.
|
||||
* Authenticator interface implemented by the various authenticators.
|
||||
*
|
||||
* Currently the following two AUTH methods are supported:
|
||||
* - shared key message integrity code (AUTH_PSK)
|
||||
* - RSA digital signature (AUTH_RSA)
|
||||
*
|
||||
* @b Constructors:
|
||||
* - authenticator_create()
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
struct authenticator_t {
|
||||
|
||||
/**
|
||||
* @brief Verify a received authentication payload.
|
||||
* Verify a received authentication payload.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param ike_sa_init binary representation of received ike_sa_init
|
||||
* @param my_nonce the sent nonce
|
||||
* @param auth_payload authentication payload to verify
|
||||
@@ -102,9 +92,8 @@ struct authenticator_t {
|
||||
chunk_t my_nonce, auth_payload_t *auth_payload);
|
||||
|
||||
/**
|
||||
* @brief Build an authentication payload to send to the other peer.
|
||||
* Build an authentication payload to send to the other peer.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param ike_sa_init binary representation of sent ike_sa_init
|
||||
* @param other_nonce the received nonce
|
||||
* @param[out] auth_payload the resulting authentication payload
|
||||
@@ -117,23 +106,19 @@ struct authenticator_t {
|
||||
chunk_t other_nonce, auth_payload_t **auth_payload);
|
||||
|
||||
/**
|
||||
* @brief Destroys a authenticator_t object.
|
||||
*
|
||||
* @param this calling object
|
||||
* Destroys a authenticator_t object.
|
||||
*/
|
||||
void (*destroy) (authenticator_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates an authenticator for the specified auth method.
|
||||
* Creates an authenticator for the specified auth method.
|
||||
*
|
||||
* @param ike_sa associated ike_sa
|
||||
* @param auth_method authentication method to use for build()/verify()
|
||||
*
|
||||
* @return authenticator_t object
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
authenticator_t *authenticator_create(ike_sa_t *ike_sa, auth_method_t auth_method);
|
||||
|
||||
#endif /* AUTHENTICATOR_H_ */
|
||||
#endif /* AUTHENTICATOR_H_ @} */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,141 +0,0 @@
|
||||
/**
|
||||
* @file eap_aka.h
|
||||
*
|
||||
* @brief Interface of eap_aka_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_AKA_H_
|
||||
#define EAP_AKA_H_
|
||||
|
||||
typedef struct eap_aka_t eap_aka_t;
|
||||
typedef enum aka_subtype_t aka_subtype_t;
|
||||
typedef enum aka_attribute_t aka_attribute_t;
|
||||
|
||||
#include <sa/authenticators/eap/eap_method.h>
|
||||
|
||||
|
||||
/**
|
||||
* Subtypes of AKA messages
|
||||
*/
|
||||
enum aka_subtype_t {
|
||||
AKA_CHALLENGE = 1,
|
||||
AKA_AUTHENTICATION_REJECT = 2,
|
||||
AKA_SYNCHRONIZATION_FAILURE = 4,
|
||||
AKA_IDENTITY = 5,
|
||||
AKA_NOTIFICATION = 12,
|
||||
AKA_REAUTHENTICATION = 13,
|
||||
AKA_CLIENT_ERROR = 14,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum names for aka_subtype_t
|
||||
*/
|
||||
extern enum_name_t *aka_subtype_names;
|
||||
|
||||
/**
|
||||
* Attribute types in AKA messages
|
||||
*/
|
||||
enum aka_attribute_t {
|
||||
/** defines the end of attribute list */
|
||||
AT_END = -1,
|
||||
AT_RAND = 1,
|
||||
AT_AUTN = 2,
|
||||
AT_RES = 3,
|
||||
AT_AUTS = 4,
|
||||
AT_PADDING = 6,
|
||||
AT_NONCE_MT = 7,
|
||||
AT_PERMANENT_ID_REQ = 10,
|
||||
AT_MAC = 11,
|
||||
AT_NOTIFICATION = 12,
|
||||
AT_ANY_ID_REQ = 13,
|
||||
AT_IDENTITY = 14,
|
||||
AT_VERSION_LIST = 15,
|
||||
AT_SELECTED_VERSION = 16,
|
||||
AT_FULLAUTH_ID_REQ = 17,
|
||||
AT_COUNTER = 19,
|
||||
AT_COUNTER_TOO_SMALL = 20,
|
||||
AT_NONCE_S = 21,
|
||||
AT_CLIENT_ERROR_CODE = 22,
|
||||
AT_IV = 129,
|
||||
AT_ENCR_DATA = 130,
|
||||
AT_NEXT_PSEUDONYM = 132,
|
||||
AT_NEXT_REAUTH_ID = 133,
|
||||
AT_CHECKCODE = 134,
|
||||
AT_RESULT_IND = 135,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum names for aka_attribute_t
|
||||
*/
|
||||
extern enum_name_t *aka_attribute_names;
|
||||
|
||||
/** check SEQ values as client for validity, disabled by default */
|
||||
#ifndef SEQ_CHECK
|
||||
# define SEQ_CHECK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Implementation of the eap_method_t interface using EAP-AKA.
|
||||
*
|
||||
* EAP-AKA uses 3rd generation mobile phone standard authentication
|
||||
* mechanism for authentication. It is a mutual authentication
|
||||
* mechanism which establishs a shared key and therefore supports EAP_ONLY
|
||||
* authentication. This implementation follows the standard of the
|
||||
* 3GPP2 (S.S0055) and not the one of 3GGP.
|
||||
* The shared key used for authentication is from ipsec.secrets. The
|
||||
* peers ID is used to query it.
|
||||
* The AKA mechanism uses sequence numbers to detect replay attacks. The
|
||||
* peer stores the sequence number normally in a USIM and accepts
|
||||
* incremental sequence numbers (incremental for lifetime of the USIM). To
|
||||
* prevent a complex sequence number management, this implementation uses
|
||||
* a sequence number derived from time. It is initialized to the startup
|
||||
* time of the daemon. As long as the (UTC) time of the system is not
|
||||
* turned back while the daemon is not running, this method is secure.
|
||||
* To enable time based SEQs, #define SEQ_CHECK as 1. Default is to accept
|
||||
* any SEQ numbers. This allows an attacker to do replay attacks. But since
|
||||
* the server has proven his identity via IKE, such an attack is only
|
||||
* possible between server and AAA (if any).
|
||||
*
|
||||
* @b Constructors:
|
||||
* - eap_aka_create()
|
||||
* - eap_client_create() using eap_method EAP_AKA
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
struct eap_aka_t {
|
||||
|
||||
/**
|
||||
* Implemented eap_method_t interface.
|
||||
*/
|
||||
eap_method_t eap_method_interface;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates the EAP method EAP-AKA.
|
||||
*
|
||||
* @param server ID of the EAP server
|
||||
* @param peer ID of the EAP client
|
||||
* @return eap_aka_t object
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
eap_aka_t *eap_create(eap_role_t role,
|
||||
identification_t *server, identification_t *peer);
|
||||
|
||||
#endif /* EAP_AKA_H_ */
|
||||
@@ -1,135 +0,0 @@
|
||||
/**
|
||||
* @file eap_identity.c
|
||||
*
|
||||
* @brief Implementation of eap_identity_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "eap_identity.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <library.h>
|
||||
|
||||
typedef struct private_eap_identity_t private_eap_identity_t;
|
||||
|
||||
/**
|
||||
* Private data of an eap_identity_t object.
|
||||
*/
|
||||
struct private_eap_identity_t {
|
||||
|
||||
/**
|
||||
* Public authenticator_t interface.
|
||||
*/
|
||||
eap_identity_t public;
|
||||
|
||||
/**
|
||||
* ID of the peer
|
||||
*/
|
||||
identification_t *peer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.process for the peer
|
||||
*/
|
||||
static status_t process(private_eap_identity_t *this,
|
||||
eap_payload_t *in, eap_payload_t **out)
|
||||
{
|
||||
chunk_t id, hdr;
|
||||
|
||||
hdr = chunk_alloca(5);
|
||||
id = this->peer->get_encoding(this->peer);
|
||||
|
||||
*(hdr.ptr + 0) = EAP_RESPONSE;
|
||||
*(hdr.ptr + 1) = in->get_identifier(in);
|
||||
*(u_int16_t*)(hdr.ptr + 2) = htons(hdr.len + id.len);
|
||||
*(hdr.ptr + 4) = EAP_IDENTITY;
|
||||
|
||||
*out = eap_payload_create_data(chunk_cata("cc", hdr, id));
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.initiate for the peer
|
||||
*/
|
||||
static status_t initiate(private_eap_identity_t *this, eap_payload_t **out)
|
||||
{
|
||||
/* peer never initiates */
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.get_type.
|
||||
*/
|
||||
static eap_type_t get_type(private_eap_identity_t *this)
|
||||
{
|
||||
return EAP_IDENTITY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.get_msk.
|
||||
*/
|
||||
static status_t get_msk(private_eap_identity_t *this, chunk_t *msk)
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.is_mutual.
|
||||
*/
|
||||
static bool is_mutual(private_eap_identity_t *this)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.destroy.
|
||||
*/
|
||||
static void destroy(private_eap_identity_t *this)
|
||||
{
|
||||
free(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
eap_identity_t *eap_create(eap_role_t role,
|
||||
identification_t *server, identification_t *peer)
|
||||
{
|
||||
private_eap_identity_t *this;
|
||||
|
||||
if (role != EAP_PEER)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
this = malloc_thing(private_eap_identity_t);
|
||||
|
||||
/* public functions */
|
||||
this->public.eap_method_interface.initiate = (status_t(*)(eap_method_t*,eap_payload_t**))initiate;
|
||||
this->public.eap_method_interface.process = (status_t(*)(eap_method_t*,eap_payload_t*,eap_payload_t**))process;
|
||||
this->public.eap_method_interface.get_type = (eap_type_t(*)(eap_method_t*))get_type;
|
||||
this->public.eap_method_interface.is_mutual = (bool(*)(eap_method_t*))is_mutual;
|
||||
this->public.eap_method_interface.get_msk = (status_t(*)(eap_method_t*,chunk_t*))get_msk;
|
||||
this->public.eap_method_interface.destroy = (void(*)(eap_method_t*))destroy;
|
||||
|
||||
/* private data */
|
||||
this->peer = peer;
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* @file eap_identity.h
|
||||
*
|
||||
* @brief Interface of eap_identity_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_IDENTITY_H_
|
||||
#define EAP_IDENTITY_H_
|
||||
|
||||
typedef struct eap_identity_t eap_identity_t;
|
||||
|
||||
#include <sa/authenticators/eap/eap_method.h>
|
||||
|
||||
/**
|
||||
* @brief Implementation of the eap_method_t interface using EAP Identity.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - eap_identity_create()
|
||||
* - eap_client_create() using eap_method EAP_IDENTITY
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
struct eap_identity_t {
|
||||
|
||||
/**
|
||||
* Implemented eap_method_t interface.
|
||||
*/
|
||||
eap_method_t eap_method_interface;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates the EAP method EAP Identity.
|
||||
*
|
||||
* @param server ID of the EAP server
|
||||
* @param peer ID of the EAP client
|
||||
* @return eap_identity_t object
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
eap_identity_t *eap_create(eap_role_t role,
|
||||
identification_t *server, identification_t *peer);
|
||||
|
||||
#endif /* EAP_IDENTITY_H_ */
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "eap_manager.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <utils/linked_list.h>
|
||||
|
||||
typedef struct private_eap_manager_t private_eap_manager_t;
|
||||
typedef struct eap_entry_t eap_entry_t;
|
||||
|
||||
/**
|
||||
* EAP constructor entry
|
||||
*/
|
||||
struct eap_entry_t {
|
||||
|
||||
/**
|
||||
* EAP method type, vendor specific if vendor is set
|
||||
*/
|
||||
eap_type_t type;
|
||||
|
||||
/**
|
||||
* vendor ID, 0 for default EAP methods
|
||||
*/
|
||||
u_int32_t vendor;
|
||||
|
||||
/**
|
||||
* Role of the method returned by the constructor, EAP_SERVER or EAP_PEER
|
||||
*/
|
||||
eap_role_t role;
|
||||
|
||||
/**
|
||||
* constructor function to create instance
|
||||
*/
|
||||
eap_constructor_t constructor;
|
||||
};
|
||||
|
||||
/**
|
||||
* private data of eap_manager
|
||||
*/
|
||||
struct private_eap_manager_t {
|
||||
|
||||
/**
|
||||
* public functions
|
||||
*/
|
||||
eap_manager_t public;
|
||||
|
||||
/**
|
||||
* list of eap_entry_t's
|
||||
*/
|
||||
linked_list_t *methods;
|
||||
|
||||
/**
|
||||
* mutex to lock methods
|
||||
*/
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
/**
|
||||
* Implementation of eap_manager_t.add_method.
|
||||
*/
|
||||
static void add_method(private_eap_manager_t *this, eap_type_t type,
|
||||
u_int32_t vendor, eap_role_t role,
|
||||
eap_constructor_t constructor)
|
||||
{
|
||||
eap_entry_t *entry = malloc_thing(eap_entry_t);
|
||||
|
||||
entry->type = type;
|
||||
entry->vendor = vendor;
|
||||
entry->role = role;
|
||||
entry->constructor = constructor;
|
||||
|
||||
pthread_mutex_lock(&this->mutex);
|
||||
this->methods->insert_last(this->methods, entry);
|
||||
pthread_mutex_unlock(&this->mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_manager_t.remove_method.
|
||||
*/
|
||||
static void remove_method(private_eap_manager_t *this, eap_constructor_t constructor)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
eap_entry_t *entry;
|
||||
|
||||
pthread_mutex_lock(&this->mutex);
|
||||
enumerator = this->methods->create_enumerator(this->methods);
|
||||
while (enumerator->enumerate(enumerator, &entry))
|
||||
{
|
||||
if (constructor == entry->constructor)
|
||||
{
|
||||
this->methods->remove_at(this->methods, enumerator);
|
||||
free(entry);
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
pthread_mutex_unlock(&this->mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_manager_t.create_instance.
|
||||
*/
|
||||
static eap_method_t* create_instance(private_eap_manager_t *this,
|
||||
eap_type_t type, u_int32_t vendor,
|
||||
eap_role_t role, identification_t *server,
|
||||
identification_t *peer)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
eap_entry_t *entry;
|
||||
eap_method_t *method = NULL;
|
||||
|
||||
pthread_mutex_lock(&this->mutex);
|
||||
enumerator = this->methods->create_enumerator(this->methods);
|
||||
while (enumerator->enumerate(enumerator, &entry))
|
||||
{
|
||||
if (type == entry->type && vendor == entry->vendor &&
|
||||
role == entry->role)
|
||||
{
|
||||
method = entry->constructor(server, peer);
|
||||
if (method)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
pthread_mutex_unlock(&this->mutex);
|
||||
return method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of 2008_t.destroy
|
||||
*/
|
||||
static void destroy(private_eap_manager_t *this)
|
||||
{
|
||||
this->methods->destroy_function(this->methods, free);
|
||||
free(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* see header file
|
||||
*/
|
||||
eap_manager_t *eap_manager_create()
|
||||
{
|
||||
private_eap_manager_t *this = malloc_thing(private_eap_manager_t);
|
||||
|
||||
this->public.add_method = (void(*)(eap_manager_t*, eap_type_t type, u_int32_t vendor, eap_role_t role, eap_constructor_t constructor))add_method;
|
||||
this->public.remove_method = (void(*)(eap_manager_t*, eap_constructor_t constructor))remove_method;
|
||||
this->public.create_instance = (eap_method_t*(*)(eap_manager_t*, eap_type_t type, u_int32_t vendor, eap_role_t role, identification_t*,identification_t*))create_instance;
|
||||
this->public.destroy = (void(*)(eap_manager_t*))destroy;
|
||||
|
||||
this->methods = linked_list_create();
|
||||
pthread_mutex_init(&this->mutex, NULL);
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup eap_manager eap_manager
|
||||
* @{ @ingroup eap
|
||||
*/
|
||||
|
||||
#ifndef EAP_MANAGER_H_
|
||||
#define EAP_MANAGER_H_
|
||||
|
||||
#include <sa/authenticators/eap/eap_method.h>
|
||||
|
||||
typedef struct eap_manager_t eap_manager_t;
|
||||
|
||||
/**
|
||||
* The EAP manager manages all EAP implementations and creates instances.
|
||||
*
|
||||
* A plugin registers it's implemented EAP method at the manager by
|
||||
* providing type and a contructor function. The manager then instanciates
|
||||
* eap_method_t instances through the provided constructor to handle
|
||||
* EAP authentication.
|
||||
*/
|
||||
struct eap_manager_t {
|
||||
|
||||
/**
|
||||
* Register a EAP method implementation.
|
||||
*
|
||||
* @param method vendor specific method, if vendor != 0
|
||||
* @param vendor vendor ID, 0 for non-vendor (default) EAP methods
|
||||
* @param role EAP role of the registered method
|
||||
* @param constructor constructor function, returns an eap_method_t
|
||||
*/
|
||||
void (*add_method)(eap_manager_t *this, eap_type_t type, u_int32_t vendor,
|
||||
eap_role_t role, eap_constructor_t constructor);
|
||||
|
||||
/**
|
||||
* Unregister a EAP method implementation using it's constructor.
|
||||
*
|
||||
* @param constructor constructor function to remove, as added in add_method
|
||||
*/
|
||||
void (*remove_method)(eap_manager_t *this, eap_constructor_t constructor);
|
||||
|
||||
/**
|
||||
* Create a new EAP method instance.
|
||||
*
|
||||
* @param type type of the EAP method
|
||||
* @param vendor vendor ID, 0 for non-vendor (default) EAP methods
|
||||
* @param role role of EAP method, either EAP_SERVER or EAP_PEER
|
||||
* @param server identity of the server
|
||||
* @param peer identity of the peer (client)
|
||||
* @return EAP method instance, NULL if no constructor found
|
||||
*/
|
||||
eap_method_t* (*create_instance)(eap_manager_t *this, eap_type_t type,
|
||||
u_int32_t vendor, eap_role_t role,
|
||||
identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
/**
|
||||
* Destroy a eap_manager instance.
|
||||
*/
|
||||
void (*destroy)(eap_manager_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a eap_manager instance.
|
||||
*/
|
||||
eap_manager_t *eap_manager_create();
|
||||
|
||||
#endif /* EAP_MANAGER_H_ @}*/
|
||||
@@ -1,282 +0,0 @@
|
||||
/**
|
||||
* @file eap_md5.c
|
||||
*
|
||||
* @brief Implementation of eap_md5_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "eap_md5.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <library.h>
|
||||
|
||||
typedef struct private_eap_md5_t private_eap_md5_t;
|
||||
|
||||
/**
|
||||
* Private data of an eap_md5_t object.
|
||||
*/
|
||||
struct private_eap_md5_t {
|
||||
|
||||
/**
|
||||
* Public authenticator_t interface.
|
||||
*/
|
||||
eap_md5_t public;
|
||||
|
||||
/**
|
||||
* ID of the server
|
||||
*/
|
||||
identification_t *server;
|
||||
|
||||
/**
|
||||
* ID of the peer
|
||||
*/
|
||||
identification_t *peer;
|
||||
|
||||
/**
|
||||
* challenge sent by the server
|
||||
*/
|
||||
chunk_t challenge;
|
||||
|
||||
/**
|
||||
* EAP message identififier
|
||||
*/
|
||||
u_int8_t identifier;
|
||||
};
|
||||
|
||||
typedef struct eap_md5_header_t eap_md5_header_t;
|
||||
|
||||
/**
|
||||
* packed eap MD5 header struct
|
||||
*/
|
||||
struct eap_md5_header_t {
|
||||
/** EAP code (REQUEST/RESPONSE) */
|
||||
u_int8_t code;
|
||||
/** unique message identifier */
|
||||
u_int8_t identifier;
|
||||
/** length of whole message */
|
||||
u_int16_t length;
|
||||
/** EAP type */
|
||||
u_int8_t type;
|
||||
/** length of value (challenge) */
|
||||
u_int8_t value_size;
|
||||
/** actual value */
|
||||
u_int8_t value[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define CHALLENGE_LEN 16
|
||||
#define PAYLOAD_LEN (CHALLENGE_LEN + sizeof(eap_md5_header_t))
|
||||
|
||||
/**
|
||||
* Hash the challenge string, create response
|
||||
*/
|
||||
static status_t hash_challenge(private_eap_md5_t *this, chunk_t *response)
|
||||
{
|
||||
chunk_t concat, secret;
|
||||
hasher_t *hasher;
|
||||
|
||||
if (charon->credentials->get_eap_key(charon->credentials, this->server,
|
||||
this->peer, &secret) != SUCCESS)
|
||||
{
|
||||
DBG1(DBG_IKE, "no EAP key found for hosts '%D' - '%D'",
|
||||
this->server, this->peer);
|
||||
return NOT_FOUND;
|
||||
}
|
||||
concat = chunk_cata("cmc", chunk_from_thing(this->identifier),
|
||||
secret, this->challenge);
|
||||
hasher = hasher_create(HASH_MD5);
|
||||
hasher->allocate_hash(hasher, concat, response);
|
||||
hasher->destroy(hasher);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.initiate for the peer
|
||||
*/
|
||||
static status_t initiate_peer(private_eap_md5_t *this, eap_payload_t **out)
|
||||
{
|
||||
/* peer never initiates */
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.initiate for the server
|
||||
*/
|
||||
static status_t initiate_server(private_eap_md5_t *this, eap_payload_t **out)
|
||||
{
|
||||
randomizer_t *randomizer;
|
||||
status_t status;
|
||||
eap_md5_header_t *req;
|
||||
|
||||
randomizer = randomizer_create();
|
||||
status = randomizer->allocate_pseudo_random_bytes(randomizer, CHALLENGE_LEN,
|
||||
&this->challenge);
|
||||
randomizer->destroy(randomizer);
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
req = alloca(PAYLOAD_LEN);
|
||||
req->length = htons(PAYLOAD_LEN);
|
||||
req->code = EAP_REQUEST;
|
||||
req->identifier = this->identifier;
|
||||
req->type = EAP_MD5;
|
||||
req->value_size = this->challenge.len;
|
||||
memcpy(req->value, this->challenge.ptr, this->challenge.len);
|
||||
|
||||
*out = eap_payload_create_data(chunk_create((void*)req, PAYLOAD_LEN));
|
||||
return NEED_MORE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.process for the peer
|
||||
*/
|
||||
static status_t process_peer(private_eap_md5_t *this,
|
||||
eap_payload_t *in, eap_payload_t **out)
|
||||
{
|
||||
chunk_t response;
|
||||
chunk_t data;
|
||||
eap_md5_header_t *req;
|
||||
|
||||
this->identifier = in->get_identifier(in);
|
||||
data = in->get_data(in);
|
||||
this->challenge = chunk_clone(chunk_skip(data, 6));
|
||||
if (data.len < 6 || this->challenge.len < *(data.ptr + 5))
|
||||
{
|
||||
DBG1(DBG_IKE, "received invalid EAP-MD5 message");
|
||||
return FAILED;
|
||||
}
|
||||
if (hash_challenge(this, &response) != SUCCESS)
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
req = alloca(PAYLOAD_LEN);
|
||||
req->length = htons(PAYLOAD_LEN);
|
||||
req->code = EAP_RESPONSE;
|
||||
req->identifier = this->identifier;
|
||||
req->type = EAP_MD5;
|
||||
req->value_size = response.len;
|
||||
memcpy(req->value, response.ptr, response.len);
|
||||
chunk_free(&response);
|
||||
|
||||
*out = eap_payload_create_data(chunk_create((void*)req, PAYLOAD_LEN));
|
||||
return NEED_MORE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.process for the server
|
||||
*/
|
||||
static status_t process_server(private_eap_md5_t *this,
|
||||
eap_payload_t *in, eap_payload_t **out)
|
||||
{
|
||||
chunk_t response, expected;
|
||||
chunk_t data;
|
||||
|
||||
if (this->identifier != in->get_identifier(in))
|
||||
{
|
||||
DBG1(DBG_IKE, "received invalid EAP-MD5 message");
|
||||
return FAILED;
|
||||
}
|
||||
if (hash_challenge(this, &expected) != SUCCESS)
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
data = in->get_data(in);
|
||||
response = chunk_skip(data, 6);
|
||||
|
||||
if (response.len < expected.len ||
|
||||
!memeq(response.ptr, expected.ptr, expected.len))
|
||||
{
|
||||
chunk_free(&expected);
|
||||
DBG1(DBG_IKE, "EAP-MD5 verification failed");
|
||||
return FAILED;
|
||||
}
|
||||
chunk_free(&expected);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.get_type.
|
||||
*/
|
||||
static eap_type_t get_type(private_eap_md5_t *this, u_int32_t *vendor)
|
||||
{
|
||||
*vendor = 0;
|
||||
return EAP_MD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.get_msk.
|
||||
*/
|
||||
static status_t get_msk(private_eap_md5_t *this, chunk_t *msk)
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.is_mutual.
|
||||
*/
|
||||
static bool is_mutual(private_eap_md5_t *this)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_method_t.destroy.
|
||||
*/
|
||||
static void destroy(private_eap_md5_t *this)
|
||||
{
|
||||
chunk_free(&this->challenge);
|
||||
free(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
eap_md5_t *eap_create(eap_role_t role,
|
||||
identification_t *server, identification_t *peer)
|
||||
{
|
||||
private_eap_md5_t *this = malloc_thing(private_eap_md5_t);
|
||||
|
||||
/* public functions */
|
||||
switch (role)
|
||||
{
|
||||
case EAP_SERVER:
|
||||
this->public.eap_method_interface.initiate = (status_t(*)(eap_method_t*,eap_payload_t**))initiate_server;
|
||||
this->public.eap_method_interface.process = (status_t(*)(eap_method_t*,eap_payload_t*,eap_payload_t**))process_server;
|
||||
break;
|
||||
case EAP_PEER:
|
||||
this->public.eap_method_interface.initiate = (status_t(*)(eap_method_t*,eap_payload_t**))initiate_peer;
|
||||
this->public.eap_method_interface.process = (status_t(*)(eap_method_t*,eap_payload_t*,eap_payload_t**))process_peer;
|
||||
break;
|
||||
default:
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
this->public.eap_method_interface.get_type = (eap_type_t(*)(eap_method_t*,u_int32_t*))get_type;
|
||||
this->public.eap_method_interface.is_mutual = (bool(*)(eap_method_t*))is_mutual;
|
||||
this->public.eap_method_interface.get_msk = (status_t(*)(eap_method_t*,chunk_t*))get_msk;
|
||||
this->public.eap_method_interface.destroy = (void(*)(eap_method_t*))destroy;
|
||||
|
||||
/* private data */
|
||||
this->peer = peer;
|
||||
this->server = server;
|
||||
this->challenge = chunk_empty;
|
||||
this->identifier = random();
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* @file eap_md5.h
|
||||
*
|
||||
* @brief Interface of eap_md5_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_MD5_H_
|
||||
#define EAP_MD5_H_
|
||||
|
||||
typedef struct eap_md5_t eap_md5_t;
|
||||
|
||||
#include <sa/authenticators/eap/eap_method.h>
|
||||
|
||||
/**
|
||||
* @brief Implementation of the eap_method_t interface using EAP-MD5 (CHAP).
|
||||
*
|
||||
* @b Constructors:
|
||||
* - eap_md5_create()
|
||||
* - eap_client_create() using eap_method EAP_MD5
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
struct eap_md5_t {
|
||||
|
||||
/**
|
||||
* Implemented eap_method_t interface.
|
||||
*/
|
||||
eap_method_t eap_method_interface;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates the EAP method EAP-MD5.
|
||||
*
|
||||
* @param server ID of the EAP server
|
||||
* @param peer ID of the EAP client
|
||||
* @return eap_md5_t object
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
eap_md5_t *eap_create(eap_role_t role,
|
||||
identification_t *server, identification_t *peer);
|
||||
|
||||
#endif /* EAP_MD5_H_ */
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file eap_method.c
|
||||
*
|
||||
* @brief Generic constructor for eap_methods.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,22 +11,12 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <error.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "eap_method.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <library.h>
|
||||
#include <utils/linked_list.h>
|
||||
#include <utils/identification.h>
|
||||
|
||||
|
||||
ENUM_BEGIN(eap_type_names, EAP_IDENTITY, EAP_TOKEN_CARD,
|
||||
"EAP_IDENTITY",
|
||||
"EAP_NOTIFICATION",
|
||||
@@ -62,171 +45,3 @@ ENUM(eap_role_names, EAP_SERVER, EAP_PEER,
|
||||
"EAP_PEER",
|
||||
);
|
||||
|
||||
|
||||
typedef struct module_entry_t module_entry_t;
|
||||
|
||||
/**
|
||||
* Representation of a loaded module: EAP type, library handle, constructor
|
||||
*/
|
||||
struct module_entry_t {
|
||||
eap_type_t type;
|
||||
u_int32_t vendor;
|
||||
void *handle;
|
||||
eap_constructor_t constructor;
|
||||
};
|
||||
|
||||
/** List of module_entry_t's */
|
||||
static linked_list_t *modules = NULL;
|
||||
|
||||
/**
|
||||
* unload modules at daemon shutdown
|
||||
*/
|
||||
void eap_method_unload()
|
||||
{
|
||||
if (modules)
|
||||
{
|
||||
module_entry_t *entry;
|
||||
|
||||
while (modules->remove_last(modules, (void**)&entry) == SUCCESS)
|
||||
{
|
||||
DBG2(DBG_CFG, "unloaded module EAP module %d-%d",
|
||||
entry->type, entry->vendor);
|
||||
dlclose(entry->handle);
|
||||
free(entry);
|
||||
}
|
||||
modules->destroy(modules);
|
||||
modules = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load EAP modules at daemon startup
|
||||
*/
|
||||
void eap_method_load(char *directory)
|
||||
{
|
||||
struct dirent* entry;
|
||||
DIR* dir;
|
||||
|
||||
eap_method_unload();
|
||||
modules = linked_list_create();
|
||||
|
||||
dir = opendir(directory);
|
||||
if (dir == NULL)
|
||||
{
|
||||
DBG1(DBG_CFG, "error opening EAP modules directory %s", directory);
|
||||
return;
|
||||
}
|
||||
|
||||
DBG1(DBG_CFG, "loading EAP modules from '%s'", directory);
|
||||
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
char file[256];
|
||||
module_entry_t module, *loaded_module;
|
||||
eap_method_t *method;
|
||||
identification_t *id;
|
||||
char *ending;
|
||||
|
||||
snprintf(file, sizeof(file), "%s/%s", directory, entry->d_name);
|
||||
|
||||
ending = entry->d_name + strlen(entry->d_name) - 3;
|
||||
if (ending <= entry->d_name || !streq(ending, ".so"))
|
||||
{
|
||||
/* skip anything which does not look like a library */
|
||||
DBG2(DBG_CFG, " skipping %s, doesn't look like a library",
|
||||
entry->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* try to load the library */
|
||||
module.handle = dlopen(file, RTLD_LAZY);
|
||||
if (module.handle == NULL)
|
||||
{
|
||||
DBG1(DBG_CFG, " opening EAP module %s failed: %s", entry->d_name,
|
||||
dlerror());
|
||||
continue;
|
||||
}
|
||||
module.constructor = dlsym(module.handle, "eap_create");
|
||||
if (module.constructor == NULL)
|
||||
{
|
||||
DBG1(DBG_CFG, " EAP module %s has no eap_create() function, skipped",
|
||||
entry->d_name);
|
||||
dlclose(module.handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get the type implemented in the method, create an instance for it */
|
||||
id = identification_create_from_string("[email protected]");
|
||||
method = module.constructor(EAP_SERVER, id, id);
|
||||
if (method == NULL)
|
||||
{
|
||||
method = module.constructor(EAP_PEER, id, id);
|
||||
}
|
||||
id->destroy(id);
|
||||
if (method == NULL)
|
||||
{
|
||||
DBG1(DBG_CFG, " unable to create instance of EAP method %s, skipped",
|
||||
entry->d_name);
|
||||
dlclose(module.handle);
|
||||
continue;
|
||||
}
|
||||
module.type = method->get_type(method, &module.vendor);
|
||||
method->destroy(method);
|
||||
|
||||
if (module.vendor)
|
||||
{
|
||||
DBG1(DBG_CFG, " loaded EAP method %d, vendor %d successfully from %s",
|
||||
module.type, module.vendor, entry->d_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG1(DBG_CFG, " loaded EAP method %N successfully from %s",
|
||||
eap_type_names, module.type, entry->d_name);
|
||||
}
|
||||
|
||||
loaded_module = malloc_thing(module_entry_t);
|
||||
memcpy(loaded_module, &module, sizeof(module));
|
||||
modules->insert_last(modules, loaded_module);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
eap_method_t *eap_method_create(eap_type_t type, u_int32_t vendor, eap_role_t role,
|
||||
identification_t *server, identification_t *peer)
|
||||
{
|
||||
eap_method_t *method = NULL;
|
||||
iterator_t *iterator;
|
||||
module_entry_t *entry;
|
||||
|
||||
iterator = modules->create_iterator(modules, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&entry))
|
||||
{
|
||||
if (entry->type == type && entry->vendor == vendor)
|
||||
{
|
||||
method = entry->constructor(role, server, peer);
|
||||
if (method)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
|
||||
if (method == NULL)
|
||||
{
|
||||
if (vendor)
|
||||
{
|
||||
DBG1(DBG_CFG, "no vendor %d specific EAP module found for method "
|
||||
"%d %N", vendor, type, eap_role_names, role);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG1(DBG_CFG, "no EAP module found for %N %N",
|
||||
eap_type_names, type, eap_role_names, role);
|
||||
}
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file eap_method.h
|
||||
*
|
||||
* @brief Interface eap_method_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,6 +11,13 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup eap_method eap_method
|
||||
* @{ @ingroup eap
|
||||
*/
|
||||
|
||||
#ifndef EAP_METHOD_H_
|
||||
@@ -34,8 +34,6 @@ typedef enum eap_code_t eap_code_t;
|
||||
|
||||
/**
|
||||
* Role of an eap_method, SERVER or PEER (client)
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
enum eap_role_t {
|
||||
EAP_SERVER,
|
||||
@@ -43,15 +41,11 @@ enum eap_role_t {
|
||||
};
|
||||
/**
|
||||
* enum names for eap_role_t.
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
extern enum_name_t *eap_role_names;
|
||||
|
||||
/**
|
||||
* EAP types, defines the EAP method implementation
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
enum eap_type_t {
|
||||
EAP_IDENTITY = 1,
|
||||
@@ -68,15 +62,11 @@ enum eap_type_t {
|
||||
|
||||
/**
|
||||
* enum names for eap_type_t.
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
extern enum_name_t *eap_type_names;
|
||||
|
||||
/**
|
||||
* EAP code, type of an EAP message
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
enum eap_code_t {
|
||||
EAP_REQUEST = 1,
|
||||
@@ -87,14 +77,12 @@ enum eap_code_t {
|
||||
|
||||
/**
|
||||
* enum names for eap_code_t.
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
extern enum_name_t *eap_code_names;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Interface of an EAP method for server and client side.
|
||||
* Interface of an EAP method for server and client side.
|
||||
*
|
||||
* An EAP method initiates an EAP exchange and processes requests and
|
||||
* responses. An EAP method may need multiple exchanges before succeeding, and
|
||||
@@ -107,22 +95,16 @@ extern enum_name_t *eap_code_names;
|
||||
* authentication. Even if a mutual EAP method is used, the traditional
|
||||
* AUTH payloads are required. Only these include the nonces and messages from
|
||||
* ike_sa_init and therefore prevent man in the middle attacks.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - eap_method_create()
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
struct eap_method_t {
|
||||
|
||||
/**
|
||||
* @brief Initiate the EAP exchange.
|
||||
* Initiate the EAP exchange.
|
||||
*
|
||||
* initiate() is only useable for server implementations, as clients only
|
||||
* reply to server requests.
|
||||
* A eap_payload is created in "out" if result is NEED_MORE.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param out eap_payload to send to the client
|
||||
* @return
|
||||
* - NEED_MORE, if an other exchange is required
|
||||
@@ -131,11 +113,10 @@ struct eap_method_t {
|
||||
status_t (*initiate) (eap_method_t *this, eap_payload_t **out);
|
||||
|
||||
/**
|
||||
* @brief Process a received EAP message.
|
||||
* Process a received EAP message.
|
||||
*
|
||||
* A eap_payload is created in "out" if result is NEED_MORE.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param in eap_payload response received
|
||||
* @param out created eap_payload to send
|
||||
* @return
|
||||
@@ -147,31 +128,28 @@ struct eap_method_t {
|
||||
eap_payload_t **out);
|
||||
|
||||
/**
|
||||
* @brief Get the EAP type implemented in this method.
|
||||
* Get the EAP type implemented in this method.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param vendor pointer receiving vendor identifier for type, 0 for none
|
||||
* @return type of the EAP method
|
||||
*/
|
||||
eap_type_t (*get_type) (eap_method_t *this, u_int32_t *vendor);
|
||||
|
||||
/**
|
||||
* @brief Check if this EAP method authenticates the server.
|
||||
* Check if this EAP method authenticates the server.
|
||||
*
|
||||
* Some EAP methods provide mutual authentication and
|
||||
* allow authentication using only EAP, if the peer supports it.
|
||||
*
|
||||
* @param this calling object
|
||||
* @return TRUE if methods provides mutual authentication
|
||||
*/
|
||||
bool (*is_mutual) (eap_method_t *this);
|
||||
|
||||
/**
|
||||
* @brief Get the MSK established by this EAP method.
|
||||
* Get the MSK established by this EAP method.
|
||||
*
|
||||
* Not all EAP methods establish a shared secret.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param msk chunk receiving internal stored MSK
|
||||
* @return
|
||||
* - SUCCESS, or
|
||||
@@ -180,68 +158,25 @@ struct eap_method_t {
|
||||
status_t (*get_msk) (eap_method_t *this, chunk_t *msk);
|
||||
|
||||
/**
|
||||
* @brief Destroys a eap_method_t object.
|
||||
*
|
||||
* @param this calling object
|
||||
* Destroys a eap_method_t object.
|
||||
*/
|
||||
void (*destroy) (eap_method_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates an EAP method for a specific type and role.
|
||||
*
|
||||
* @param eap_type EAP type to use
|
||||
* @param eap_vendor vendor identifier if a vendor specifc EAP type is used
|
||||
* @param role role of the eap_method, server or peer
|
||||
* @param server ID of acting server
|
||||
* @param peer ID of involved peer (client)
|
||||
* @return eap_method_t object
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
eap_method_t *eap_method_create(eap_type_t eap_type, u_int32_t eap_vendor,
|
||||
eap_role_t role, identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
/**
|
||||
* @brief (Re-)Load all EAP modules in the EAP modules directory.
|
||||
*
|
||||
* For security reasons, the directory and all it's modules must be owned
|
||||
* by root and must not be writeable by someone else.
|
||||
*
|
||||
* @param dir directory of the EAP modules
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
void eap_method_load(char *directory);
|
||||
|
||||
/**
|
||||
* @brief Unload all loaded EAP modules
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
void eap_method_unload();
|
||||
|
||||
/**
|
||||
* @brief Constructor definition for a pluggable EAP module.
|
||||
* Constructor definition for a pluggable EAP method.
|
||||
*
|
||||
* Each EAP module must define a constructor function which will return
|
||||
* an initialized object with the methods defined in eap_method_t. The
|
||||
* constructor must be named eap_create() and it's signature must be equal
|
||||
* to that of eap_constructor_t.
|
||||
* A module may implement only a single role. If it does not support the role
|
||||
* requested, NULL should be returned. Multiple modules are allowed of the
|
||||
* same EAP type to support seperate implementations of peer/server.
|
||||
* an initialized object with the methods defined in eap_method_t.
|
||||
* Constructors for server and peers are identical, to support both roles
|
||||
* of a EAP method, a plugin needs register two constructors in the
|
||||
* eap_manager_t.
|
||||
*
|
||||
* @param role role the module will play, peer or server
|
||||
* @param server ID of the server to use for credential lookup
|
||||
* @param peer ID of the peer to use for credential lookup
|
||||
* @return implementation of the eap_method_t interface
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
typedef eap_method_t *(*eap_constructor_t)(eap_role_t role,
|
||||
identification_t *server,
|
||||
typedef eap_method_t *(*eap_constructor_t)(identification_t *server,
|
||||
identification_t *peer);
|
||||
|
||||
#endif /* EAP_METHOD_H_ */
|
||||
#endif /* EAP_METHOD_H_ @} */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,114 +0,0 @@
|
||||
/**
|
||||
* @file eap_sim.h
|
||||
*
|
||||
* @brief Interface of eap_sim_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_SIM_H_
|
||||
#define EAP_SIM_H_
|
||||
|
||||
typedef struct eap_sim_t eap_sim_t;
|
||||
|
||||
#include <sa/authenticators/eap/eap_method.h>
|
||||
|
||||
/** the library containing with the triplet functions */
|
||||
#ifndef SIM_READER_LIB
|
||||
#error SIM_READER_LIB not specified, use --with-sim-reader option
|
||||
#endif /* SIM_READER_LIB */
|
||||
|
||||
/**
|
||||
* @brief Cardreaders SIM function.
|
||||
*
|
||||
* @param rand RAND to run algo with
|
||||
* @param rand_length length of value in rand
|
||||
* @param sres buffer to get SRES
|
||||
* @param sres_length size of buffer in sres, returns bytes written to SRES
|
||||
* @param kc buffer to get Kc
|
||||
* @param kc_length size of buffer in Kc, returns bytes written to Kc
|
||||
* @return zero on success
|
||||
*/
|
||||
typedef int (*sim_algo_t)(const unsigned char *rand, int rand_length,
|
||||
unsigned char *sres, int *sres_length,
|
||||
unsigned char *kc, int *kc_length);
|
||||
|
||||
#ifndef SIM_READER_ALG
|
||||
/** the SIM_READER_LIB's algorithm, uses sim_algo_t signature */
|
||||
#define SIM_READER_ALG "sim_run_alg"
|
||||
#endif /* SIM_READER_ALG */
|
||||
|
||||
/**
|
||||
* @brief Function to get a SIM triplet.
|
||||
*
|
||||
* @param identity identity (imsi) to get a triplet for
|
||||
* @param rand buffer to get RAND
|
||||
* @param rand_length size of buffer in rand, returns bytes written to RAND
|
||||
* @param sres buffer to get SRES
|
||||
* @param sres_length size of buffer in sres, returns bytes written to SRES
|
||||
* @param kc buffer to get Kc
|
||||
* @param kc_length size of buffer in Kc, returns bytes written to Kc
|
||||
* @return zero on success
|
||||
*/
|
||||
typedef int (*sim_get_triplet_t)(char *identity,
|
||||
unsigned char *rand, int *rand_length,
|
||||
unsigned char *sres, int *sres_length,
|
||||
unsigned char *kc, int *kc_length);
|
||||
|
||||
#ifndef SIM_READER_GET_TRIPLET
|
||||
/** the SIM_READER_LIB's get-triplet function, uses sim_get_triplet_t signature */
|
||||
#define SIM_READER_GET_TRIPLET "sim_get_triplet"
|
||||
#endif /* SIM_READER_GET_TRIPLET */
|
||||
|
||||
/**
|
||||
* @brief Implementation of the eap_method_t interface using EAP-SIM.
|
||||
*
|
||||
* This EAP-SIM client implementation uses another pluggable library to
|
||||
* access the SIM card/triplet provider. This module is specified using the
|
||||
* SIM_READER_LIB definition. It has to privde a sim_run_alg() function to
|
||||
* calculate a triplet (client), and/or a sim_get_triplet() function to get
|
||||
* a triplet (server). These functions are named to the SIM_READER_ALG and
|
||||
* the SIM_READER_GET_TRIPLET definitions.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - eap_create() of this module
|
||||
* - eap_client_create() using eap_method EAP_SIM
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
struct eap_sim_t {
|
||||
|
||||
/**
|
||||
* Implemented eap_method_t interface.
|
||||
*/
|
||||
eap_method_t eap_method_interface;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates the EAP method EAP-SIM.
|
||||
*
|
||||
* @param role role of the module, client/server
|
||||
* @param server ID of the EAP server
|
||||
* @param peer ID of the EAP client
|
||||
* @return eap_sim_t object
|
||||
*
|
||||
* @ingroup eap
|
||||
*/
|
||||
eap_sim_t *eap_create(eap_role_t role,
|
||||
identification_t *server, identification_t *peer);
|
||||
|
||||
#endif /* EAP_SIM_H_ */
|
||||
@@ -1,288 +0,0 @@
|
||||
/**
|
||||
* @file eap_sim.h
|
||||
*
|
||||
* @brief Interface of eap_sim_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <daemon.h>
|
||||
|
||||
#define IMSI_LEN 64
|
||||
#define RAND_LEN 16
|
||||
#define SRES_LEN 4
|
||||
#define KC_LEN 8
|
||||
|
||||
typedef struct triplet_t triplet_t;
|
||||
|
||||
struct triplet_t {
|
||||
unsigned char imsi[IMSI_LEN];
|
||||
unsigned char rand[RAND_LEN];
|
||||
unsigned char sres[SRES_LEN];
|
||||
unsigned char kc[KC_LEN];
|
||||
};
|
||||
|
||||
static triplet_t *triplets = NULL;
|
||||
static int triplet_count = 0;
|
||||
|
||||
#define TRIPLET_FILE IPSEC_CONFDIR "/ipsec.d/triplets.dat"
|
||||
|
||||
/**
|
||||
* convert a single HEX char to its integer value
|
||||
*/
|
||||
static int hexchr(char chr)
|
||||
{
|
||||
switch (chr)
|
||||
{
|
||||
case '0'...'9':
|
||||
return chr - '0';
|
||||
case 'A'...'F':
|
||||
return 10 + chr - 'A';
|
||||
case 'a'...'f':
|
||||
return 10 + chr - 'a';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a HEX string into a char array bin, limited by array length len
|
||||
*/
|
||||
static void hex2bin(char *hex, unsigned char *bin, size_t len)
|
||||
{
|
||||
char *pos;
|
||||
int i, even = 1;
|
||||
|
||||
pos = hex - 1;
|
||||
/* find the end, as we convert bottom up */
|
||||
while (TRUE)
|
||||
{
|
||||
switch (*(pos+1))
|
||||
{
|
||||
case '0'...'9':
|
||||
case 'A'...'F':
|
||||
case 'a'...'f':
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* convert two hex chars into a single bin byte */
|
||||
for (i = 0; pos >= hex && i < len; pos--)
|
||||
{
|
||||
if (even)
|
||||
{
|
||||
bin[len - 1 - i] = hexchr(*pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
bin[len - 1 - i] |= 16 * hexchr(*pos);
|
||||
i++;
|
||||
}
|
||||
even = !even;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* free up allocated triplets
|
||||
*/
|
||||
static void __attribute__ ((destructor)) free_triplets()
|
||||
{
|
||||
free(triplets);
|
||||
}
|
||||
|
||||
/**
|
||||
* read the triplets from the file, using freeradius triplet file syntax:
|
||||
* http://www.freeradius.org/radiusd/doc/rlm_sim_triplets
|
||||
*/
|
||||
static void __attribute__ ((constructor)) read_triplets()
|
||||
{
|
||||
char line[512], *data[4], *pos;
|
||||
FILE *file;
|
||||
int i, nr = 0;
|
||||
triplet_t *triplet;
|
||||
|
||||
file = fopen(TRIPLET_FILE, "r");
|
||||
if (file == NULL)
|
||||
{
|
||||
DBG1(DBG_CFG, "opening triplet file %s failed: %s",
|
||||
TRIPLET_FILE, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (triplets)
|
||||
{
|
||||
free(triplets);
|
||||
triplets = NULL;
|
||||
triplet_count = 0;
|
||||
}
|
||||
|
||||
/* read line by line */
|
||||
while (fgets(line, sizeof(line), file))
|
||||
{
|
||||
nr++;
|
||||
/* skip comments, empty lines */
|
||||
switch (line[0])
|
||||
{
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '#':
|
||||
case '\0':
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* read comma separated values */
|
||||
pos = line;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
data[i] = pos;
|
||||
pos = strchr(pos, ',');
|
||||
if (pos)
|
||||
{
|
||||
*pos = '\0';
|
||||
pos++;
|
||||
}
|
||||
else if (i != 3)
|
||||
{
|
||||
DBG1(DBG_CFG, "error in triplet file, line %d", nr);
|
||||
fclose(file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* allocate new triplet */
|
||||
triplet_count++;
|
||||
triplets = realloc(triplets, triplet_count * sizeof(triplet_t));
|
||||
triplet = &triplets[triplet_count - 1];
|
||||
memset(triplet, 0, sizeof(triplet_t));
|
||||
|
||||
/* convert/copy triplet data */
|
||||
for (i = 0; i < IMSI_LEN - 1; i++)
|
||||
{
|
||||
switch (data[0][i])
|
||||
{
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\0':
|
||||
break;
|
||||
default:
|
||||
triplet->imsi[i] = data[0][i];
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
hex2bin(data[1], triplet->rand, RAND_LEN);
|
||||
hex2bin(data[2], triplet->sres, SRES_LEN);
|
||||
hex2bin(data[3], triplet->kc, KC_LEN);
|
||||
|
||||
DBG4(DBG_CFG, "triplet: imsi %b\nrand %b\nsres %b\nkc %b",
|
||||
triplet->imsi, IMSI_LEN, triplet->rand, RAND_LEN,
|
||||
triplet->sres, SRES_LEN, triplet->kc, KC_LEN);
|
||||
}
|
||||
fclose(file);
|
||||
DBG2(DBG_CFG, "read %d triplets from %s", triplet_count, TRIPLET_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the sim algorithm, see eap_sim.h
|
||||
*/
|
||||
int sim_run_alg(const unsigned char *rand, int rand_length,
|
||||
unsigned char *sres, int *sres_length,
|
||||
unsigned char *kc, int *kc_length)
|
||||
{
|
||||
int current;
|
||||
|
||||
if (rand_length != RAND_LEN ||
|
||||
*sres_length < SRES_LEN ||
|
||||
*kc_length < KC_LEN)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (current = 0; current < triplet_count; current++)
|
||||
{
|
||||
if (memcmp(triplets[current].rand, rand, RAND_LEN) == 0)
|
||||
{
|
||||
memcpy(sres, triplets[current].sres, SRES_LEN);
|
||||
memcpy(kc, triplets[current].kc, KC_LEN);
|
||||
*sres_length = SRES_LEN;
|
||||
*kc_length = KC_LEN;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single triplet, see_eap_sim.h
|
||||
*/
|
||||
int sim_get_triplet(char *imsi,
|
||||
unsigned char *rand, int *rand_length,
|
||||
unsigned char *sres, int *sres_length,
|
||||
unsigned char *kc, int *kc_length)
|
||||
{
|
||||
int current;
|
||||
triplet_t *triplet;
|
||||
static int skip = -1;
|
||||
|
||||
DBG2(DBG_CFG, "getting triplet for %s", imsi);
|
||||
|
||||
if (*rand_length < RAND_LEN ||
|
||||
*sres_length < SRES_LEN ||
|
||||
*kc_length < KC_LEN)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (triplet_count == 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
for (current = 0; current < triplet_count; current++)
|
||||
{
|
||||
triplet = &triplets[current];
|
||||
|
||||
if (streq(imsi, triplet->imsi))
|
||||
{
|
||||
/* skip triplet if already used */
|
||||
if (skip >= current)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
*rand_length = RAND_LEN;
|
||||
*sres_length = SRES_LEN;
|
||||
*kc_length = KC_LEN;
|
||||
memcpy(rand, triplet->rand, RAND_LEN);
|
||||
memcpy(sres, triplet->sres, SRES_LEN);
|
||||
memcpy(kc, triplet->kc, KC_LEN);
|
||||
/* remember used triplet */
|
||||
skip = current;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (skip > -1)
|
||||
{
|
||||
/* no triplet left, reuse triplets */
|
||||
skip = -1;
|
||||
return sim_get_triplet(imsi, rand, rand_length,
|
||||
sres, sres_length, kc, kc_length);
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file eap_authenticator.c
|
||||
*
|
||||
* @brief Implementation of eap_authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,6 +11,8 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -160,9 +155,9 @@ static status_t initiate(private_eap_authenticator_t *this, eap_type_t type,
|
||||
{
|
||||
DBG1(DBG_IKE, "requesting %N authentication", eap_type_names, type);
|
||||
}
|
||||
this->method = eap_method_create(type, vendor, this->role,
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
this->method = charon->eap->create_instance(charon->eap, type, vendor,
|
||||
this->role, this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
|
||||
if (this->method == NULL)
|
||||
{
|
||||
@@ -195,9 +190,11 @@ static status_t process_peer(private_eap_authenticator_t *this,
|
||||
|
||||
if (!vendor && type == EAP_IDENTITY)
|
||||
{
|
||||
eap_method_t *method = eap_method_create(type, 0, EAP_PEER,
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa));
|
||||
eap_method_t *method;
|
||||
|
||||
method = charon->eap->create_instance(charon->eap, type, 0, EAP_PEER,
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa));
|
||||
|
||||
if (method == NULL || method->process(method, in, out) != SUCCESS)
|
||||
{
|
||||
@@ -227,9 +224,10 @@ static status_t process_peer(private_eap_authenticator_t *this,
|
||||
DBG1(DBG_IKE, "EAP server requested %N authentication",
|
||||
eap_type_names, type);
|
||||
}
|
||||
this->method = eap_method_create(type, vendor, EAP_PEER,
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa));
|
||||
this->method = charon->eap->create_instance(charon->eap,
|
||||
type, vendor, EAP_PEER,
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa));
|
||||
if (this->method == NULL)
|
||||
{
|
||||
DBG1(DBG_IKE, "EAP server requested unsupported "
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file eap_authenticator.h
|
||||
*
|
||||
* @brief Interface of eap_authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,6 +11,13 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup eap_authenticator eap_authenticator
|
||||
* @{ @ingroup authenticators
|
||||
*/
|
||||
|
||||
#ifndef EAP_AUTHENTICATOR_H_
|
||||
@@ -29,7 +29,7 @@ typedef struct eap_authenticator_t eap_authenticator_t;
|
||||
#include <encoding/payloads/eap_payload.h>
|
||||
|
||||
/**
|
||||
* @brief Implementation of the authenticator_t interface using AUTH_EAP.
|
||||
* Implementation of the authenticator_t interface using AUTH_EAP.
|
||||
*
|
||||
* Authentication using EAP involves the most complex authenticator. It stays
|
||||
* alive over multiple ike_auth transactions and handles multiple EAP
|
||||
@@ -68,11 +68,6 @@ typedef struct eap_authenticator_t eap_authenticator_t;
|
||||
+--------+ +--------+
|
||||
|
||||
@endverbatim
|
||||
* @b Constructors:
|
||||
* - eap_authenticator_create()
|
||||
* - authenticator_create() using auth_method AUTH_EAP
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
struct eap_authenticator_t {
|
||||
|
||||
@@ -82,7 +77,7 @@ struct eap_authenticator_t {
|
||||
authenticator_t authenticator_interface;
|
||||
|
||||
/**
|
||||
* @brief Check if the EAP method was/is mutual and secure.
|
||||
* Check if the EAP method was/is mutual and secure.
|
||||
*
|
||||
* RFC4306 proposes to authenticate the EAP responder (server) by standard
|
||||
* IKEv2 methods (RSA, psk). Not all, but some EAP methods
|
||||
@@ -93,19 +88,17 @@ struct eap_authenticator_t {
|
||||
* AUTH payload, the client must verify that the server initiated mutual
|
||||
* EAP authentication before it can trust the server.
|
||||
*
|
||||
* @param this calling object
|
||||
* @return TRUE, if no AUTH payload required, FALSE otherwise
|
||||
*/
|
||||
bool (*is_mutual) (eap_authenticator_t* this);
|
||||
|
||||
/**
|
||||
* @brief Initiate the EAP exchange.
|
||||
* Initiate the EAP exchange.
|
||||
*
|
||||
* The server initiates EAP exchanges, so the client never calls
|
||||
* this method. If initiate() returns NEED_MORE, the EAP authentication
|
||||
* process started. In any case, a payload is created in "out".
|
||||
*
|
||||
* @param this calling object
|
||||
* @param type EAP method to use to authenticate client
|
||||
* @param vendor EAP vendor identifier, if type is vendor specific, or 0
|
||||
* @param out created initiaal EAP message to send
|
||||
@@ -117,7 +110,7 @@ struct eap_authenticator_t {
|
||||
u_int32_t vendor, eap_payload_t **out);
|
||||
|
||||
/**
|
||||
* @brief Process an EAP message.
|
||||
* Process an EAP message.
|
||||
*
|
||||
* After receiving an EAP message "in", the peer/server processes
|
||||
* the payload and creates a reply/subsequent request.
|
||||
@@ -132,7 +125,6 @@ struct eap_authenticator_t {
|
||||
* If a SUCCESS is returned (on any side), the EAP authentication was
|
||||
* successful and the AUTH payload can be exchanged.
|
||||
*
|
||||
* @param this calling object
|
||||
* @param in received EAP message
|
||||
* @param out created EAP message to send
|
||||
* @return
|
||||
@@ -145,13 +137,11 @@ struct eap_authenticator_t {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates an authenticator for AUTH_EAP.
|
||||
* Creates an authenticator for AUTH_EAP.
|
||||
*
|
||||
* @param ike_sa associated ike_sa
|
||||
* @return eap_authenticator_t object
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
eap_authenticator_t *eap_authenticator_create(ike_sa_t *ike_sa);
|
||||
|
||||
#endif /* EAP_AUTHENTICATOR_H_ */
|
||||
#endif /* EAP_AUTHENTICATOR_H_ @} */
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file psk_authenticator.c
|
||||
*
|
||||
* @brief Implementation of psk_authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005-2006 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
@@ -19,6 +12,8 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -26,6 +21,7 @@
|
||||
#include "psk_authenticator.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <credentials/auth_info.h>
|
||||
|
||||
/**
|
||||
* Key pad for the AUTH method SHARED_KEY_MESSAGE_INTEGRITY_CODE.
|
||||
@@ -105,39 +101,49 @@ chunk_t build_shared_key_signature(chunk_t ike_sa_init, chunk_t nonce,
|
||||
* Implementation of authenticator_t.verify.
|
||||
*/
|
||||
static status_t verify(private_psk_authenticator_t *this, chunk_t ike_sa_init,
|
||||
chunk_t my_nonce, auth_payload_t *auth_payload)
|
||||
chunk_t my_nonce, auth_payload_t *auth_payload)
|
||||
{
|
||||
status_t status;
|
||||
chunk_t auth_data, recv_auth_data, shared_key;
|
||||
chunk_t auth_data, recv_auth_data;
|
||||
identification_t *my_id, *other_id;
|
||||
shared_key_t *shared_key;
|
||||
enumerator_t *enumerator;
|
||||
bool authenticated = FALSE;
|
||||
int keys_found = 0;
|
||||
|
||||
my_id = this->ike_sa->get_my_id(this->ike_sa);
|
||||
other_id = this->ike_sa->get_other_id(this->ike_sa);
|
||||
status = charon->credentials->get_shared_key(charon->credentials, my_id,
|
||||
other_id, &shared_key);
|
||||
if (status != SUCCESS)
|
||||
enumerator = charon->credentials->create_shared_enumerator(
|
||||
charon->credentials, SHARED_IKE, my_id, other_id);
|
||||
while (!authenticated && enumerator->enumerate(enumerator, &shared_key, NULL, NULL))
|
||||
{
|
||||
DBG1(DBG_IKE, "no shared key found for '%D' - '%D'", my_id, other_id);
|
||||
return status;
|
||||
}
|
||||
|
||||
auth_data = build_shared_key_signature(ike_sa_init, my_nonce, shared_key,
|
||||
other_id, this->ike_sa->get_skp_verify(this->ike_sa),
|
||||
this->ike_sa->get_prf(this->ike_sa));
|
||||
chunk_free_randomized(&shared_key);
|
||||
|
||||
recv_auth_data = auth_payload->get_data(auth_payload);
|
||||
if (auth_data.len != recv_auth_data.len ||
|
||||
!memeq(auth_data.ptr, recv_auth_data.ptr, auth_data.len))
|
||||
{
|
||||
DBG1(DBG_IKE, "PSK MAC verification failed");
|
||||
keys_found++;
|
||||
auth_data = build_shared_key_signature(ike_sa_init, my_nonce,
|
||||
shared_key->get_key(shared_key), other_id,
|
||||
this->ike_sa->get_skp_verify(this->ike_sa),
|
||||
this->ike_sa->get_prf(this->ike_sa));
|
||||
recv_auth_data = auth_payload->get_data(auth_payload);
|
||||
if (auth_data.len == recv_auth_data.len &&
|
||||
memeq(auth_data.ptr, recv_auth_data.ptr, auth_data.len))
|
||||
{
|
||||
DBG1(DBG_IKE, "authentication of '%D' with %N successful",
|
||||
other_id, auth_method_names, AUTH_PSK);
|
||||
authenticated = TRUE;
|
||||
}
|
||||
chunk_free(&auth_data);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
if (!authenticated)
|
||||
{
|
||||
if (keys_found == 0)
|
||||
{
|
||||
DBG1(DBG_IKE, "no shared key found for '%D' - '%D'", my_id, other_id);
|
||||
return NOT_FOUND;
|
||||
}
|
||||
DBG1(DBG_IKE, "tried %d shared key%s for '%D' - '%D', but MAC mismatched",
|
||||
keys_found, keys_found == 1 ? "" : "s", my_id, other_id);
|
||||
return FAILED;
|
||||
}
|
||||
chunk_free(&auth_data);
|
||||
|
||||
DBG1(DBG_IKE, "authentication of '%D' with %N successful",
|
||||
other_id, auth_method_names, AUTH_PSK);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -147,28 +153,27 @@ static status_t verify(private_psk_authenticator_t *this, chunk_t ike_sa_init,
|
||||
static status_t build(private_psk_authenticator_t *this, chunk_t ike_sa_init,
|
||||
chunk_t other_nonce, auth_payload_t **auth_payload)
|
||||
{
|
||||
chunk_t shared_key;
|
||||
shared_key_t *shared_key;
|
||||
chunk_t auth_data;
|
||||
status_t status;
|
||||
identification_t *my_id, *other_id;
|
||||
|
||||
my_id = this->ike_sa->get_my_id(this->ike_sa);
|
||||
other_id = this->ike_sa->get_other_id(this->ike_sa);
|
||||
DBG1(DBG_IKE, "authentication of '%D' (myself) with %N",
|
||||
my_id, auth_method_names, AUTH_PSK);
|
||||
status = charon->credentials->get_shared_key(charon->credentials, my_id,
|
||||
other_id, &shared_key);
|
||||
if (status != SUCCESS)
|
||||
shared_key = charon->credentials->get_shared(charon->credentials, SHARED_IKE,
|
||||
my_id, other_id);
|
||||
if (shared_key == NULL)
|
||||
{
|
||||
DBG1(DBG_IKE, "no shared key found for '%D' - '%D'", my_id, other_id);
|
||||
return status;
|
||||
return NOT_FOUND;
|
||||
}
|
||||
|
||||
auth_data = build_shared_key_signature(ike_sa_init, other_nonce, shared_key,
|
||||
my_id, this->ike_sa->get_skp_build(this->ike_sa),
|
||||
this->ike_sa->get_prf(this->ike_sa));
|
||||
auth_data = build_shared_key_signature(ike_sa_init, other_nonce,
|
||||
shared_key->get_key(shared_key), my_id,
|
||||
this->ike_sa->get_skp_build(this->ike_sa),
|
||||
this->ike_sa->get_prf(this->ike_sa));
|
||||
shared_key->destroy(shared_key);
|
||||
DBG2(DBG_IKE, "successfully created shared key MAC");
|
||||
chunk_free_randomized(&shared_key);
|
||||
*auth_payload = auth_payload_create();
|
||||
(*auth_payload)->set_auth_method(*auth_payload, AUTH_PSK);
|
||||
(*auth_payload)->set_data(*auth_payload, auth_data);
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file psk_authenticator.h
|
||||
*
|
||||
* @brief Interface of psk_authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,6 +11,13 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup psk_authenticator psk_authenticator
|
||||
* @{ @ingroup authenticators
|
||||
*/
|
||||
|
||||
#ifndef PSK_AUTHENTICATOR_H_
|
||||
@@ -28,13 +28,7 @@ typedef struct psk_authenticator_t psk_authenticator_t;
|
||||
#include <sa/authenticators/authenticator.h>
|
||||
|
||||
/**
|
||||
* @brief Implementation of the authenticator_t interface using AUTH_PSK.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - psk_authenticator_create()
|
||||
* - authenticator_create() using auth_method AUTH_PSK
|
||||
*
|
||||
* @ingroup authenticators
|
||||
* Implementation of the authenticator_t interface using AUTH_PSK.
|
||||
*/
|
||||
struct psk_authenticator_t {
|
||||
|
||||
@@ -45,13 +39,11 @@ struct psk_authenticator_t {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates an authenticator for AUTH_PSK.
|
||||
* Creates an authenticator for AUTH_PSK.
|
||||
*
|
||||
* @param ike_sa associated ike_sa
|
||||
* @return psk_authenticator_t object
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
psk_authenticator_t *psk_authenticator_create(ike_sa_t *ike_sa);
|
||||
|
||||
#endif /* PSK_AUTHENTICATOR_H_ */
|
||||
#endif /* PSK_AUTHENTICATOR_H_ @} */
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file rsa_authenticator.c
|
||||
*
|
||||
* @brief Implementation of rsa_authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005-2006 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
@@ -19,6 +12,8 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -26,6 +21,7 @@
|
||||
#include "rsa_authenticator.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <credentials/auth_info.h>
|
||||
|
||||
|
||||
typedef struct private_rsa_authenticator_t private_rsa_authenticator_t;
|
||||
@@ -58,11 +54,12 @@ extern chunk_t build_tbs_octets(chunk_t ike_sa_init, chunk_t nonce,
|
||||
static status_t verify(private_rsa_authenticator_t *this, chunk_t ike_sa_init,
|
||||
chunk_t my_nonce, auth_payload_t *auth_payload)
|
||||
{
|
||||
status_t status;
|
||||
public_key_t *public;
|
||||
chunk_t auth_data, octets;
|
||||
identification_t *other_id;
|
||||
ca_info_t *issuer;
|
||||
prf_t *prf;
|
||||
auth_info_t *auth;
|
||||
status_t status = FAILED;
|
||||
|
||||
other_id = this->ike_sa->get_other_id(this->ike_sa);
|
||||
|
||||
@@ -74,16 +71,27 @@ static status_t verify(private_rsa_authenticator_t *this, chunk_t ike_sa_init,
|
||||
prf = this->ike_sa->get_prf(this->ike_sa);
|
||||
prf->set_key(prf, this->ike_sa->get_skp_verify(this->ike_sa));
|
||||
octets = build_tbs_octets(ike_sa_init, my_nonce, other_id, prf);
|
||||
status = charon->credentials->verify_signature(charon->credentials,
|
||||
octets, auth_data, other_id, &issuer);
|
||||
chunk_free(&octets);
|
||||
|
||||
if (status == SUCCESS)
|
||||
auth = this->ike_sa->get_other_auth(this->ike_sa);
|
||||
public = charon->credentials->get_public(charon->credentials, KEY_RSA,
|
||||
other_id, auth);
|
||||
if (public)
|
||||
{
|
||||
this->ike_sa->set_other_ca(this->ike_sa, issuer);
|
||||
DBG1(DBG_IKE, "authentication of '%D' with %N successful",
|
||||
other_id, auth_method_names, AUTH_RSA);
|
||||
/* We are currently fixed to SHA1 hashes.
|
||||
* TODO: allow other hash algorithms and note it in "auth" */
|
||||
if (public->verify(public, SIGN_RSA_EMSA_PKCS1_SHA1, octets, auth_data))
|
||||
{
|
||||
DBG1(DBG_IKE, "authentication of %D with %N successful",
|
||||
other_id, auth_method_names, AUTH_RSA);
|
||||
status = SUCCESS;
|
||||
}
|
||||
public->destroy(public);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG1(DBG_IKE, "no trusted public key found for %D", other_id);
|
||||
}
|
||||
chunk_free(&octets);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -94,43 +102,47 @@ static status_t build(private_rsa_authenticator_t *this, chunk_t ike_sa_init,
|
||||
chunk_t other_nonce, auth_payload_t **auth_payload)
|
||||
{
|
||||
chunk_t octets, auth_data;
|
||||
status_t status;
|
||||
rsa_public_key_t *my_pubkey;
|
||||
status_t status = FAILED;
|
||||
private_key_t *private;
|
||||
identification_t *my_id;
|
||||
prf_t *prf;
|
||||
auth_info_t *auth;
|
||||
|
||||
my_id = this->ike_sa->get_my_id(this->ike_sa);
|
||||
DBG1(DBG_IKE, "authentication of '%D' (myself) with %N",
|
||||
DBG1(DBG_IKE, "authentication of %D (myself) with %N",
|
||||
my_id, auth_method_names, AUTH_RSA);
|
||||
DBG2(DBG_IKE, "looking for RSA public key belonging to '%D'...", my_id);
|
||||
|
||||
my_pubkey = charon->credentials->get_rsa_public_key(charon->credentials, my_id);
|
||||
if (my_pubkey == NULL)
|
||||
|
||||
auth = this->ike_sa->get_my_auth(this->ike_sa);
|
||||
private = charon->credentials->get_private(charon->credentials, KEY_RSA,
|
||||
my_id, auth);
|
||||
if (private == NULL)
|
||||
{
|
||||
DBG1(DBG_IKE, "no RSA public key found for '%D'", my_id);
|
||||
DBG1(DBG_IKE, "no RSA private key found for %D", my_id);
|
||||
return NOT_FOUND;
|
||||
}
|
||||
DBG2(DBG_IKE, " matching RSA public key found");
|
||||
|
||||
prf = this->ike_sa->get_prf(this->ike_sa);
|
||||
prf->set_key(prf, this->ike_sa->get_skp_build(this->ike_sa));
|
||||
octets = build_tbs_octets(ike_sa_init, other_nonce, my_id, prf);
|
||||
status = charon->credentials->rsa_signature(charon->credentials,
|
||||
my_pubkey, HASH_SHA1, octets, &auth_data);
|
||||
chunk_free(&octets);
|
||||
|
||||
if (status != SUCCESS)
|
||||
/* we currently use always SHA1 for signatures,
|
||||
* TODO: support other hashes depending on configuration/auth */
|
||||
if (private->sign(private, SIGN_RSA_EMSA_PKCS1_SHA1, octets, &auth_data))
|
||||
{
|
||||
DBG1(DBG_IKE, "building RSA signature with SHA-1 hash failed");
|
||||
return status;
|
||||
auth_payload_t *payload = auth_payload_create();
|
||||
payload->set_auth_method(payload, AUTH_RSA);
|
||||
payload->set_data(payload, auth_data);
|
||||
*auth_payload = payload;
|
||||
chunk_free(&auth_data);
|
||||
status = SUCCESS;
|
||||
DBG2(DBG_IKE, "successfully signed with RSA private key");
|
||||
}
|
||||
DBG2(DBG_IKE, "successfully signed with RSA private key");
|
||||
else
|
||||
{
|
||||
DBG1(DBG_IKE, "building RSA signature failed");
|
||||
}
|
||||
chunk_free(&octets);
|
||||
private->destroy(private);
|
||||
|
||||
*auth_payload = auth_payload_create();
|
||||
(*auth_payload)->set_auth_method(*auth_payload, AUTH_RSA);
|
||||
(*auth_payload)->set_data(*auth_payload, auth_data);
|
||||
chunk_free(&auth_data);
|
||||
return SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* @file rsa_authenticator.h
|
||||
*
|
||||
* @brief Interface of rsa_authenticator_t.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -18,6 +11,13 @@
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup rsa_authenticator rsa_authenticator
|
||||
* @{ @ingroup authenticators
|
||||
*/
|
||||
|
||||
#ifndef RSA_AUTHENTICATOR_H_
|
||||
@@ -28,13 +28,7 @@ typedef struct rsa_authenticator_t rsa_authenticator_t;
|
||||
#include <sa/authenticators/authenticator.h>
|
||||
|
||||
/**
|
||||
* @brief Implementation of the authenticator_t interface using AUTH_RSA.
|
||||
*
|
||||
* @b Constructors:
|
||||
* - rsa_authenticator_create()
|
||||
* - authenticator_create() using auth_method AUTH_RSA
|
||||
*
|
||||
* @ingroup authenticators
|
||||
* Implementation of the authenticator_t interface using AUTH_RSA.
|
||||
*/
|
||||
struct rsa_authenticator_t {
|
||||
|
||||
@@ -45,13 +39,11 @@ struct rsa_authenticator_t {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates an authenticator for AUTH_RSA.
|
||||
* Creates an authenticator for AUTH_RSA.
|
||||
*
|
||||
* @param ike_sa associated ike_sa
|
||||
* @return rsa_authenticator_t object
|
||||
*
|
||||
* @ingroup authenticators
|
||||
*/
|
||||
rsa_authenticator_t *rsa_authenticator_create(ike_sa_t *ike_sa);
|
||||
|
||||
#endif /* RSA_AUTHENTICATOR_H_ */
|
||||
#endif /* RSA_AUTHENTICATOR_H_ @} */
|
||||
|
||||
Reference in New Issue
Block a user