original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,234 @@
/* 13comp_8021xConfig.cdf - component description file for 802.1X library */
/*
* Copyright 2002-2005, 2006-2007 Wind River Systems, Inc.
* All rights reserved. Provided under license only.
* Distribution or other use of this software is only
* permitted pursuant to the terms of a license agreement
* from Wind River Systems (and is otherwise prohibited).
* Refer to that license agreement for terms of use.
*/
/*
modification history
--------------------
01i,04mar10,hfc fix for WIND00184598
01h,04mar10,kr Remove CCI
01g,04sep09,hfc fix for WIND00179065
01f,04oct07,mze fix for WIND00104829
01e,24aug07,spw Change references of INCLUDE_SSL to INCLUDE_IPSSL
01d,20aug07,spw cdf cleanup
01c,08feb07,dwb Fixed dependecy issue for authenticator component, WIND00087486
01b,04dec06,dwb Fixed typo's introduced by ipradius porting
01a,18oct02,cjl Created
*/
/*
DESCRIPTION
This file contains descriptions for the 802.1X component
*/
#ifdef _WRS_CONFIG_COMPONENT_DOT1X
/* Create the root 802.1X configuration component */
Folder FOLDER_IP8021X_AUTH {
NAME 802.1X Authenticator Components
SYNOPSIS 802.1X Authenticator Components
CHILDREN FOLDER_AUTHENTICATOR_CONFIG \
INCLUDE_MIB_CONFIG
_CHILDREN FOLDER_NET_L5_APPLICATIONS
}
/* Folder for the 802.1X authenticator configuration */
Folder FOLDER_AUTHENTICATOR_CONFIG {
NAME 802.1X Authenticator
SYNOPSIS 802.1X Authenticator Components
CHILDREN INCLUDE_AUTHENTICATOR_CONFIG \
INCLUDE_AUTHENTICATOR_PRIMARY_RADIUS_SERVER \
INCLUDE_AUTHENTICATOR_SECONDARY_RADIUS_SERVER
}
/* Authenticator config component */
Component INCLUDE_AUTHENTICATOR_CONFIG {
NAME 802.1X Authenticator Common configuration
SYNOPSIS 802.1X Authenticator Common authenticator functionality
CONFIGLETTES usrDot1xAuthCfg.c
INIT_RTN usrDot1xAuthInit();
REQUIRES INCLUDE_NETWORK \
INCLUDE_END \
INCLUDE_IPRADIUS \
INCLUDE_AUTHENTICATOR_PRIMARY_RADIUS_SERVER \
INCLUDE_BRIDGE
CFG_PARAMS DOT1X_AUTH_UNCONTROLLED_INTERFACE_NAME \
DOT1X_AUTH_UNCONTROLLED_INTERFACE_NUM \
DOT1X_AUTH_CONTROLLED_INTERFACE_NAME \
DOT1X_AUTH_CONTROLLED_INTERFACE_NUM \
DOT1X_AUTH_OPERATING_MODE \
DOT1X_AUTH_LEGACY_WEP_TYPE
_INIT_ORDER usrNetAppInit
MODULES dot1xAuthLib.o \
dot1xAuthSvrLib.o \
dot1xAuthTimerLib.o \
dot1xKeyLib.o \
dot1xMibLib.o \
dot1xDebugLib.o \
dot1xDesLib.o \
dot1xMdLib.o \
dot1xMemPartLib.o \
dot1xVirtualEnd.o \
dot1xWb4Lib.o \
dot1xEapolLib.o
ARCHIVE libvxdot1x.a
}
/* Authenticator primary RADIUS server configuration */
Component INCLUDE_AUTHENTICATOR_PRIMARY_RADIUS_SERVER {
NAME 802.1X Authenticator Primary RADIUS Server
SYNOPSIS Configuration of primary RADIUS server
REQUIRES INCLUDE_AUTHENTICATOR_CONFIG
CFG_PARAMS DOT1X_AUTH_PRIMARY_RADIUS_SERVER_DOMAIN \
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS \
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS \
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_PORT \
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET
}
/* Authenticator secondary RADIUS server configuration */
Component INCLUDE_AUTHENTICATOR_SECONDARY_RADIUS_SERVER {
NAME 802.1X Authenticator Secondary RADIUS Server
SYNOPSIS Configuration of secondary RADIUS server
REQUIRES INCLUDE_AUTHENTICATOR_CONFIG
CFG_PARAMS DOT1X_AUTH_SECONDARY_RADIUS_SERVER_DOMAIN \
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS \
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS \
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_PORT \
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARED_SECRET
}
/* MIB config component */
Component INCLUDE_MIB_CONFIG {
NAME 802.1X Authenticator MIB configuration
SYNOPSIS 802.1X Authenticator MIB functionality supported
REQUIRES INCLUDE_WINDMANAGE_SNMP_CORE
INIT_RTN dot1xMibAdd();
_INIT_ORDER usrNetAppInit
MODULES snmpDot1x.o
ARCHIVE libvxdot1x.a
}
/* Authenticator configuration parameter settings */
Parameter DOT1X_AUTH_UNCONTROLLED_INTERFACE_NAME {
NAME Name of the uncontrolled interface being used by the Authenticator/Access Point
SYNOPSIS Name of the uncontrolled interface being used by the Authenticator/Access Point
TYPE string
DEFAULT NULL
}
Parameter DOT1X_AUTH_UNCONTROLLED_INTERFACE_NUM {
NAME Index number of the uncontrolled interface being used by the Authenticator/Access Point
SYNOPSIS Index number of the uncontrolled interface being used by the Authenticator/Access Point
TYPE uint
DEFAULT 0
}
Parameter DOT1X_AUTH_CONTROLLED_INTERFACE_NAME {
NAME Name of the controlled interface being used by the Authenticator/Access Point
SYNOPSIS Name of the controlled interface being used by the Authenticator/Access Point
TYPE string
DEFAULT "wls"
}
Parameter DOT1X_AUTH_CONTROLLED_INTERFACE_NUM {
NAME Index number of the controlled interface being used by the Authenticator/Access Point
SYNOPSIS Index number of the controlled interface being used by the Authenticator/Access Point
TYPE uint
DEFAULT 0
}
Parameter DOT1X_AUTH_OPERATING_MODE {
NAME 802.1X Authenticator driver binding type
SYNOPSIS 1 = 802.11 a/b/g driver (Default), 2 = Wireline mode
TYPE uint
DEFAULT 1
}
Parameter DOT1X_AUTH_LEGACY_WEP_TYPE {
NAME WEP Type for Legacy Mode
SYNOPSIS Specifies the WEP key size to be used, when in legacy mode. In WPA/802.11i mode, this setting has no effect. DOT1X_AUTH_40BIT_KEY=1, DOT1X_AUTH_104BIT_KEY=2
TYPE uint
DEFAULT 1
}
Parameter DOT1X_AUTH_PRIMARY_RADIUS_SERVER_DOMAIN {
NAME RADIUS server domain
SYNOPSIS RADIUS server domain (IP_AF_INET,IP_AF_INET6)
TYPE uint
DEFAULT IP_AF_INET
}
Parameter DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS {
NAME RADIUS server IPv4 address
SYNOPSIS RADIUS server IPv4 address
TYPE char *
DEFAULT "10.1.2.1"
}
Parameter DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS {
NAME RADIUS server IPv6 address
SYNOPSIS RADIUS server IPv6 address
TYPE char *
DEFAULT "3ffe:300::5"
}
Parameter DOT1X_AUTH_PRIMARY_RADIUS_SERVER_PORT {
NAME RADIUS server port
SYNOPSIS RADIUS server port in host endian.
TYPE uint
DEFAULT 1812
}
Parameter DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET {
NAME RADIUS server shared secret
SYNOPSIS RADIUS server shared secret
TYPE char *
DEFAULT "kallekula123"
}
Parameter DOT1X_AUTH_SECONDARY_RADIUS_SERVER_DOMAIN {
NAME RADIUS server domain
SYNOPSIS RADIUS server domain (IP_AF_INET, IP_AF_INET6)
TYPE uint
DEFAULT IP_AF_INET
}
Parameter DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS {
NAME RADIUS server IPv4 address
SYNOPSIS RADIUS server IPv4 address
TYPE char *
DEFAULT "10.1.2.1"
}
Parameter DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS {
NAME RADIUS server IPv6 address
SYNOPSIS RADIUS server IPv6 address
TYPE char *
DEFAULT "3ffe:300::5"
}
Parameter DOT1X_AUTH_SECONDARY_RADIUS_SERVER_PORT {
NAME RADIUS server port
SYNOPSIS RADIUS server port in host endian.
TYPE uint
DEFAULT 1812
}
Parameter DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARED_SECRET {
NAME RADIUS server shared secret
SYNOPSIS RADIUS server shared secret
TYPE char *
DEFAULT "kallekula123"
}
#endif
@@ -0,0 +1,11 @@
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: common.vxconfig,v $ $Revision: 1.5 $
# $Source: /home/interpeak/CVSRoot/vxdot1x/config/common.vxconfig,v $
# $Author: myakan $
# $State: Exp $ $Locker: $
#
# INTERPEAK_COPYRIGHT_STRING
#hidden option that enables DOT1X
config SUPPORTS_DOT1X
bool
default y
@@ -0,0 +1,6 @@
config COMPONENT_USR_DOT1X
bool "Build USR libraries for DOT1X"
default y if COMPONENT_DOT1X
depends on MSP_KERNEL && FEATURE_USR
help
This component will build the user libraries for the DOT1X component
@@ -0,0 +1,413 @@
/* usrDot1xAuthCfg.c - Initialize 802.1X authenticator */
/* Copyright 2002-2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
-------------------
02j,04sep09,hfc fix for WIND00179065
02i,06aug08,dwb Fix for defect WIND00128956. Fix Record WIND00130183.
02h,04dec06,dwb Cleanup from the ipradius port
02g,31oct06,dwb Removing call to wr sntp library
02f,04apr06,rb Fix for SPR 116532 - Legacy 802.1X does not work with unicast
keys
02e,26sep05,eja remove MIB binding if MIB support not required
02d,23sep05,eja Break SNMP dependency
02c,31may05,eja Fix for B0399
02b,30may05,eja change config elements to reflect updated header file
02a,20may05,eja Fix compiler warnings
01z,13may05,eja Remove dependency on wlanConfig()
01y,12may05,rb Added support for 104 bit WEP keys
01x,10may05,eja Remove depenedencies on eapol lib, mempart lib, and mib lib
01w,05may05,eja Fix BO304 - diab warnings
01v,03mar05,eja Fix EAPOL call to reflect changed API
01u,17feb05,eja Add memPartLinInit call to set up memory partition
01t,04feb05,eja Added 80211i/WPA integration functionality
01s,31jan05,eja Change Macro names
01r,17jan05,eja Make changes to support wireline mode
01q,15oct04,dxb Added check for empty wireless I/F parameter
01p,01oct04,eja Change default values to support Atheros driver
01o,07aug04,rb Added support for "Driver Type" parameter to ensure
operation with 2.0 wireless driver
01n,11sep03,ggg Correct output, add '\0' to NULL as bridge disabling
01m,10sep03,ggg Allow NULL as wired interface name
01l,09sep03,ggg Add default macro defs for command line builds
01k,21aug03,ggg Updated routine name
01j,08aug03,ggg Remove RADIUS client parameters and initialization
01i,07may03,ss renamed params
01h,21apr03,ggg File name, location change
01g,21feb03,ggg Update copyright dates
01f,22jan03,ggg Add key slot initializations for more new usage
01e,25jun02,ggg Add callback install
01d,18jun02,ggg Reduce number of arguments to usrDot1xInit routine
01c,11jun02,ggg Remove use of subENDs
01b,11jun02,ggg dot1xEapolInit parameter addition
01a,02jun02,ggg Written
*/
/*
This module provides initialization of 802.1X authenticator.
*/
#include <vxWorks.h>
#include <stdio.h>
#include "wrn/dot1x/dot1xAuthLib.h"
#include "wrn/dot1x/dot1xAuthSvrLib.h"
#include "wrn/dot1x/dot1xMibLib.h"
#include "wrn/dot1x/dot1xEapolLib.h"
#include "wrn/dot1x/dot1xMemPartLib.h"
#include "wrn/dot1x/dot1xDebugLib.h"
#include <../../ipsntp/config/ipsntp_config.h>
#include <../../ipsntp/include/ipsntp.h>
/* Make sure we have at least one type of network support */
#if !defined(IPCOM_USE_INET) && !defined(IPCOM_USE_INET6)
#error "Must define at least IPCOM_USE_INET or IPCOM_USE_INET6"
#endif
/* Default debug levels */
#ifndef DOT1X_DEBUG_AREA
#define DOT1X_DEBUG_AREA DOT1X_AREA_ALL
#endif
#define DOT1X_AUTH_MODE_WIRELESS 1
#define DOT1X_AUTH_MODE_WIRELINE 2
/* Defined so non-project command line builds are OK */
#ifndef DOT1X_AUTH_UNCONTROLLED_INTERFACE_NAME
#define DOT1X_AUTH_UNCONTROLLED_INTERFACE_NAME "motfcc"
#endif /* DOT1X_AUTH_UNCONTROLLED_INTERFACE_NAME */
#ifndef DOT1X_AUTH_UNCONTROLLED_INTERFACE_NUM
#define DOT1X_AUTH_UNCONTROLLED_INTERFACE_NUM 0
#endif /* DOT1X_AUTH_UNCONTROLLED_INTERFACE_NUM */
/* Defined so non-project command line builds are OK */
#ifndef DOT1X_AUTH_CONTROLLED_INTERFACE_NAME
#define DOT1X_AUTH_CONTROLLED_INTERFACE_NAME "wls"
#endif /* DOT1X_AUTH_CONTROLLED_INTERFACE_NAME */
#ifndef DOT1X_AUTH_CONTROLLED_INTERFACE_NUM
#define DOT1X_AUTH_CONTROLLED_INTERFACE_NUM 0
#endif /* DOT1X_AUTH_WIRED_DOT1X_INTERFACE_NUM */
#ifndef DOT1X_AUTH_OPERATING_MODE
#define DOT1X_AUTH_OPERATING_MODE DOT1X_AUTH_MODE_WIRELESS
#endif /* DOT1X_AUTH_OPERATING_MODE */
#ifndef DOT1X_AUTH_LEGACY_WEP_TYPE
#define DOT1X_AUTH_LEGACY_WEP_TYPE 1
#endif /* DOT1X_AUTH_OPERATING_MODE */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_SERVER_DOMAIN
#define DOT1X_AUTH_PRIMARY_RADIUS_SERVER_DOMAIN 2
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_SERVER_DOMAIN */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS
#define DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS "10.1.1.1"
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS
#define DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS "3ffe:300::5"
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET
#define DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET "secret"
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_SERVER_PORT
#define DOT1X_AUTH_PRIMARY_RADIUS_SERVER_PORT 1812
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_SERVER_PORT */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_RETRY_COUNT
#define DOT1X_AUTH_PRIMARY_RADIUS_RETRY_COUNT 1
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_RETRY_COUNT */
#ifndef DOT1X_AUTH_PRIMARY_RADIUS_TIMEOUT
#define DOT1X_AUTH_PRIMARY_RADIUS_TIMEOUT 10
#endif /* DOT1X_AUTH_PRIMARY_RADIUS_TIMEOUT */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_SERVER_DOMAIN
#define DOT1X_AUTH_SECONDARY_RADIUS_SERVER_DOMAIN 2
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_SERVER_DOMAIN */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS
#define DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS "10.1.2.1"
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS
#define DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS "3ffe:300::5"
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARED_SECRET
#define DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARED_SECRET "kallekula123"
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARE_SECRET */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_SERVER_PORT
#define DOT1X_AUTH_SECONDARY_RADIUS_SERVER_PORT 1812
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_SERVER_PORT */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_RETRY_COUNT
#define DOT1X_AUTH_SECONDARY_RADIUS_RETRY_COUNT 3
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_RETRY_COUNT */
#ifndef DOT1X_AUTH_SECONDARY_RADIUS_TIMEOUT
#define DOT1X_AUTH_SECONDARY_RADIUS_TIMEOUT 3
#endif /* DOT1X_AUTH_SECONDARY_RADIUS_TIMEOUT */
/* Define the number of servers */
#ifdef INCLUDE_AUTHENTICATOR_SECONDARY_RADIUS_SERVER
#define DOT1X_AUTH_NUM_SERVERS 2
#else
#define DOT1X_AUTH_NUM_SERVERS 1
#endif
/* RADIUS Server Info */
LOCAL DOT1X_AUTH_RADIUS_SERVER_INFO dot1xAuthServerInfo[DOT1X_AUTH_NUM_SERVERS];
/* Public function */
STATUS usrDot1xAuthInit(void);
STATUS usrDot1xAuthCfg
(
INT8 * networkPortIfName, /* network port interface name */
INT32 networkPortUnitNumber, /* network port unit number */
INT8 * dot1xPortIfName, /* 802.1X port interface name */
INT32 dot1xPortUnitNumber, /* 802.1X port unit number */
INT32 mode /* Mode of operation (i.e. wireline or wlan) */
);
/* Mib module binding */
#ifdef INCLUDE_MIB_CONFIG
LOCAL DOT1X_MIB_MODULE_BINDING dot1xAuthMibModule;
#endif
LOCAL DOT1X_MIB_MODULE_BINDING * pDot1xAuthMibModule = NULL;
/*****************************************************************************
* usrDot1xAuthCfg - start up the 802.1X authenticator
*
* This routine calls the autheticator configuration function with the
* above defined parameters.
*
* RETURNS: Status of the subsequent call to the callee
*/
STATUS usrDot1xAuthInit(void)
{
/* Configure the authenticator */
return(usrDot1xAuthCfg((INT8*)DOT1X_AUTH_UNCONTROLLED_INTERFACE_NAME,
(INT32)DOT1X_AUTH_UNCONTROLLED_INTERFACE_NUM,
(INT8*)DOT1X_AUTH_CONTROLLED_INTERFACE_NAME,
(INT32)DOT1X_AUTH_CONTROLLED_INTERFACE_NUM,
(INT32)DOT1X_AUTH_OPERATING_MODE));
}
/*****************************************************************************
* usrDot1xAuthCfg - start up the 802.1X authenticator and all dependent
* components.
*
* This routine sets up the basic runtime configuration parameters and brings
* up all of the components on which it depends in order to start up the
* 802.1X autheticator. If and error condition occurs during this call then
* a message indicating which error condition happened to the console and
* then aborts the call returning ERROR to the callee.
*
* RETURNS: OK or ERROR
*/
STATUS usrDot1xAuthCfg
(
INT8 *networkPortIfName, /* network port interface name */
INT32 networkPortUnitNumber, /* network port unit number */
INT8 *dot1xPortIfName, /* 802.1X port interface name */
INT32 dot1xPortUnitNumber, /* 802.1X port unit number */
INT32 mode /* Operating mode (i.e. wireline or wlan) */
)
{
DOT1X_AUTH_SYS_CONFIG authConfig; /* Authenticator config structure */
DOT1X_AUTH_IF_CONFIG ifConfig; /* Controlled port configuration */
INT8 networkPortName[20]; /* network port interface name */
INT8 dot1xPortName[20]; /* 802.1X port interface name */
#ifdef INCLUDE_MIB_CONFIG
dot1xAuthMibModule.pInstallHandler = (void*)dot1xMibHandlerInstall;
dot1xAuthMibModule.pRemoveHandler = (void*)dot1xMibHandlerRemove;
pDot1xAuthMibModule = &dot1xAuthMibModule;
#endif
/* Get current network port IP address, based on the interface
name and unit number */
(VOID)sprintf((char*)networkPortName,
"%s%d",
(int)networkPortIfName,
networkPortUnitNumber);
/* Get current 802.1X port IP address, based on the interface
name and unit number */
(VOID)sprintf((char*)dot1xPortName,
"%s%d",
(int)dot1xPortIfName,
dot1xPortUnitNumber);
/* Display some of the Show what is happening */
printf("\nInitializing 802.1X-enabled mode\n");
printf("Network Port Interface name :%s\n", networkPortName);
printf("802.1X Port Interface name :%s\n", dot1xPortName);
printf("Bridging between :%s and %s\n\n",
networkPortName, dot1xPortName);
/* Create Framework configuration */
authConfig.taskPriority = 80;
authConfig.nbrOfPorts = 10;
authConfig.eapolAsfAlert = NULL;
authConfig.replayCntType = 1;
authConfig.ntpExecMode = 0;
authConfig.ntpSvrIpAddr = NULL;
authConfig.ntpTimeGetFunc = NULL;
authConfig.pMib = pDot1xAuthMibModule;
/* Populate the primary server info */
dot1xAuthServerInfo[0].domain = DOT1X_AUTH_PRIMARY_RADIUS_SERVER_DOMAIN;
dot1xAuthServerInfo[0].port = DOT1X_AUTH_PRIMARY_RADIUS_SERVER_PORT;
#ifdef IPCOM_USE_INET
if(dot1xAuthServerInfo[0].domain == IP_AF_INET)
{
if((dot1xAuthServerInfo[0].server_addr = (char *)
malloc(strlen(DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS))) == NULL)
{
printf("usrDot1xAuthCfg - Error initializing authentication server"
" library, malloc failed\n");
return(ERROR);
}
strcpy(dot1xAuthServerInfo[0].server_addr,
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV4_ADDRESS);
}
#endif
#ifdef IPCOM_USE_INET6
else if(dot1xAuthServerInfo[0].domain == IP_AF_INET6)
{
if((dot1xAuthServerInfo[0].server_addr = (char *)
malloc(strlen(DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS))) == NULL)
{
printf("usrDot1xAuthCfg - Error initializing authentication server"
" library, malloc failed\n");
return(ERROR);
}
strcpy(dot1xAuthServerInfo[0].server_addr,
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_IPV6_ADDRESS);
}
#endif
else
printf("usrDot1xAuthCfg - Error initializing authentication server"
" library, invalid domain %d\n",dot1xAuthServerInfo[0].domain);
if((dot1xAuthServerInfo[0].shared_secret = (char *)
malloc(strlen(DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET)))
== NULL)
{
printf("usrDot1xAuthCfg - Error initializing authentication server"
" library, malloc failed\n");
return(ERROR);
}
strcpy(dot1xAuthServerInfo[0].shared_secret,
DOT1X_AUTH_PRIMARY_RADIUS_SERVER_SHARED_SECRET);
dot1xAuthServerInfo[0].retry_count = DOT1X_AUTH_PRIMARY_RADIUS_RETRY_COUNT;
dot1xAuthServerInfo[0].timeout = DOT1X_AUTH_PRIMARY_RADIUS_TIMEOUT;
#ifdef INCLUDE_AUTHENTICATOR_SECONDARY_RADIUS_SERVER
dot1xAuthServerInfo[0].endTag = DOT1X_AUTH_TAG_MORE_SERVERS;
#else
dot1xAuthServerInfo[0].endTag = DOT1X_AUTH_TAG_LAST_SERVER;
#endif
#ifdef INCLUDE_AUTHENTICATOR_SECONDARY_RADIUS_SERVER
/* Populate the secondary server info */
dot1xAuthServerInfo[1].domain = DOT1X_AUTH_SECONDARY_RADIUS_SERVER_DOMAIN;
dot1xAuthServerInfo[1].port = DOT1X_AUTH_SECONDARY_RADIUS_SERVER_PORT;
#ifdef IPCOM_USE_INET
if(dot1xAuthServerInfo[1].domain == IP_AF_INET)
{
dot1xAuthServerInfo[1].server_addr = (char *)
malloc(strlen(DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS));
strcpy(dot1xAuthServerInfo[1].server_addr,
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV4_ADDRESS);
}
#endif
#ifdef IPCOM_USE_INET6
else if(dot1xAuthServerInfo[1].domain == IP_AF_INET6)
{
dot1xAuthServerInfo[1].server_addr = (char *)
malloc(strlen(DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS));
strcpy(dot1xAuthServerInfo[1].server_addr,
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_IPV6_ADDRESS);
}
#endif
else
printf("usrDot1xAuthCfg - Error initializing authentication server"
" library, invalid domain %d\n",dot1xAuthServerInfo[0].domain);
dot1xAuthServerInfo[1].shared_secret = (char *)
malloc(strlen(DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARED_SECRET));
strcpy(dot1xAuthServerInfo[1].shared_secret,
DOT1X_AUTH_SECONDARY_RADIUS_SERVER_SHARED_SECRET);
dot1xAuthServerInfo[1].retry_count = DOT1X_AUTH_SECONDARY_RADIUS_RETRY_COUNT;
dot1xAuthServerInfo[1].timeout = DOT1X_AUTH_SECONDARY_RADIUS_TIMEOUT;
dot1xAuthServerInfo[1].endTag = DOT1X_AUTH_TAG_LAST_SERVER;
#endif
/* Initialize the authentication server library */
if(dot1xAuthServerLibInit(dot1xAuthServerInfo) == ERROR)
{
printf("usrDot1xAuthCfg - Error initializing authentication server"
" library, dot1xAuthServerLibInit failed\n");
return(ERROR);
}
/* Initialize the backend authentication library */
if(dot1xAuthInit(&authConfig) == ERROR)
{
printf("usrDot1xAuthCfg - Error initializing authentication"
" library\n");
return(ERROR);
}
/* Create interface configuration */
switch(mode)
{
case DOT1X_AUTH_MODE_WIRELINE:
ifConfig.type = DOT1X_AUTH_WIRED_IF;
break;
case DOT1X_AUTH_MODE_WIRELESS:
default:
ifConfig.type = DOT1X_AUTH_WIRELESS_IF;
ifConfig.wepKeyType = (DOT1X_AUTH_WEP_KEY_TYPE) DOT1X_AUTH_LEGACY_WEP_TYPE;
break;
}
/* Standard configuration */
ifConfig.operationType = DOT1X_AUTH_WIRELESS;
ifConfig.inactivityTimeout = 600;
ifConfig.connectivityTimeout = 300;
ifConfig.mcastKeyPeriod = 300;
ifConfig.ucastKeySupportType = DOT1X_AUTH_REAL_UCAST_KEY;
ifConfig.ucastKeyIsSessionKey = FALSE;
ifConfig.staticWepKeySupport = FALSE;
ifConfig.staticWepKey = NULL;
ifConfig.ucastKeyPeriod = 300;
ifConfig.ucastKeySlots = (1<<0);
ifConfig.mcastKeySlots = (1<<3) | (1<<2) | (1<<1);
/* Attach the framework to the 802.1X interface (i.e. controlled port) */
if(dot1xAuthAttach((INT32)dot1xPortUnitNumber, (UCHAR*)dot1xPortIfName,
(DOT1X_AUTH_IF_CONFIG*)&ifConfig) == ERROR)
{
printf("usrDot1xAuthCfg - Error attaching to 802.1X authenticator\n");
return(ERROR);
}
/* Success */
return(OK);
}
@@ -0,0 +1,13 @@
IPTARGETS := lib
ifneq ($(IPMAKEFILE),)
include $(IPMAKEFILE)
else
include $(IPCOM_ROOT)/Makefile
endif
include vxdot1x.mk
include $(IPCOM_ROOT)/gmake/ipcom_make.mk
lib: dirs $(IPLIBFILE)
@@ -0,0 +1,86 @@
#############################################################################
# VXNETAPPS.MK
#
# Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: vxdot1x.mk,v $ $Revision: 1.1.1.1 $
# $Source: /home/interpeak/CVSRoot/vxdot1x/gmake/vxdot1x.mk,v $
# $Author: dbush $ $Date: 2009-06-11 20:13:47 $
# $State: Exp $ $Locker: $
#
# INTERPEAK_COPYRIGHT_STRING
#
#############################################################################
#############################################################################
# PRODUCT
###########################################################################
IPPROD ?= vxdot1x
#############################################################################
# DEFINE
###########################################################################
IPDEFINE += -DVXDOT1X
#############################################################################
# INCLUDE
###########################################################################
IPINCLUDE += -I$(VXDOT1X_ROOT)/config
IPINCLUDE += -I$(VXDOT1X_ROOT)/include
#############################################################################
# OBJECTS
###########################################################################
# Configuration
# Main
IPLIBOBJECTS += dot1xAuthLib.o
IPLIBOBJECTS += dot1xAuthSvrLib.o
IPLIBOBJECTS += dot1xAuthTimerLib.o
IPLIBOBJECTS += dot1xKeyLib.o
IPLIBOBJECTS += dot1xMibLib.o
IPLIBOBJECTS += dot1xDebugLib.o
IPLIBOBJECTS += dot1xDesLib.o
IPLIBOBJECTS += dot1xMdLib.o
IPLIBOBJECTS += dot1xMemPartLib.o
IPLIBOBJECTS += dot1xVirtualEnd.o
IPLIBOBJECTS += dot1xWb4Lib.o
IPLIBOBJECTS += dot1xEapolLib.o
IPLIBOBJECTS += snmpDot1x.o
#############################################################################
# VPATH
###########################################################################
IPSRCDIRS += $(VXDOT1X_ROOT)/src/authenticator
IPSRCDIRS += $(VXDOT1X_ROOT)/src/common
IPSRCDIRS += $(VXDOT1X_ROOT)/src/eapol
IPSRCDIRS += $(VXDOT1X_ROOT)/src/management
TGT_DIR=$(WIND_BASE)/target
#DOC_FILES= bridge.c mirrorEnd.c mirrorUtils.c
ifeq ($(IP_PORT_VXWORKS),)
WR_IPCOM_NAME := vxworks
WR_IPCOM_VERSION := $(filter-out $(WR_IPCOM_NAME), $(subst -, ,$(WIND_PLATFORM)))
WR_IPCOM_VERSION := $(subst .,,$(WR_IPCOM_VERSION))
EXTRA_DEFINE += -DIP_PORT_VXWORKS=$(WR_IPCOM_VERSION)
endif
IPNET_ROOT_PATH := $(subst \,/,$(WRVX_COMPBASE))/$(subst \,/,$(COMP_IPNET2))
INCLUDE_CC += -I$(IPNET_ROOT_PATH)/ipnet2/include
INCLUDE_CC += -I$(IPNET_ROOT_PATH)/ipnet2/config
INCLUDE_CC += -I$(IPNET_ROOT_PATH)/ipcom/port/vxworks/include
INCLUDE_CC += -I$(IPNET_ROOT_PATH)/ipcom/port/vxworks/config
INCLUDE_CC += -I$(IPNET_ROOT_PATH)/ipcom/include
INCLUDE_CC += -I$(IPNET_ROOT_PATH)/ipcom/config
#############################################################################
# LIB
###########################################################################
IPLIBS += $(IPLIBROOT)/libvxdot1x.a
###########################################################################
# END BRIDGE.MK
###########################################################################
@@ -0,0 +1,180 @@
/* dot1xAuthLib.h - 802.1X Authenticator Definitions */
/* Copyright 2002-2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01t,05apr10,kxr Coverity: VOID to void
01s,12feb07,spw Bump version
01r,07sep06,tfo Bump version to 2.3.2.
01r,29sep06,dwb Bumping version numbers for fall06 release
01q,13apr06,rb Update version numbers for Spring06 (SPR 120179)
01p,23sep05,eja Break SNMP dependency
01o,05aug05,eja Version 2.1 update
01n,30may05,eja cleanup
01m,17may05,eja Clean up header dependencies
01l,04feb05,eja 80211i/WPA integration
01k,17jan05,eja Add mode element to PAE object
01j,03jan05,eja Cleanup
01i,30apr03,ss added version info
01h,21apr03,ggg File name, location change
01g,21feb03,ggg Update copyright dates
01f,22jan03,ggg Add key slots ifConfig members
01e,31oct02,ggg Remove warning
01d,13may02,mef to clean-up the code
01c,25mar02,mef to add more configure option to interface
01b,04mar02,mef to add interface configuration structure
01a,26Dec01,mef written.
*/
/*
DESCRIPTION
This file contains the definitions that are used by different
components of the system to interact with 802.1X Framework.
*/
#ifndef __INCdot1xAuthLibh
#define __INCdot1xAuthLibh
#ifdef __cplusplus
extern "C" {
#endif
#include <vxWorks.h>
#define DOT1X_AUTH_VERSION "2.4"
IMPORT UCHAR *dot1xAuthVersion;
/* typedefs */
/* Result code types used between 802.1X SNMP MIB
* support and 1X Framework.
*/
typedef enum
{
DOT1X_AUTH_MIB_SET_DONE,
DOT1X_AUTH_MIB_SET_WAIT,
DOT1X_AUTH_MIB_SET_ERROR
} DOT1X_AUTH_MIB_SET_STATUS;
/* Physical Network Interface Type */
typedef enum
{
DOT1X_AUTH_WIRED_IF = 1,
DOT1X_AUTH_WIRELESS_IF
} DOT1X_AUTH_IF_TYPE;
/* Interface Operation Type */
typedef enum
{
DOT1X_AUTH_WIRELESS = 1,
DOT1X_AUTH_MULTIPLE_HOST,
DOT1X_AUTH_SINGLE_HOST
} DOT1X_AUTH_IF_OPR_TYPE;
/* WEP Key Types */
typedef enum
{
DOT1X_AUTH_40BIT_KEY = 1,
DOT1X_AUTH_128BIT_KEY
} DOT1X_AUTH_WEP_KEY_TYPE;
/* UCAST Key Support Types */
typedef enum
{
DOT1X_AUTH_NO_UCAST_KEY = 1,
DOT1X_AUTH_FAKE_UCAST_KEY,
DOT1X_AUTH_REAL_UCAST_KEY
} DOT1X_AUTH_UCAST_SUPPORT;
typedef struct
{
/* Interface Type */
DOT1X_AUTH_IF_TYPE type;
/* Interface operation type. If interface is "WIRELESS", it must be
* "WIRELESS". If interface is "WIRED", all three possible values can
* be used. */
DOT1X_AUTH_IF_OPR_TYPE operationType;
/* Inactivity Timeout for a port. (second) */
int inactivityTimeout;
/* Connectivity Timeout for a port.(second) */
int connectivityTimeout;
/* Following configuration fields are usable only for "WIRELESS"
* interfaces. */
/* WEP Key Length */
DOT1X_AUTH_WEP_KEY_TYPE wepKeyType;
/* Interface uses slot 0 as static WEP key. It may be used to support
* MD5 supplicants. In that case 1X AUTH will only renew MCAST key in
* slot 1. */
BOOL staticWepKeySupport;
/* If the static WEP key will be supported, the key info must be
*provided. */
char *staticWepKey;
/* Renewal Timeout for MCAST Key. (second) */
int mcastKeyPeriod;
/* UCAST Key support*/
DOT1X_AUTH_UCAST_SUPPORT ucastKeySupportType;
/* Use session key as UCAST key or generate UCAST key and deliver it. */
BOOL ucastKeyIsSessionKey;
/* Renewal Timeout in for UCAST Key. (second) */
int ucastKeyPeriod;
/* Slots used for uCast */
UINT32 ucastKeySlots;
/* Slots uses for mCast */
UINT32 mcastKeySlots;
} DOT1X_AUTH_IF_CONFIG;
typedef struct
{
UINT32 taskPriority; /* 1X AUTH Task Priority*/
UINT32 nbrOfPorts; /* number of estimated active ports at a moment */
FUNCPTR eapolAsfAlert; /* pointer to the EAPOL_ASF_ALERT messages */
int replayCntType; /* Replay Cnt Type in EAPOL-Key message */
int ntpExecMode;
char * ntpSvrIpAddr; /* NTP Sever IP Address */
UINT16 ntpPort; /* NTP Port */
FUNCPTR ntpTimeGetFunc;
void * pMib;
} DOT1X_AUTH_SYS_CONFIG;
/* definitions */
#define DOT1X_AUTH_INVALID_PORT_NBR 0
/* Function Prototypes */
IMPORT STATUS dot1xAuthInit (DOT1X_AUTH_SYS_CONFIG *);
STATUS dot1xAuthPortListShow(int);
IMPORT STATUS dot1xAuthShutdown(void);
IMPORT STATUS dot1xAuthAttach(INT32, UCHAR *, DOT1X_AUTH_IF_CONFIG *);
IMPORT STATUS dot1xAuthDetach(INT32, UCHAR *);
IMPORT STATUS dot1xAuthTimerTimeoutSend (UINT32, int, UINT8);
IMPORT DOT1X_AUTH_MIB_SET_STATUS dot1xAuthMibSet(UINT32, INT32, VOID *,
UINT32, FUNCPTR, INT32);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xAuthLibh */
@@ -0,0 +1,115 @@
/* dot1xAuthSvrLib.h - IEEE 802.1X Authetication Server interface file*/
/* Copyright 2002-2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01e,04dec06,dwb Cleanup from ipradius port
01d,28nov06,dwb More changes for porting to ipradius
01c,21nov06,dwb Changes for ipnet porting
01b,21apr03,ggg File name, location change
01a,08Feb02,myz written
*/
#ifndef __INCdot1xAuthSvrLibh
#define __INCdot1xAuthSvrLibh
#ifdef __cplusplus
extern "C" {
#endif
#define DOT1X_AS_NORMAL_SHUTDOWN 0 /* Library shutdown type, normal shutdown*/
#define DOT1X_AS_FORCE_SHUTDOWN 1 /* Library shutdown type, forced shutdown*/
#define DOT1X_AS_STATION_ID_LEN 6 /* attribute station ID length */
#define DOT1X_AS_WIRELESS_PORT_TYPE 19 /* wireless port type */
#define DOT1X_AS_ETHERNET_PORT_TYPE 15 /* ethernet port type */
#define DOT1X_AS_SESSION_SEND_KEY 1 /* key type, session send key */
#define DOT1X_AS_SESSION_RCEV_KEY 2 /* key type, session receive key */
/* Result codes of the authentication server interface */
enum DOT1X_AS_CODE {
DOT1X_AS_ACCESS_ACCEPT = 1, /* access accept code */
DOT1X_AS_ACCESS_REJECT, /* access reject code */
DOT1X_AS_ACCOUNTING_RESPONSE, /* accounting response code */
DOT1X_AS_ACCESS_CHALLENGE, /* access challenge code */
DOT1X_AS_SESSION_KEY, /* session key received code */
DOT1X_AS_GEN_ERROR, /* general error code */
DOT1X_AS_RETRY_LIMIT_REACHED, /* server retry limit reached code */
DOT1X_AS_ACCESS_CANCELLED, /* radius server shut down */
DOT1X_AS_ACCESS_TIMEOUT /* radius server timeout */
};
/*** typedefs ***/
/* attribute header structure, attributes deliverd to user */
typedef struct {
UINT16 type; /* what type of attribute */
UINT16 len; /* length of the attribute, excluding header */
} DOT1X_AS_ATTR_HEADER_T;
#define DOT1X_AS_ATTR_HEADER_LEN (sizeof(DOT1X_AS_ATTR_HEADER_T))
/* The required user supplied info for sending the EAP packet */
typedef struct {
FUNCPTR pUserCallback; /* routine called when reply comes back */
int mtu; /* MTU Max Tranmission Unit */
char * pId; /* User Identification */
int len; /* length of the User Identification */
char callingId[DOT1X_AS_STATION_ID_LEN]; /* source MAC address */
char calledId [DOT1X_AS_STATION_ID_LEN]; /* Port MAC address */
UINT8 * pState; /* State attribute if there is one */
int sLen; /* length of the previous field */
int portType; /* port type */
} DOT1X_AS_REQUIRED_INFO;
/* Radius server information */
#define DOT1X_AUTH_MAX_RADIUS_SERVERS 2
#define DOT1X_AUTH_TAG_LAST_SERVER 0
#define DOT1X_AUTH_TAG_MORE_SERVERS 1
typedef struct {
int domain;
UINT16 port;
char *server_addr;
char *shared_secret;
int password_type;
UINT16 retry_count;
UINT16 timeout;
UINT8 endTag;
} DOT1X_AUTH_RADIUS_SERVER_INFO;
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS dot1xAuthServerEapMsgSend (UINT32 msgHandle, UINT8 * pMsg,
int len,
DOT1X_AS_REQUIRED_INFO * pInfo);
extern STATUS dot1xAuthServerLibInit (
DOT1X_AUTH_RADIUS_SERVER_INFO *serverInfo);
extern STATUS dot1xAuthServerLibRadiusServerSet(
DOT1X_AUTH_RADIUS_SERVER_INFO *serverInfo);
extern STATUS dot1xAuthServerLibShutDown (int);
#else
extern STATUS dot1xAuthServerEapMsgSend();
extern STATUS dot1xAuthServerLibRadiusServerSet(
DOT1X_AUTH_RADIUS_SERVER_INFO *serverInfo);
extern STATUS dot1xAuthServerLibInit ();
STATUS dot1xAuthServerLibShutDown ();
#endif
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xAuthSvrLibh */
@@ -0,0 +1,61 @@
/* dot1xAuthTimerLib.h - 802.1X Authenticator Timer Manager Definitions */
/* Copyright 2002-2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01c,21apr03,ggg File name, location change
01b,13may02,mef to clean up the code.
01a,26Dec01,mef written.
*/
/*
DESCRIPTION
*/
#ifndef __INCdot1xAuthTimerLibh
#define __INCdot1xAuthTimerLibh
#ifdef __cplusplus
extern "C" {
#endif
#include "vxWorks.h"
/* typedefs */
typedef enum /* DOT1X Timer Types */
/* For detailed Information
check standard pg.34
*/
{
DOT1X_AUTH_TIMER_AWHILE, /* aWhile Timer */
DOT1X_AUTH_TIMER_QUIETWHILE, /* quietWhile Timer */
DOT1X_AUTH_TIMER_REAUTHWHEN, /* reAuthWhen Timer */
DOT1X_AUTH_TIMER_TXWHEN, /* txWhen Timer */
DOT1X_AUTH_TIMER_INTERNAL /* 1x Auth Internal Timer */
} DOT1X_AUTH_TIMER_TYPE;
/* definitions */
#define DOT1X_AUTH_TIMER_NBR 5 /* # of timers */
/* Function Prototypes */
IMPORT int dot1xAuthTimerManagerInit (INT32);
IMPORT UINT32 dot1xAuthTimerTickGet ();
IMPORT STATUS dot1xAuthTimerManagerShutdown ();
IMPORT STATUS dot1xAuthTimerStart (UINT32, DOT1X_AUTH_TIMER_TYPE, UINT16, UINT8);
IMPORT STATUS dot1xAuthTimerStop (UINT32, DOT1X_AUTH_TIMER_TYPE, UINT8);
IMPORT STATUS dot1xAuthTimerStopAll (UINT32);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xAuthTimerLibh */
@@ -0,0 +1,241 @@
/* dot1xCommonIoctls.h - 802.1X required shadow ioctls */
/* Copyright 2002-2004 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01n,06jun08,mry Adding events for MIC ERROR notification from driver
01m,20mar08,mry Removing old supplicant IOCTLs
01l,31oct07,mry Fix for WIND00109746
01k,09feb06,rb Added mSSID compatibility
01j,31aug05,eja Fix for trace bug B0086
01i,17may05,eja Add API
01h,10may05,eja Add user mode ioctls
01g,20apr05,eja Add Base6.1 ioctls
01f,01mar05,rb Modified definitions of WIOCSDOT1XPORTSTATUS and
WIOCSAUTHCALLBACK
01e,23feb05,rb Updated to new IOCTL scheme for WED 2.1
01d,04feb05,eja 80211i/WPA integration
01c,18jan05,eja Add structure and enums for 802.11i integration
01b,11jan05,rb Pruned IOCTL list for new integration with wireless driver
01a,10jan05,rb Added new IOCTLs for 2.0 release
*/
/*
DESCRIPTION
*/
#ifndef __INCdot1xCommonIoctlsh
#define __INCdot1xCommonIoctlsh
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* Public DOT11 IOCTL Commands
*****************************************************************************/
#include "sys/ioctl.h"
/* For backwards compatability, define the "user mode" IOCTL macros manually
if they are not already defined. They should be defined in vxWorks 6.1 and
higher */
#ifndef IOC_USER
#define IOC_USER 0x8000
#endif /* IOC_USER */
#ifndef _IOU
#define _IOU(x,y) (IOC_USER | _IO(x,y))
#endif
#ifndef _IORU
#define _IORU(x,y,t) (IOC_USER | _IOR(x,y,t))
#endif
#ifndef _IOWU
#define _IOWU(x,y,t) (IOC_USER | _IOW(x,y,t))
#endif
#ifndef _IOWRU
#define _IOWRU(x,y,t) (IOC_USER | _IOWR(x,y,t))
#endif
/* These are types used to define the access lengths in the "WIOC" IOCTLS */
#define DOT11_ADDR_LEN 6
typedef UINT8 DOT11_ADDR[DOT11_ADDR_LEN];
#define DOT11_PMK_LEN 32
typedef UINT8 DOT11_PMK[DOT11_PMK_LEN];
/* 802.1X port status enumeration */
typedef enum
{
DOT1X_PORTSTATUS_UNCONTROLLED = 0,
DOT1X_PORTSTATUS_CLOSED,
DOT1X_PORTSTATUS_OPEN
} DOT1X_PORT_STATUS;
/* 802.1X port event type enumeration */
typedef enum
{
DOT1X_PORTEVENT_ASSOCIATION = 1,
DOT1X_PORTEVENT_DISASSOCIATION,
DOT1X_MICERR_EVENT_PAIR,
DOT1X_MICERR_EVENT_GROUP
} DOT1X_PORT_EVENT;
typedef struct
{
INT32 status; /* Port status */
UINT8 macAddr[6]; /* mac address of the port */
} _WRS_PACK_ALIGN(1) DOT1X_PORTSTATUS;
typedef struct param_s
{
UINT32 callback; /* Callback event handler */
UINT32 cookie; /* private data */
} _WRS_PACK_ALIGN(1) DOT1X_PARAMS;
typedef struct dot1xIntegration
{
UINT8 * pSuppAddr;
int cmd;
caddr_t data;
} DOT11_DOT1X_INT;
/***************************************************************************
* WIOCSCIPHPOL - Set the available cipher suites
****************************************************************************/
typedef unsigned long int DOT11_KEY_TYPE;
#define DOT11_KEY_SEARCH (65536)
#define DOT11_CIPHPOL_NONE 0
#define DOT11_CIPHPOL_WEP40 (0x01)
#define DOT11_CIPHPOL_WEP104 (0x02)
#define DOT11_CIPHPOL_TKIP (0x04)
#define DOT11_CIPHPOL_AES (0x08)
#define DOT11_KEY_TYPE_NONE 0
#define DOT11_KEY_TYPE_WEP40 DOT11_CIPHPOL_WEP40
#define DOT11_KEY_TYPE_WEP104 DOT11_CIPHPOL_WEP104
#define DOT11_KEY_TYPE_TKIP DOT11_CIPHPOL_TKIP
#define DOT11_KEY_TYPE_AES DOT11_CIPHPOL_AES
#define DOT11_WEP40_KEY_SIZE 5 /* Bytes */
#define DOT11_WEP104_KEY_SIZE 13 /* Bytes */
#define DOT11_AES_KEY_SIZE 16 /* Bytes */
#define DOT11_TKIP_KEY_SIZE 32 /* 16 Bytes key, 2x8 bytes MIC */
typedef struct
{
DOT11_KEY_TYPE keyType;
INT32 keySlot; /* Keyslot key was installed to */
UINT8 macAddr[DOT11_ADDR_LEN];
union
{
UINT8 wep40[DOT11_WEP40_KEY_SIZE];
UINT8 wep104[DOT11_WEP104_KEY_SIZE];
UINT8 aes[DOT11_AES_KEY_SIZE];
UINT8 tkip[DOT11_TKIP_KEY_SIZE];
} type;
UINT16 dummy_pad; /* Make struct 4 byte aligned to avoid compiler packing issues */
} DOT11_KEY;
/* Added for broadcom driver support. Its been invented to align support
* for both broadcom and atheros drivers. */
#define DOT11_KEY_MAX_WEP_KEY_SIZE DOT11_WEP104_KEY_SIZE
typedef struct
{
/* WARNING */
/* This member must remain first as the atheros driver is expecting
* a char * from passed through the ioctl */
UINT8 wepKey[DOT11_KEY_MAX_WEP_KEY_SIZE];
UINT8 keyLength;
} DOT11_WEPKEY;
/* These parameters shadow the current wlan ioctls but are defined
here to reduce unneeded intermodule dependencies */
#define EIOCGWEPSTATUS (0x20f) /* Get WEP status*/
#define EIOCSWEP (0x210) /* Enable/disable WEP */
#define EIOCSWEPKEY0 (0x211) /* Set WEP key 0*/
#define EIOCSWEPKEY1 (0x212) /* Set WEP key 1*/
#define EIOCSWEPKEY2 (0x213) /* Set WEP key 2*/
#define EIOCSWEPKEY3 (0x214) /* Set WEP key 3*/
#define EIOCSWEPDEFAULTKEY (0x215) /* Set default WEP key */
#define EIOCSWEPTYPE (0x21d) /* Set WEP type - 64 bit or 128 bit */
#define EIOCSUNICASTKEYNUM (0x22b) /* Set unicast key slot */
#define EIOCSMULTICASTKEYNUM (0x22d) /* Set multicast key slot */
#define EIOCGCONNECTEDBSSID (0x220) /* Get BSSID */
#define EIOCSAUTHCALLBACK (0x24B) /* Register authentication callback */
#define EIOCS802DOT1XMODE (0x24C) /* Set 802.1x mode */
#define EIOCG802DOT1XMODE (0x24D) /* Get 802.1x mode status */
#define WIOCGCONNECTEDBSSID _IORU('w', 0x006, DOT11_ADDR)
#define WIOCGSECPOL _IORU('w', 0x051, UINT32)
#define WIOCSPMK _IOWU('x', 0x03, DOT11_PMK)
#define WIOCSAUTHCALLBACK _IOW('x', 0x02,DOT1X_PARAMS)
#define WIOCSDRVCALLBACK _IOW('x', 0x05,DOT1X_PARAMS)
#define WIOCSDOT1XPORTSTATUS _IOW('x', 0x01,DOT1X_PORTSTATUS)
#define WIOCAPAIRWISEKEY _IOWU('w', 0x04f, DOT11_KEY)
#define WIOCDPAIRWISEKEY _IOWU('w', 0x62, DOT11_ADDR)
#define WIOCSENCRYPTTYPE _IOU('w', 0x016)
#define WIOCDPAIRWISEKEY _IOWU('w', 0x62, DOT11_ADDR)
#define WIOCDOT1XINT _IOWR('x', 0x04, DOT11_DOT1X_INT)
#define ONEX_MODE_ENABLED (1)
#define DOT11_40_BIT_KEY_SIZE (5) /* Num bytes in 40 bit key */
#define DOT11_128_BIT_KEY_SIZE (13) /* Num bytes in 128 bit key */
#define WLAN_WEP_ENABLED (TRUE) /* Use wep */
#define WLAN_WEP_NUM_KEYS (4) /* Max number of static keys stored */
#define WLAN_WEP_TYPE_64 (64) /* 40/64 bit encryption */
#define WLAN_WEP_TYPE_128 (128) /* 104/128 bit encryption */
#define DOT1X_80211_PMK_LEN (32)
#define DOT1X_80211_ADDR_LEN (6)
#define DOT1X_SECPOL_NONE (0)
#define DOT1X_SECPOL_TSN (1)
#define DOT1X_SECPOL_WPA (2)
#define DOT1X_SECPOL_11i (4)
/* 802.1x user ioctls */
typedef struct dot1x_rtp_args
{
void *arg0; /* The first argument is the device id */
char arg1[256]; /* Each arg there after has 256 bytes allocated */
char arg2[256];
char arg3[256];
char arg4[256];
char arg5[256];
char arg6[256];
} DOT1X_RTP_ARGS;
/* Ioctl defines */
/* dot1xAuthServerLibInit() - Init authentication server */
#define EIOCAUTHSVRLIBINIT _IORU('d', 0x00F, DOT1X_RTP_ARGS)
/* dot1xAuthServerLibShutDown() - Shutdown authentication server */
#define EIOCAUTHSVRLIBSHUTDOWN _IORU('d', 0x010, DOT1X_RTP_ARGS)
/* dot1xAuthInit() - Shutdown authentication server */
#define EIOCAUTHINIT _IORU('d', 0x020, DOT1X_RTP_ARGS)
/* dot1xAuthShutdown() - Shutdown authenticator */
#define EIOCAUTHSHUTDOWN _IORU('d', 0x030, DOT1X_RTP_ARGS)
/* dot1xAuthAttach() - Attach to authenticator */
#define EIOCAUTHATTACH _IORU('d', 0x040, DOT1X_RTP_ARGS)
/* dot1xAuthDetach() - Detach from authenticator */
#define EIOCAUTHDETACH _IORU('d', 0x050, DOT1X_RTP_ARGS)
/* dot1xAuthWlanConfig() - Configure wlan device on authenticator */
#define EIOCAUTHWLANCONFIG _IORU('d', 0x060, DOT1X_RTP_ARGS)
/* Virtual END driver init method - Base6.1 only */
void *dot1xVirtEndDevInit(void);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xCommonIoctlsh */
@@ -0,0 +1,69 @@
/* dot1xDebugLibP.h - 802.1X debug header */
/* Copyright 2005-2006 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01c,28sep05,eja Change enum DOT1X_ERROR_NONE to 0
01b,23sep05,eja Add support for mschapv2, gtc, and md5 debugging areas
01a,09sep05,eja Make debug call printf from logMsg
*/
/*
DESCRIPTION
*/
#ifndef __INCdot1xDebugLibh
#define __INCdot1xDebugLibh
#include <vxWorks.h>
#include <stdio.h>
/* Dot1x debug levels */
typedef enum
{
DOT1X_DEBUG_NONE = 0,
DOT1X_DEBUG_FATAL,
DOT1X_DEBUG_ERROR,
DOT1X_DEBUG_INFO,
DOT1X_DEBUG_FLOOD
} DOT1X_DEBUG_LEVELS;
/* Dot1x debug areas */
typedef enum
{
DOT1X_AREA_ALL = 0,
DOT1X_AREA_INIT,
DOT1X_AREA_SUPP,
DOT1X_AREA_AUTH,
DOT1X_AREA_LEAP,
DOT1X_AREA_PEAP,
DOT1X_AREA_TLS,
DOT1X_AREA_TTLS,
DOT1X_AREA_MSCHAPV2,
DOT1X_AREA_MD5,
DOT1X_AREA_GTC,
DOT1X_AREA_EAPOL
} DOT1X_DEBUG_AREAS;
extern INT32 dot1xDebugArray[];
#define DOT1X_LOG(level, area, message) \
if ((level) <= dot1xDebugArray[(area)]) printf message
#ifdef __cplusplus
extern "C" {
#endif
extern STATUS dot1xDebugLevelSet
(
int area, /* Debug area to get level for */
int level /* Debug level to set */
);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xDebugLibh */
@@ -0,0 +1,51 @@
/* dot1xDesLib.h - IEEE 802.1X DES interface file*/
/* Copyright 2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01a,21Apr03,ggg written
*/
#ifndef __INCdot1xDesLibh
#define __INCdot1xDesLibh
/*
* this DES implementation derived from Phil Karn's public domain DES.
*/
#ifdef __cplusplus
extern"C" {
#endif
#include "vxWorks.h"
typedef ULONG DES_KS[16][2]; /* Single-key DES key schedule */
typedef struct
{
int decrypt;
DES_KS keysched;
UCHAR iv[8];
} DES_CTX;
#ifndef _EXCLUDE_PROTOTYPES_
void deskey (DES_KS, UCHAR *,int);
void des (DES_KS, UCHAR *, UCHAR *);
#endif /* ifndef _EXCLUDE_PROTOTYPES_ */
IMPORT void dot1xDesKey(DES_KS , UCHAR *, int);
IMPORT void dot1xDes(DES_KS, UCHAR *, UCHAR *);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xDesLibh */
@@ -0,0 +1,199 @@
/* dot1xEapolLib.h - 802.1X EAPOL Definitions */
/* Copyright 2002-2005 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01l,04apr10,kxr Coverity: VOID to void
01k,09feb06,rb Added mSSID compatibility
01j,18mar05,eja Added logging
01i,03mar05,eja Fix prototype misspelling
01h,01mar05,eja API change and file cleanup
01g,04feb05,eja 80211i/WPA integration
01f,12jan05,eja Add PAE MAC address for wireline mode
01e,21dec04,eja Add function prototype
01d,21apr03,ggg File name, location change
01c,25apr02,mef to clean up the code
01b,04mar02,mef to add EAPOL Header Len Macro
01a,26Dec01,mef written.
*/
/*
DESCRIPTION
This file contains the definitions and the function prototype
that is used by EAPOL (EAP Over LAN) protcol layer.
*/
#ifndef __INCdot1xEapolLibh
#define __INCdot1xEapolLibh
#ifdef __cplusplus
extern "C" {
#endif
/* vxworks types */
#include <vxWorks.h>
#include "dot1xMdLib.h"
#include <end.h>
/* typedefs */
/* DOT1X EAPOL Msg Types - For detailed Information check standard
pg.15 7.5.4 */
typedef enum
{
DOT1X_EAPOL_EAP_PACKET = 0, /* EAP Packet */
DOT1X_EAPOL_START, /* EAPOL Start */
DOT1X_EAPOL_LOGOFF, /* EAPOL Logoff */
DOT1X_EAPOL_KEY, /* EAPOL Key */
DOT1X_EAPOL_ASF_ALERT /* EAPOL Encapsulated ASF Alert */
} DOT1X_EAPOL_PACKET_TYPE;
/* definitions */
#define SIOCGIFNDX _IOR('i', 130, struct ifreq) /* get ifnet index */
#define SIOCGIFTYPE _IOR('i', 140, struct ifreq) /* get if type */
#define SIOCGADDR EIOCGADDR /* get src MAC address */
/* dot1xEapol Receive Error Definitions */
#define DOT1X_EAPOL_RCV_INVALID_FRAME_ERR ((UINT32)0)
#define DOT1X_EAPOL_RCV_FRAME_LEN_ERR ((UINT32)1)
/* EAPOL Header Length */
#define DOT1X_EAPOL_HEADER_LEN 4
#define DOT1X_EAPOL_PROTOCOL_VERSION ((UCHAR)0x01)
#define DOT1X_EAPOL_PAE_MAC "\x01\x80\xC2\x00\x00\x03"
/* EAPOL, especially key handling
(duplicated from dot1xEapolMuxAdapter.c) */
#define DOT1X_EAPOL_ETHERNET_HEADER_SIZE 4
/* Length of initialization vector for decrypting keys */
#define DOT1X_EAPOL_KEY_IV_SIZE 16
/* Length of timestamp in EAPOL Key messages */
#define DOT1X_EAPOL_KEY_REPLAY_COUNTER_SIZE 8
/* EAPOL Key type */
#define EAPOL_KEY_TYPE_WB4 1
/* Size of an EAPOL key descriptor without the key
1 + 2 + 8 + 16 + 1 + 16 */
#define EAPOL_KEY_DESCRIPTOR_MIN_LENGTH 44
/* Biggest key to handle for 802.11 */
#define EAPOL_KEY_MAX_SIZE DOT11_128_BIT_KEY_SIZE
/* Unicast keys have the high bit set in the index */
#define EAPOL_KEY_UNICAST_BIT 0x80
#define EAPOL_KEY_INDEX_MASK 0x7F
#define EAPOL_LOG_FATAL "(f) " __FILE__ " (s) FATAL (r) "
#define EAPOL_LOG_ERROR "(f) " __FILE__ " (s) ERROR (r) "
#define EAPOL_LOG_INFO "(f) " __FILE__ " (s) INFO (r) "
#define EAPOL_LOG_DEBUG "(f) " __FILE__ " (s) DEBUG (r) "
/* EAPOL header */
typedef struct
{
char version; /* EAPOL version */
char type; /* DOT1X_EAPOL_PACKET_TYPE in dot1xEapolP.h */
UINT16 length; /* EAPOL packet length */
} _WRS_PACK_ALIGN(1) EAPOL_HDR;
/* EAPOL Key message */
typedef struct
{
EAPOL_HDR eapolHeader; /* EAPOL header needed for signature */
char type; /* Type of key: WB4 = 0x01 */
UINT16 length; /* Key size in bytes */
char replay[DOT1X_EAPOL_KEY_REPLAY_COUNTER_SIZE]; /* Replay */
char iv[DOT1X_EAPOL_KEY_IV_SIZE]; /* IV for decrypt of key */
char index; /* Key slot. Bit 8 set for unicast */
char signature[HMAC_MD5_RESULT_LENGTH]; /* Signature HMAC-MD5 */
char keyStart; /* Start key data. none: use session key */
} _WRS_PACK_ALIGN(1) EAPOL_KEY_DESCRIPTOR;
/* Function Prototypes */
IMPORT STATUS dot1xEapolSend
(
VOID *cookie,/* EAPOL cookie of device */
char *dstMacAddress, /* destination MAC address */
UINT16 packetType, /* EAPOL packet type */
UINT16 packetLen, /* length of packet body */
char* packetBody /* packet body */
);
IMPORT VOID *dot1xEapolFindByDevice
(
INT32 unit, /* unit number */
char* name /* device name */
);
IMPORT STATUS dot1xEapolIoctl
(
VOID *cookie, /* cookie indentifying the device */
INT32 cmd, /* command to pass to ioctl */
caddr_t data /* data needed for command in cmd */
);
IMPORT STATUS dot1xEapolAuthIoctl
(
VOID *cookie, /* cookie indentifying the device */
INT32 cmd, /* command to pass to ioctl */
caddr_t data, /* data needed for command in cmd */
UINT8 * pSuppAddr /* Address of the supplicant */
);
IMPORT STATUS dot1xEapolLibInit
(
void
);
IMPORT STATUS dot1xEapolInit
(
UINT32 eapolMaxUnits /* max bindings */
);
IMPORT STATUS dot1xEapolAttach
(
INT32 unit, /* unit number */
char *name /* device name */
);
IMPORT STATUS dot1xEapolDetach
(
INT32 unit, /* unit number */
char *name /* device name */
);
IMPORT STATUS dot1xEapolBind
(
INT32 unit,/* unit number of interface */
char *name, /* device name of interface */
VOID *cookie, /* cookie of Binding PDU */
VOID *rcvRtn, /* function ptr to receive routine of protocol */
VOID *rcvErrRtn /* function ptr to received packet error routine */
);
IMPORT STATUS dot1xEapolUnbind
(
INT32 unit, /* unit number */
char *name, /* device name */
VOID *rcvRtn /* pointer to receive routine of upper layer protocol */
);
IMPORT VOID *dot1xEapolIfNameGet
(
VOID *pObj /* Device object */
);
IMPORT INT32 dot1xEapolIfNumGet
(
VOID *pObj /* Device object */
);
STATUS dot1xEapolLogCallbackInstall
(
VOID *cookie,/* EAPOL cookie of device */
VOID *callback /* Device object */
);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xEapolLibh */
@@ -0,0 +1,82 @@
/* dot1xKeyLib.h - IEEE 802.1X Key management interface header file*/
/* Copyright 2002-2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01c,21nov06,dwb Changes for ipnet porting
01b,21apr03,ggg File name, location change
01a,28Feb02,myz written
*/
#ifndef __INCdot1xKeyLibh
#define __INCdot1xKeyLibh
#ifdef __cplusplus
extern "C" {
#endif
/*** defines ***/
/* dot1xKeyLibInit argument values */
#define DOT1X_KEY_TIME_ASYNC_MODE 0 /* run in asynchronise mode */
#define DOT1X_KEY_TIME_SYNC_MODE 1 /* run in synchronise mode */
/*** typedefs ***/
typedef enum {
DOT1X_AUTH_SNTP_COUNTER, /* Use NTP time value for the replay counter */
DOT1X_AUTH_LOCAL_COUNTER /* Use local count value for the replay counter*/
} DOT1X_AUTH_REPLAY_CNT_TYPE;
typedef struct {
UINT8 * pKey; /* points to a key */
int len; /* key length */
} DOT1X_AUTH_GENERIC_KEY_DESC;
typedef struct {
DOT1X_AUTH_GENERIC_KEY_DESC key; /* the key descriptor */
UINT8 index; /* key index */
} DOT1X_AUTH_WEP_KEY_DESC;
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS dot1xAuthWepKeyGenerate (DOT1X_AUTH_GENERIC_KEY_DESC *,
DOT1X_AUTH_GENERIC_KEY_DESC *);
extern STATUS dot1xAuthEapolKeyPacketBuild (char *, UINT8,
DOT1X_AUTH_GENERIC_KEY_DESC *,
DOT1X_AUTH_WEP_KEY_DESC *);
extern void dot1xKeyLibInit (DOT1X_AUTH_REPLAY_CNT_TYPE,int,char *, UINT16,
FUNCPTR);
extern void dot1xKeyNtpTimeServerSet (char *);
extern void dot1xKeyNtpPortSet (UINT16);
extern void dot1xKeyNtpTimeGetFuncSet (FUNCPTR);
extern void dot1xKeyRandomKeySet (UINT8 *);
extern void dot1xKeyRandomSeedSet (UINT8 *,int);
extern void dot1xKeyNtpTimeGetAsync (void);
extern void dot1xKeyNtpTimeGet (void);
#else
extern STATUS dot1xAuthWepKeyGenerate();
extern STATUS dot1xAuthEapolKeyPacketBuild();
extern void dot1xKeyLibInit();
extern void dot1xKeyNtpTimeGetAsync ();
extern void dot1xKeyNtpTimeGet ();
extern void dot1xKeyNtpTimeServerSet();
extern void dot1xKeyNtpPortSet();
extern void dot1xKeyNtpTimeGetFuncSet();
extern void dot1xKeyRandomSeedSet ();
extern void dot1xKeyRandomKeySet ();
#endif
#ifdef __cplusplus
}
#endif
#endif /* end #ifndef __INCdot1xKeyLibh */
@@ -0,0 +1,38 @@
/* dot1xMdLib.h - 802.1X supplicant message digest library header file */
/* Copyright 2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01a,21apr03,ggg written.
*/
#ifndef __INCdot1xMdLibh
#define __INCdot1xMdLibh
#ifdef __cplusplus
extern "C" {
#endif
/* Algorithms: MD4 or MD5 */
typedef enum
{
MD4 = 0x04,
MD5 = 0x05
} MD_ALGORITHM;
#define HMAC_MD5_RESULT_LENGTH 16 /* HMAC-MD5 result length */
/* Prototypes */
extern void dot1xMd(unsigned char *, unsigned long, unsigned char *,
MD_ALGORITHM);
extern void dot1xHmacMd5(unsigned char *, int, unsigned char *, int,
unsigned char *);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xMdLibh */
@@ -0,0 +1,56 @@
/* dot1xMemPartLib.h - 802.1X memory partition specific library header */
/* Copyright 2002-2004 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01g,26jul05,eja Add malloc macro
01f,27jun05,eja Set released pointer to NULL.
01e,25apr05,eja Remove setting released pointer to NULL to fix DIAB error
01d,20apr05,eja Changes to DOT1X_FREE macro
01c,28mar05,eja Increase minimum memory partition to 512KB
01b,15dec04,eja Reduce the memory partition size from 1MB to 128KB
01a,08dec04,eja Fix for Trace bug B004
*/
/*
DESCRIPTION
*/
#ifndef __INCdot1xMemPartLibh
#define __INCdot1xMemPartLibPh
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
#include <memPartLib.h>
/* Macros for memory partition access */
#define DOT1X_CALLOC(n,s) dot1xMemBlockCalloc(n,s)
#define DOT1X_MALLOC(n,s) dot1xMemBlockMalloc(n,s)
#define DOT1X_FREE(m) \
{ \
dot1xMemBlockFree((void*)m); \
m = NULL; \
}
/* Set the maximum memory size of the partition */
#define DOT1X_MEM_PART_SZ_MAX (0x00080000) /* 512KB of memory max */
#define DOT1X_MEM_PART_SZ_MIN (0x00010000) /* 64 KB memory min */
#define DOT1X_MEM_PART_STATS_MODE (1) /* 1 - verbose partition stats */
STATUS dot1xMemPartLibInit(void);
void * dot1xMemBlockCalloc(size_t, size_t);
void * dot1xMemBlockMalloc(size_t, size_t);
STATUS dot1xMemBlockFree(void *);
STATUS dot1xMemPartShow(void);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xSuppLibPh */
@@ -0,0 +1,365 @@
/* dot1xMibLib.h - 802.1X MIB API to SNMP Agent header file */
/* Copyright 2002-2005 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01d,22sep05,eja Add new structure to allow for IDE based module binding
01c,05jul05,eja Add support for supplicant MIB
01b,06jun02,myz changed name UINT64 to UINT64_S
01a,15Jan02,myz written
*/
#ifndef __INCdot1xMibLibh
#define __INCdot1xMibLibh
#ifdef __cplusplus
extern "C" {
#endif
/**** MIB variable IDs ****/
#define D1XM_VAR_PaeSystemAuth 0x10
/* Group IDs */
#define D1XM_VAR_PORT_ENTRY 0x100
#define D1XM_VAR_AUTH_CFG_ENTRY 0x200
#define D1XM_VAR_AUTH_STATS_ENTRY 0x300
#define D1XM_VAR_AUTH_DIAG_ENTRY 0x400
#define D1XM_VAR_AUTH_SESSION_ENTRY 0x500
#define D1XM_VAR_SUPP_CFG_ENTRY 0x600
#define D1XM_VAR_SUPP_STATS_ENTRY 0x700
/* PAE Port Variables */
#define D1XM_VAR_PaePortNumber 0x110
#define D1XM_VAR_PaePortProtocolVersion 0x120
#define D1XM_VAR_PaePortCapabilities 0x130
#define D1XM_VAR_PaePortInitialize 0x140
#define D1XM_VAR_PaePortReauthenticate 0x150
/* Authenticator Configuration variables */
#define D1XM_VAR_AuthPaeState 0x210
#define D1XM_VAR_AuthBackendAuthState 0x220
#define D1XM_VAR_AuthAdminControlledDirections 0x230
#define D1XM_VAR_AuthOperControlledDirections 0x240
#define D1XM_VAR_AuthAuthControlledPortStatus 0x250
#define D1XM_VAR_AuthControlledPortControl 0x260
#define D1XM_VAR_AuthQuietPeriod 0x270
#define D1XM_VAR_AuthTxPeriod 0x280
#define D1XM_VAR_AuthSuppTimeout 0x290
#define D1XM_VAR_AuthServerTimeout 0x2A0
#define D1XM_VAR_AuthMaxReq 0x2B0
#define D1XM_VAR_AuthReauthPeriod 0x2C0
#define D1XM_VAR_AuthReauthEnabled 0x2D0
#define D1XM_VAR_AuthKeyTxEnabled 0x2E0
/* Authenticator Stats Variables */
#define D1XM_VAR_AuthEapolFramesRx 0x310
#define D1XM_VAR_AuthEapolFramesTx 0x320
#define D1XM_VAR_AuthEapolStartFramesRx 0x330
#define D1XM_VAR_AuthEapolLogoffFramesRx 0x340
#define D1XM_VAR_AuthEapolRespIdFramesRx 0x350
#define D1XM_VAR_AuthEapolRespFramesRx 0x360
#define D1XM_VAR_AuthEapolReqIdFramesTx 0x370
#define D1XM_VAR_AuthEapolReqFramesTx 0x380
#define D1XM_VAR_AuthInvalidEapolFramesRx 0x390
#define D1XM_VAR_AuthEapLengthErrorFramesRx 0x3A0
#define D1XM_VAR_AuthLastEapolFrameVersion 0x3B0
#define D1XM_VAR_AuthLastEapolFrameSource 0x3C0
/* Authenticator Diagnostic Variables */
#define D1XM_VAR_AuthEntersConnecting 0x410
#define D1XM_VAR_AuthEapLogoffsWhileConnecting 0x420
#define D1XM_VAR_AuthEntersAuthenticating 0x430
#define D1XM_VAR_AuthAuthSuccessWhileAuthenticating 0x440
#define D1XM_VAR_AuthAuthTimeoutsWhileAuthenticating 0x450
#define D1XM_VAR_AuthAuthFailWhileAuthenticating 0x460
#define D1XM_VAR_AuthAuthReauthsWhileAuthenticating 0x470
#define D1XM_VAR_AuthAuthEapStartsWhileAuthenticating 0x480
#define D1XM_VAR_AuthAuthEapLogoffWhileAuthenticating 0x490
#define D1XM_VAR_AuthAuthReauthsWhileAuthenticated 0x4A0
#define D1XM_VAR_AuthAuthEapStartsWhileAuthenticated 0x4B0
#define D1XM_VAR_AuthAuthEapLogoffWhileAuthenticated 0x4C0
#define D1XM_VAR_AuthBackendResponses 0x4D0
#define D1XM_VAR_AuthBackendAccessChallenges 0x4E0
#define D1XM_VAR_AuthBackendOtherRequestsToSupplicant 0x4E2
#define D1XM_VAR_AuthBackendNonNakResponsesFromSupplicant 0x4E4
#define D1XM_VAR_AuthBackendAuthSuccesses 0x4E6
#define D1XM_VAR_AuthBackendAuthFails 0x4E8
/* Authenticator Session Stats Variables */
#define D1XM_VAR_AuthSessionOctetsRx 0x510
#define D1XM_VAR_AuthSessionOctetsTx 0x520
#define D1XM_VAR_AuthSessionFramesRx 0x530
#define D1XM_VAR_AuthSessionFramesTx 0x540
#define D1XM_VAR_AuthSessionId 0x550
#define D1XM_VAR_AuthSessionAuthenticMethod 0x560
#define D1XM_VAR_AuthSessionTime 0x570
#define D1XM_VAR_AuthSessionTerminateCause 0x580
#define D1XM_VAR_AuthSessionUserName 0x590
/* Supplicant Configuration Varibles */
#define D1XM_VAR_SuppPaeState 0x610
#define D1XM_VAR_SuppHeldPeriod 0x620
#define D1XM_VAR_SuppAuthPeriod 0x630
#define D1XM_VAR_SuppStartPeriod 0x640
#define D1XM_VAR_SuppMaxStart 0x650
/* Supplicant Statistics Varibles */
#define D1XM_VAR_SuppEapolFramesRx 0x710
#define D1XM_VAR_SuppEapolFramesTx 0x720
#define D1XM_VAR_SuppEapolStartFramesTx 0x730
#define D1XM_VAR_SuppEapolLogoffFramesTx 0x740
#define D1XM_VAR_SuppEapolRespIdFramesTx 0x750
#define D1XM_VAR_SuppEapolRespFramesTx 0x760
#define D1XM_VAR_SuppEapolReqIdFramesRx 0x770
#define D1XM_VAR_SuppEapolReqFramesRx 0x780
#define D1XM_VAR_SuppInvalidEapolFramesRx 0x790
#define D1XM_VAR_SuppEapLengthErrorFramesRx 0x7A0
#define D1XM_VAR_SuppLastEapolFrameVersion 0x7B0
#define D1XM_VAR_SuppLastEapolFrameSource 0x7C0
/* simple type used for imitating 64 bit integers */
typedef struct
{
UINT32 high;
UINT32 low;
} UINT64_S;
/* SystemAuthControl */
typedef UINT32 D1XM_SYSTEM_AUTH_CONTROL;
/* dot1xPaePortTable 9.6.1 System Configuration */
typedef enum {
D1XM_dot1xPaePortAuthCapable=0,
D1XM_dot1xPaePortSuppCapable
} D1XM_PORT_CAP_TYPE;
typedef struct {
UINT32 paePortNumber; /* port number */
UINT32 paePortProtocolVersion; /*Protocol version */
UINT8 paePortCapabilities[1]; /*PAE capabilities */
UINT8 padding[3];
UINT32 paePortInitialize; /* Initialize Port */
UINT32 paePortReauthenticate;
} D1XM_PAE_PORT_ENTRY;
/* dot1xAuthConfigTable 9.4.1 Authenticator Configuration */
typedef struct {
UINT32 paePortNumber; /* port number */
UINT32 authPaeState; /* Authenticator PAE State */
UINT32 authBackendAuthState; /* Backend Authentication State */
UINT32 authAdminControlledDirections; /* AdminControlledDirections */
UINT32 authOperControlledDirections; /* OperControlledDirections */
UINT32 authAuthControlledPortStatus; /* AuthControlledPortStatus */
UINT32 authAuthControlledPortControl; /* AuthControlledPortControl */
UINT32 authQuietPeriod; /* quietPeriod */
UINT32 authTxPeriod; /* txPeriod */
UINT32 authSuppTimeout; /* suppTimeout */
UINT32 authServerTimeout; /* serverTimeout */
UINT32 authMaxReq; /* maxReq */
UINT32 authReAuthPeriod; /* reAuthPeriod */
UINT32 authReAuthEnabled; /* reAuthEnabled */
UINT32 authKeyTxEnabled; /* KeyTransmissionEnabled */
UINT32 PaePortReauthenticate; /* Reauthenticate */
} D1XM_AUTH_CONFIG_ENTRY;
/* dot1xAuthStatsTable 9.4.2 Authenticator Statistics */
typedef struct {
UINT32 paePortNumber; /* port number */
UINT32 authEapolFramesRx; /* EAPOL frames received */
UINT32 authEapolFramesTx; /* EAPOL frames transmitted */
UINT32 authEapolStartFramesRx; /* EAPOL Start frames received */
UINT32 authEapolLogoffFramesRx; /* EAPOL Logoff frames received */
UINT32 authEapolRespIdFramesRx; /* EAP Resp/Id frames received */
UINT32 authEapolRespFramesRx; /* EAP Response frames received */
UINT32 authEapolReqIdFramesTx; /* EAP Req/Id frames transmitted */
UINT32 authEapolReqFramesTx; /* EAP Request frames transmitted */
UINT32 authInvalidEapolFramesRx; /* Invalid EAPOL frames received */
UINT32 authEapLengthErrorFramesRx; /* EAP length error frames received */
UINT32 authLastEapolFrameVersion; /* Last EAPOL frame version */
UINT8 authLastEapolFrameSource[6]; /* Last EAPOL frame source */
} D1XM_AUTH_STATS_ENTRY;
/* dot1xAuthDiagTable 9.4.3 Authenticator Diagnostics */
typedef struct {
UINT32 paePortNumber; /* port number */
UINT32 authEntersConnecting;
UINT32 authEapLogoffsWhileConnecting;
UINT32 authEntersAuthenticating;
UINT32 authAuthSuccessWhileAuthenticating;
UINT32 authAuthTimeoutsWhileAuthenticating;
UINT32 authAuthFailWhileAuthenticating;
UINT32 authAuthReauthsWhileAuthenticating;
UINT32 authAuthEapStartsWhileAuthenticating;
UINT32 authAuthEapLogoffWhileAuthenticating;
UINT32 authAuthReauthsWhileAuthenticated;
UINT32 authAuthEapStartsWhileAuthenticated;
UINT32 authAuthEapLogoffWhileAuthenticated;
UINT32 authBackendResponses;
UINT32 authBackendAccessChallenges;
UINT32 authBackendOtherRequestsToSupplicant;
UINT32 authBackendNonNakResponsesFromSupplicant;
UINT32 authBackendAuthSuccesses;
UINT32 authBackendAuthFails;
} D1XM_AUTH_DIAG_ENTRY;
/* dot1xAuthSessionStatsTable 9.4.4 Authenticator Session Statistics */
typedef struct {
UINT32 paePortNumber; /* port number */
UINT64_S authSessionOctetsRx; /* Session Octets Received */
UINT64_S authSessionOctetsTx; /* Session Octets Transmitted */
UINT32 authSessionFramesRx; /* Session Frames Received */
UINT32 authSessionFramesTx; /* Session Frames Transmitted */
char * authSessionId; /* Session Identifier */
UINT32 authSessionAuthenticMethod; /* Session Authentication Method */
UINT32 authSessionTime; /* Session Time */
UINT32 authSessionTerminateCause; /* Session Terminate Cause */
char * authSessionUserName; /* Session User Name */
} D1XM_AUTH_SESSION_STATS_ENTRY;
/* dot1xSuppConfigTable 9.5.1 Supplicant Configuration */
typedef struct {
UINT32 paePortNumber; /* port number */
UINT32 suppPaeState; /* Supplicant PAE State */
UINT32 suppHeldPeriod; /* heldPeriod */
UINT32 suppAuthPeriod; /* authPeriod */
UINT32 suppStartPeriod; /* startPeriod */
UINT32 suppMaxStart; /* maxStart */
} D1XM_SUPP_CONFIG_ENTRY;
/* dot1xSuppStatsTable 9.5.2 Supplicant Statistics */
typedef struct {
UINT32 paePortNumber; /* port number */
UINT32 suppEapolFramesRx; /* EAPOL frames received */
UINT32 suppEapolFramesTx; /* EAPOL frames transmitted */
UINT32 suppEapolStartFramesTx; /* EAPOL Start frames transmitted */
UINT32 suppEapolLogoffFramesTx; /* EAPOL Logoff frames transmitted */
UINT32 suppEapolRespIdFramesTx; /* EAP Resp/Id frames transmitted */
UINT32 suppEapolRespFramesTx; /* EAP Response frames transmitted */
UINT32 suppEapolReqIdFramesRx; /* EAP Req/Id frames received */
UINT32 suppEapolReqFramesRx; /* EAP Request frames received */
UINT32 suppInvalidEapolFramesRx; /* Invalid EAPOL frames received */
UINT32 suppEapLengthErrorFramesRx; /* EAP length error frames received */
UINT32 suppLastEapolFrameVersion; /* Last EAPOL frame version */
UINT8 suppLastEapolFrameSource[6]; /* Last EAPOL frame source */
} D1XM_SUPP_STATS_ENTRY;
/* dot1xPaeSystem group */
typedef struct {
D1XM_SYSTEM_AUTH_CONTROL authControl;
D1XM_PAE_PORT_ENTRY portTable;
} D1XM_PAE_SYSTEM_GROUP;
/* dot1xPaeAuthenticator group */
typedef struct {
D1XM_AUTH_CONFIG_ENTRY cfgTbl; /* configuration table */
D1XM_AUTH_STATS_ENTRY statsTbl; /* STATS table */
D1XM_AUTH_DIAG_ENTRY diagTbl; /* diagnostics table */
D1XM_AUTH_SESSION_STATS_ENTRY sessionTbl; /* authenticator session stats*/
} D1XM_PAE_AUTHENTICATOR_GROUP;
/* dot1xPaeSupplicant Group */
typedef struct {
D1XM_SUPP_CONFIG_ENTRY cfgTbl; /* supplicant configuration table */
D1XM_SUPP_STATS_ENTRY statsTbl; /* supplicant stats table */
} D1XM_PAE_SUPPLICANT_GROUP;
typedef struct {
D1XM_PAE_PORT_ENTRY portGrp;
D1XM_PAE_AUTHENTICATOR_GROUP authGrp;
D1XM_PAE_SUPPLICANT_GROUP suppGrp;
} D1XM_PORT_ENTRY;
/* MIB handler type */
typedef enum
{
DOT1X_AUTH_BINDING = 0, /* authenticator MIB */
DOT1X_SUPP_BINDING /* supplicant MIB */
} DOT1X_MIB_BIND;
/* MIB module attachment */
typedef struct
{
STATUS (*pInstallHandler)();
STATUS (*pRemoveHandler)();
} DOT1X_MIB_MODULE_BINDING;
/* MIB handler structure */
typedef struct
{
int (*get)(); /* get method */
int (*next)(); /* next method */
int (*set)(); /* set method */
} DOT1X_MIB_FUNC_TABLE;
/* authenticator and supplicant MIB handlers */
typedef struct
{
DOT1X_MIB_FUNC_TABLE *authHandler; /* authenticator table */
DOT1X_MIB_FUNC_TABLE *suppHandler; /* supplicant table */
} DOT1X_MIB_HANDLER;
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
STATUS dot1xMibVarGet (UINT32, int, void*, int);
STATUS dot1xMibVarSet (UINT32, int, void*, int);
STATUS dot1xMibNewPortAdded (UINT32,D1XM_AUTH_CONFIG_ENTRY *);
STATUS dot1xMibPortRemoved (UINT32);
STATUS dot1xMibSnmpEntryGet (UINT32, int, void*, int);
STATUS dot1xMibSnmpNextEntryGet (UINT32 *, int, void*, int);
STATUS dot1xMibSnmpVarSet (UINT32, UINT32, UINT32);
STATUS dot1xMibNextPortVarGet (UINT32*, int, void*, int);
STATUS dot1xMibLibInit(void);
STATUS dot1xMibHandlerInstall(void *, int);
STATUS dot1xMibHandlerRemove(void *, int);
STATUS dot1xMibAdd(void);
#else /* __STDC__ */
STATUS dot1xMibVarGet ();
STATUS dot1xMibVarSet ();
STATUS dot1xMibNewPortAdded ();
STATUS dot1xMibPortRemoved ();
STATUS dot1xMibSnmpEntryGet ();
STATUS dot1xMibSnmpNextEntryGet ();
STATUS dot1xMibSnmpVarSet ();
STATUS dot1xMibNextPortVarGet ();
STATUS dot1xMibLibInit();
STATUS dot1xMibHandlerInstall();
STATUS dot1xMibHandlerRemove();
STATUS dot1xMibAdd();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xMibLibh */
@@ -0,0 +1,42 @@
/* dot1xVirtEndLib.h - Virtual End driver */
/* Copyright 2002-2005 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01a,26Jul05,eja Created
*/
#ifndef __INCdot1xVirtEndLibh
#define __INCdot1xVirtEndLibh
#ifdef __cplusplus
extern "C" {
#endif
#include <vxWorks.h>
/* typedefs */
typedef int (*VIRT_END_CFG_HANDLER)();
/* defines */
#define DOT1X_VIRT_END_DEV_NAME "dot1x"
#define DOT1X_VIRT_END_DEV_NAME_LEN (strlen(DOT1X_VIRT_END_DEV_NAME) + 1)
/* enums */
typedef enum
{
DOT1X_VIRT_END_SUPP_HDLR = 0,
DOT1X_VIRT_END_AUTH_HDLR
} DOT1X_VIRT_END_HDLR;
void * dot1xVirtEndDevInit(void);
STATUS dot1xVirtEndDevHandlerInstall(void *, int, void *);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xVirtEndLibh */
@@ -0,0 +1,37 @@
/* dot1xWb4Lib.h - 802.1X supplicant stream cipher library header file */
/* Copyright 2003 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01a,21apr03,ggg written.
*/
#ifndef __INCdot1xWb4Libh
#define __INCdot1xWb4Libh
#ifdef __cplusplus
extern "C" {
#endif
/* Stream cipher key format */
typedef struct
{
unsigned char state[256];
unsigned char x;
unsigned char y;
} DOT1X_WB4_KEY;
/* Prototypes */
void dot1xWb4KeyGen(unsigned char *key_data_ptr, int key_data_len,
DOT1X_WB4_KEY *key);
void dot1xWb4(unsigned char *buffer_ptr, int buffer_len, DOT1X_WB4_KEY * key);
#ifdef __cplusplus
}
#endif
#endif /* __INCdot1xWb4Libh */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,613 @@
/* dot1xAuthTimerLib.c - Timer Management Library for 802.1X Authenticator */
/*
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01g,05feb08,dwb Changes for SMP
01f,16mar06,rjh Add NOMANUAL
01e,21apr03,ggg File name, location change
01d,08jul02,ggg Undef debug by default, update debug var name, macro
01c,13may02,mef to clean up the code
01b,28feb02,mef to continue development
01a,18Dec01,mef written.
*/
/*
DESCRIPTION
The Timer Management Library is used by 802.1X Framework(AUTH).
The 802.1X implementation supports "Authenticator" role that is
defined in "IEEE Std 802.1X-2001" standard. Hence, "aWhile",
"quietWhile", "reAuthWhen", and "txWhen" timers and one "internal"
timer to use by 1X AUTH Task are implemented in this library.
To get more detailed information about these
timers and how they are used, plesase check the standard.
As standard required, the granularity of timers is in second.
\NOMANUAL
*/
/* Include Files */
#include "vxWorks.h"
#include "dot1xAuthTimerLib.h"
#include "dot1xAuthLib.h"
#include "intLib.h"
#include "ioLib.h"
#include "lstLib.h"
#include "logLib.h"
#include "semLib.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "sysLib.h"
#include "taskLib.h"
#include "tickLib.h"
#include "spinLockLib.h"
#include <vsbConfig.h>
/* defines */
#define DOT1X_AUTH_TIMER_SEM_OPTIONS (SEM_Q_PRIORITY |\
SEM_DELETE_SAFE |\
SEM_INVERSION_SAFE)
#define DOT1X_AUTH_TIMER_TASK_NAME "tDot1xTimer"
#define DOT1X_AUTH_TIMER_TASK_OPTIONS ((int) 0)
#define DOT1X_AUTH_TIMER_TASK_STACK_SIZE ((int) 0x4000)
#define DOT1X_AUTH_TIMER_NO_DEADLINE 0
#if defined(_WRS_CONFIG_DOT1X_AUTH_TIMER_DEBUG) && !defined(DOT1X_AUTH_TIMER_DEBUG)
#define DOT1X_AUTH_TIMER_DEBUG
#endif
#ifdef DOT1X_AUTH_TIMER_DEBUG
int dot1xAuthTimerDebug = 1;
#define DOT1XLOGMSG(msg) \
{ \
if (dot1xAuthTimerDebug == 1) \
logMsg msg; \
}
#else
#define DOT1XLOGMSG(msg)
#endif
/* TODO : Think about mem part allocation */
#define DOT1X_AUTH_MALLOC(x) (void *) malloc ((size_t) x)
#define DOT1X_AUTH_FREE(x) (void) free ((void *) x)
/* Task spinlock */
SPIN_LOCK_TASK_DECL(timerLibTaskSpinLock,0);
/* type definitions */
typedef struct
{
int timerTaskId; /* timer task ID */
UINT32 timerTick; /* current timer tick value in seconds */
UINT32 timerDeadlineTick; /* next timeout deadline tick count */
INT32 sysClkRate; /* system clock rate */
LIST timerListDescr [DOT1X_AUTH_TIMER_NBR];
/* 0 - list descriptor for aWhile timers */
/* 1 - list descriptor for quietWhile timers*/
/* 2 - list descriptor for reauthWhen timers*/
/* 3 - list descriptor for txWhen timers */
/* 4 - 1X Auth internal timers */
} DOT1X_AUTH_TIMER_MANAGER;
typedef struct
{
NODE node; /* list pointer structure */
UINT32 portNbr; /* dot1X port number */
UINT32 timeoutValue; /* timeout tick value */
UINT8 timerReason; /* It is used for internal timer.
Whenever timeout occurs, this info
returned back.
*/
} DOT1X_AUTH_TIMER_NODE;
/* Local Variables */
LOCAL SEM_ID dot1xAuthTimerMutex = NULL; /* timer mutex semaphore */
LOCAL INT32 dot1xAuthQtrSecond; /* 1/4 sec = # of ticks */
LOCAL DOT1X_AUTH_TIMER_MANAGER dot1xAuthTimerManager;
/* Local Functions */
LOCAL void dot1xAuthTimerTask ();
LOCAL UINT32 dot1xAuthTimerCheck (DOT1X_AUTH_TIMER_TYPE);
LOCAL void dot1xAuthTimerDeadlineAdjust ();
/*****************************************************************************
*
* dot1xAuthTimerManagerInit - initialize the timer manager for 1X Framework
*
* This routine initializes the timer management library for 1X Framework.
* It must not be called more than once.
*
* SEE ALSO :
*
* RETURNS: taskId or ERROR
*
* NOMANUAL
*/
int dot1xAuthTimerManagerInit
(
INT32 dot1xAuthTimerTaskPriority /* task priority of timer task */
)
{
int ix;
if (dot1xAuthTimerMutex != NULL)
{
logMsg ("dot1xAuthTimerManagerInit-Timer Manager is already runing!\n",
0, 0, 0, 0, 0, 0);
return (ERROR);
}
if ((dot1xAuthTimerMutex = semMCreate (DOT1X_AUTH_TIMER_SEM_OPTIONS)) == NULL)
{
logMsg ("(dot1xAuthTimerManagerInit) semMCreate failure !!! \n",
0, 0, 0, 0, 0, 0);
return (ERROR);
}
dot1xAuthTimerManager.timerTick = 0;
dot1xAuthTimerManager.timerDeadlineTick = DOT1X_AUTH_TIMER_NO_DEADLINE;
dot1xAuthTimerManager.sysClkRate = sysClkRateGet ();
dot1xAuthQtrSecond = dot1xAuthTimerManager.sysClkRate / 4;
for (ix = 0; ix < DOT1X_AUTH_TIMER_NBR; ix++)
lstInit (&dot1xAuthTimerManager.timerListDescr[ix]);
semGive (dot1xAuthTimerMutex);
dot1xAuthTimerManager.timerTaskId = taskSpawn (DOT1X_AUTH_TIMER_TASK_NAME,
dot1xAuthTimerTaskPriority,
DOT1X_AUTH_TIMER_TASK_OPTIONS,
DOT1X_AUTH_TIMER_TASK_STACK_SIZE,
(FUNCPTR) &dot1xAuthTimerTask,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
);
if ( dot1xAuthTimerManager.timerTaskId == ERROR)
{
semDelete (dot1xAuthTimerMutex);
dot1xAuthTimerMutex = NULL;
bzero ( (char *) &dot1xAuthTimerManager,
sizeof (DOT1X_AUTH_TIMER_MANAGER));
logMsg ("(dot1xAuthTimerManagerInit) taskCreate failure !!! \n",
0, 0, 0, 0, 0, 0);
return (ERROR);
}
return (dot1xAuthTimerManager.timerTaskId);
}
/*****************************************************************************
*
* dot1xAuthTimerManagerShutDown - shutdowns the timer manager for 1X Framework
*
* This routine stops all of the running timers, frees the allocated
* resources, and deletes the DOT1X_AUTH_TIMER_TASK_NAME task.
*
* SEE ALSO :
*
* RETURNS: OK or ERROR
*
* NOMANUAL
*/
STATUS dot1xAuthTimerManagerShutdown
(
)
{
int ix;
if (semTake (dot1xAuthTimerMutex, WAIT_FOREVER) != OK)
return (ERROR);
for (ix = 0; ix < DOT1X_AUTH_TIMER_NBR; ix++)
lstFree (&dot1xAuthTimerManager.timerListDescr[ix]);
taskDelete (dot1xAuthTimerManager.timerTaskId);
semDelete (dot1xAuthTimerMutex);
dot1xAuthTimerMutex = NULL;
bzero ( (char *) &dot1xAuthTimerManager, sizeof (DOT1X_AUTH_TIMER_MANAGER));
return (OK);
}
/*****************************************************************************
*
* dot1xAuthTimerTickGet - get timer tick value
*
* This routine returns timer tick count value.
*
* RETURNS: timer tick
*
* NOMANUAL
*/
UINT32 dot1xAuthTimerTickGet
(
)
{
return (dot1xAuthTimerManager.timerTick);
}
/*****************************************************************************
*
* dot1xAuthTimerStart - start a timer for a port
*
* This routine starts a timer for given port nbr, for one of 5 timer types,
* for a given timer reason.
*
* RETURNS: OK or ERROR
*
* NOMANUAL
*/
STATUS dot1xAuthTimerStart
(
UINT32 dot1xAuthPortNbr, /* port number */
DOT1X_AUTH_TIMER_TYPE dot1xAuthTimerType, /* timer type */
UINT16 dot1xAuthTimerValue, /* timer value in seconds */
UINT8 dot1xAuthTimerReason
)
{
LIST *pDot1xAuthTimerList;
DOT1X_AUTH_TIMER_NODE *pNewTimer;
DOT1X_AUTH_TIMER_NODE *pTimer;
DOT1X_AUTH_TIMER_NODE *pPrevTimer;
if (dot1xAuthTimerType >= DOT1X_AUTH_TIMER_NBR)
{
logMsg ("(dot1xAuthTimerStart) Invalid Timer Type !!! \n",
0, 0, 0, 0, 0, 0);
return (ERROR);
}
if (semTake (dot1xAuthTimerMutex, WAIT_FOREVER) != OK)
return (ERROR);
pNewTimer = (DOT1X_AUTH_TIMER_NODE *)
DOT1X_AUTH_MALLOC (sizeof (DOT1X_AUTH_TIMER_NODE));
if (pNewTimer == (DOT1X_AUTH_TIMER_NODE *) NULL)
{
logMsg ("(dot1xAuthTimerStart) malloc failure !!! \n",
0, 0, 0, 0, 0, 0);
semGive (dot1xAuthTimerMutex);
return (ERROR);
}
pDot1xAuthTimerList = &dot1xAuthTimerManager.timerListDescr[dot1xAuthTimerType];
pTimer = (DOT1X_AUTH_TIMER_NODE *) lstFirst (pDot1xAuthTimerList);
pPrevTimer = (DOT1X_AUTH_TIMER_NODE *) NULL;
pNewTimer->portNbr = dot1xAuthPortNbr;
pNewTimer->timerReason = dot1xAuthTimerReason;
SPIN_LOCK_TASK_TAKE(&timerLibTaskSpinLock);
pNewTimer->timeoutValue = dot1xAuthTimerManager.timerTick +
dot1xAuthTimerValue;
SPIN_LOCK_TASK_GIVE(&timerLibTaskSpinLock);
while (pTimer != (DOT1X_AUTH_TIMER_NODE *) NULL)
{
if (pTimer->timeoutValue > pNewTimer->timeoutValue)
break;
pPrevTimer = pTimer;
pTimer = (DOT1X_AUTH_TIMER_NODE *) lstNext ((NODE *) pTimer);
}
lstInsert (pDot1xAuthTimerList, (NODE *) pPrevTimer, (NODE *) pNewTimer);
dot1xAuthTimerDeadlineAdjust ();
semGive (dot1xAuthTimerMutex);
DOT1XLOGMSG (("dot1xAuthTimerStart - Port : 0x%x , Timer Type : %d \n",
pNewTimer->portNbr, dot1xAuthTimerType, 0, 0, 0, 0));
DOT1XLOGMSG ((" Current-Timeout Tick : %d-%d \n",
dot1xAuthTimerManager.timerTick,
pNewTimer->timeoutValue, 0, 0, 0, 0));
return (OK);
}
/*****************************************************************************
*
* dot1xAuthTimerStop - stop a timer for a port
*
* This routine stops a timer for given port nbr, for one of 5 timer types,
* for a given timer reason.
*
* RETURNS: OK or ERROR
*
* NOMANUAL
*/
STATUS dot1xAuthTimerStop
(
UINT32 dot1xAuthPortNbr, /* port number */
DOT1X_AUTH_TIMER_TYPE dot1xAuthTimerType, /* timer type */
UINT8 dot1xAuthTimerReason /* timer reason */
)
{
LIST *pDot1xAuthTimerList;
DOT1X_AUTH_TIMER_NODE *pDot1xAuthTimer;
if (dot1xAuthTimerType >= DOT1X_AUTH_TIMER_NBR)
{
logMsg ("(dot1xAuthTimerStop) Invalid Timer Type !!! \n",
0, 0, 0, 0, 0, 0);
return (ERROR);
}
if (semTake (dot1xAuthTimerMutex, WAIT_FOREVER) != OK)
return (ERROR);
DOT1XLOGMSG (("dot1xAuthTimerStop - Port : 0x%x , TimerType : %d \n",
dot1xAuthPortNbr, dot1xAuthTimerType, 0, 0, 0, 0));
pDot1xAuthTimerList = &dot1xAuthTimerManager.timerListDescr[dot1xAuthTimerType];
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *) lstFirst (pDot1xAuthTimerList);
while (pDot1xAuthTimer != (DOT1X_AUTH_TIMER_NODE *) NULL)
{
if (pDot1xAuthTimer->portNbr == dot1xAuthPortNbr &&
pDot1xAuthTimer->timerReason == dot1xAuthTimerReason)
{
lstDelete (pDot1xAuthTimerList, (NODE *) pDot1xAuthTimer);
DOT1X_AUTH_FREE ( (void *) pDot1xAuthTimer);
dot1xAuthTimerDeadlineAdjust ();
semGive (dot1xAuthTimerMutex);
return (OK);
}
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *)
lstNext ( (NODE *) pDot1xAuthTimer);
}
semGive (dot1xAuthTimerMutex);
return (OK);
}
/*****************************************************************************
*
* dot1xAuthTimerStopAll - stops all timers for a port
*
* This routine stops all timers for given port nbr.
*
* SEE ALSO :
*
* RETURNS: OK or ERROR
*
* NOMANUAL
*/
STATUS dot1xAuthTimerStopAll
(
UINT32 dot1xAuthPortNbr /* port number */
)
{
LIST *pDot1xAuthTimerList;
DOT1X_AUTH_TIMER_NODE *pDot1xAuthTimer;
UINT16 ix;
if (semTake (dot1xAuthTimerMutex, WAIT_FOREVER) != OK)
return (ERROR);
for (ix = 0; ix < DOT1X_AUTH_TIMER_NBR; ix++)
{
pDot1xAuthTimerList = &dot1xAuthTimerManager.timerListDescr[ix];
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *)
lstFirst (pDot1xAuthTimerList);
while (pDot1xAuthTimer != (DOT1X_AUTH_TIMER_NODE *) NULL)
{
if (pDot1xAuthTimer->portNbr == dot1xAuthPortNbr)
{
DOT1X_AUTH_TIMER_NODE *pDelete = pDot1xAuthTimer;;
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *)
lstNext ( (NODE *) pDot1xAuthTimer);
lstDelete (pDot1xAuthTimerList, (NODE *) pDelete);
DOT1X_AUTH_FREE ((void *) pDelete);
}
else
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *)
lstNext ( (NODE *) pDot1xAuthTimer);
}
}
dot1xAuthTimerDeadlineAdjust ();
DOT1XLOGMSG (("dot1xAuthTimerStopAll - Port : 0x%x \n",
dot1xAuthPortNbr, 0, 0, 0, 0, 0));
semGive (dot1xAuthTimerMutex);
return (OK);
}
/*****************************************************************************
*
* dot1xAuthTimerTask - timer manager task entry point
*
*
* RETURNS: N/A
*/
LOCAL void dot1xAuthTimerTask
(
)
{
ULONG firstTick;
ULONG lastTick;
ULONG delayTick;
UINT16 ix;
UINT32 newDeadline;
UINT32 deadLine;
taskDelay (dot1xAuthTimerManager.sysClkRate);
FOREVER
{
firstTick = tickGet ();
dot1xAuthTimerManager.timerTick++;
dot1xAuthTimerManager.sysClkRate = sysClkRateGet ();
dot1xAuthQtrSecond = dot1xAuthTimerManager.sysClkRate / 4;
if (semTake (dot1xAuthTimerMutex, dot1xAuthQtrSecond) == OK)
{
if (dot1xAuthTimerManager.timerDeadlineTick != DOT1X_AUTH_TIMER_NO_DEADLINE &&
dot1xAuthTimerManager.timerTick >= dot1xAuthTimerManager.timerDeadlineTick)
{
newDeadline = UINT_MAX;
for (ix = 0; ix < DOT1X_AUTH_TIMER_NBR; ix++)
{
deadLine = dot1xAuthTimerCheck (ix);
if (deadLine < newDeadline)
newDeadline = deadLine;
}
if (newDeadline == UINT_MAX)
dot1xAuthTimerManager.timerDeadlineTick = DOT1X_AUTH_TIMER_NO_DEADLINE;
else
dot1xAuthTimerManager.timerDeadlineTick = newDeadline;
DOT1XLOGMSG (("dot1xAuthTimerTask - New Deadline : %d \n",
dot1xAuthTimerManager.timerDeadlineTick,
0, 0, 0, 0, 0));
}
semGive (dot1xAuthTimerMutex);
}
SPIN_LOCK_TASK_TAKE(&timerLibTaskSpinLock);
lastTick = tickGet();
dot1xAuthTimerManager.timerTick +=
((lastTick - firstTick) / dot1xAuthTimerManager.sysClkRate);
delayTick = dot1xAuthTimerManager.sysClkRate -
((lastTick - firstTick) % dot1xAuthTimerManager.sysClkRate);
SPIN_LOCK_TASK_GIVE(&timerLibTaskSpinLock);
taskDelay (delayTick);
}
}
/*****************************************************************************
*
* dot1xAuthTimerCheck - check if a timer timed out
*
* This routine checks the running timers. If there are timed out ones,
* indicates 1X AUTH task.
*
* RETURNS: N/A
*/
LOCAL UINT32 dot1xAuthTimerCheck
(
DOT1X_AUTH_TIMER_TYPE dot1xAuthTimerType /* timer type */
)
{
LIST *pDot1xAuthTimerList;
DOT1X_AUTH_TIMER_NODE *pDot1xAuthTimerFree;
DOT1X_AUTH_TIMER_NODE *pDot1xAuthTimer;
DOT1XLOGMSG (("dot1xAuthTimerCheck - TimerType : %d \n",
dot1xAuthTimerType, 0, 0, 0, 0, 0));
pDot1xAuthTimerList = &dot1xAuthTimerManager.timerListDescr[dot1xAuthTimerType];
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *) lstFirst (pDot1xAuthTimerList);
while (pDot1xAuthTimer != (DOT1X_AUTH_TIMER_NODE *) NULL &&
pDot1xAuthTimer->timeoutValue <= dot1xAuthTimerManager.timerTick)
{
dot1xAuthTimerTimeoutSend (pDot1xAuthTimer->portNbr,
dot1xAuthTimerType,
pDot1xAuthTimer->timerReason);
pDot1xAuthTimerFree = pDot1xAuthTimer;
pDot1xAuthTimer = (DOT1X_AUTH_TIMER_NODE *)
lstNext ((NODE *) pDot1xAuthTimer);
lstDelete (pDot1xAuthTimerList, (NODE *) pDot1xAuthTimerFree);
DOT1X_AUTH_FREE ( (void *) pDot1xAuthTimerFree);
}
if (pDot1xAuthTimer != (DOT1X_AUTH_TIMER_NODE *) NULL)
return (pDot1xAuthTimer->timeoutValue);
else
return (UINT_MAX);
}
/*****************************************************************************
*
* dot1xAuthTimerDeadlineAdjust - adjust the timer deadline
*
* This routine checks the first element of different kinds of running
* timers, and sets the minumum of them as a next system timeout deadline
* value.
*
* RETURNS: N/A
*/
LOCAL void dot1xAuthTimerDeadlineAdjust
(
)
{
DOT1X_AUTH_TIMER_NODE *pTimer;
ULONG newDeadline = UINT_MAX;
UINT16 ix;
for (ix = 0; ix < DOT1X_AUTH_TIMER_NBR; ix++)
{
pTimer = (DOT1X_AUTH_TIMER_NODE *)
lstFirst (&dot1xAuthTimerManager.timerListDescr[ix]);
if (pTimer != (DOT1X_AUTH_TIMER_NODE *) NULL &&
pTimer->timeoutValue < newDeadline)
newDeadline = pTimer->timeoutValue;
}
if (newDeadline == UINT_MAX)
dot1xAuthTimerManager.timerDeadlineTick = DOT1X_AUTH_TIMER_NO_DEADLINE;
else
dot1xAuthTimerManager.timerDeadlineTick = newDeadline;
DOT1XLOGMSG (("dot1xAuthTimerDeadlineAdjust - DeadLine : %d \n",
dot1xAuthTimerManager.timerDeadlineTick, 0, 0, 0, 0, 0));
}
@@ -0,0 +1,911 @@
/* dot1xKeyLib.c - IEEE 802.1X Key Management interface file */
/*
* Copyright (c) 2005 - 2007 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01o,04apr10,kxr Coverity changes
01n,04oct07,mry Fixing WIND00106639
01m,26jun07,mry Using tickGet() instead of deprecated vxTicks
01l,21nov21,dwb Changes for ipnet porting
01k,16mar06,rjh Add NOMANUAL
01j,10may05,eja Add Base kernel tags
01i,30mar05,eja Fix DIAB warnings on MIPS64
01h,04sep03,ggg Remove warnings for diab MIPS and SH
01g,21apr03,ggg File name, location change
01f,16apr03,ggg Update des.h location
01e,16oct02,ggg Update DES path to SNMP 9.3 (vs. 9.2 previously)
01d,30jul02,ggg Update DBG_PRINT for Diab and Gnu varargs handling
01c,08jul02,ggg Undef debug by default
01b,06jun02,myz changed the name UINT64 to UINT64_S.
01a,28Feb02,myz written
*/
/*
DESCRIPTION
This library provides functions to generate keys and build the EAPOL key
packet. There are two key generation schemes provided by this library. The
first one, which is the default, is simply taking the output of the ANSI
function rand(). The second one is based on the ANSI X9.17 Key Generation.
This one requires encryption function DES. To select this scheme simply enables
the compiler switch X917_KEY_GENERATION_SCHEME in this file. This library also
provides a global hook dot1xKeyDataFunc to allow application supply with
its own key data generator if the above two schemes are not desired.
The routine should expect a single parameter, a 8 byte result buffer pointer,
which the key data should be filled into.
The key packet building routine currently only supports RC4 Key descriptor.
The Replay counter field is either filled with the NTP(Network Time Protocol)
time or a serial count value depending on the availability and selection of the
NTP time server which is determined when dot1xKeyLibInit is called.
Please refers to IEEE STD 802.1X-2001, 7.6 Key Descriptor format, Page 17 for
the description of the key packet.
\NOMANUAL
*/
#include "vxWorks.h"
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "sys/times.h"
#include "taskLib.h"
#include "tickLib.h"
#include "drv/timer/timerDev.h"
#include "dot1xWb4Lib.h"
#include "dot1xKeyLib.h"
#include "dot1xAuthSvrLib.h"
#include "dot1xMdLib.h"
#include <vsbConfig.h>
#define X917_KEY_GENERATION_SCHEME /* define to enable X9.17 key generation */
#ifdef X917_KEY_GENERATION_SCHEME
#include "dot1xDesLib.h"
#endif
#if defined(_WRS_CONFIG_DOT1X_KEY_DEBUG) && !defined(DOT1X_KEY_DEBUG)
#define DOT1X_KEY_DEBUG
#endif
#ifdef DOT1X_KEY_DEBUG
int dot1xKeyDebug = 1;
LOCAL void dbgBufPrint (UINT8 * pBuf, int len);
#define DBG_PRINT \
if (dot1xKeyDebug) \
printf
#else
#ifdef __DCC__
#define DBG_PRINT(...)
#else /* __GNUC__ (and others?) */
#define DBG_PRINT(args...)
#endif /* __DCC__*/
#define dbgBufPrint(x, y)
#endif
/*** Local defines ***/
#define USECS_PER_SECOND 1000000
#define KEY_DATA_LEN 8 /* output length of key data generator */
/* position fields starting from beginning of the packet */
#define PL_POS 2
/* position fields starting from packet key portion */
#define DT_POS 0 /* description type position */
#define KL_POS 1 /* Key length position */
#define RC_POS 3 /* Replay Counter position */
#define KI_POS 11 /* Key IV position */
#define KX_POS 27 /* Key Index position */
#define KS_POS 28 /* Key signature position */
#define KY_POS 44 /* Key position */
/*** typedefs ***/
typedef struct {
UINT32 high; /* high 32bit */
UINT32 low; /* low 32bit */
} UINT64_S;
typedef struct {
char * timeServer; /* NTP time server IP address */
UINT16 ntpPort; /* NTP Port */
FUNCPTR ntpTimeGetFunc; /* NTP time get function pointer */
UINT32 lastTick; /* vxWorks ticks at the time the NTP time is got*/
struct timeval baseTime; /* The time got from the NTP server */
} RCNT_NTP_TIME_DESC;
/*** Locals ***/
LOCAL BOOL randomSeedSetDone = FALSE;
LOCAL UINT64_S replayCnt = {0, 0};
LOCAL RCNT_NTP_TIME_DESC timeDesc = {NULL, 0, NULL, 0, {0, 0}};
LOCAL DOT1X_AUTH_REPLAY_CNT_TYPE replayCntType = DOT1X_AUTH_LOCAL_COUNTER;
#ifdef X917_KEY_GENERATION_SCHEME
LOCAL UINT8 randomKey[KEY_DATA_LEN + 4]; /* random Key */
LOCAL UINT8 keySeed[KEY_DATA_LEN]; /* random seed */
LOCAL DES_KS keySchedule; /* DES required data */
#endif
/*** Local functions ***/
LOCAL UINT32 randomNumGet (void);
LOCAL void keyDataGet (UINT8 *);
/*** globals ***/
/* Key data generation hook function. Application can overwrite with its own*/
FUNCPTR dot1xKeyDataFunc = (FUNCPTR)keyDataGet;
/****************************************************************************
*
* dot1xKeyLibInit - Initialize this library
*
* This function performs the initialization of this library through the 4 user
* supplied arguments. It mainly configures the NTP time server if used for the
* replay counter, and specifies which method(synchronisely or asynchronisely)
* to retrieve the NTP time from the remote server. If cntType is selected as
* DOT1X_AUTH_LOCAL_COUNTER, the rest of three parameters are ignored. When
* DOT1X_AUTH_SNTP_COUNTER is selected, all arguments should be properly specified.
*
* RETURNS: NONE.
*
* NOMANUAL
*/
void dot1xKeyLibInit
(
DOT1X_AUTH_REPLAY_CNT_TYPE cntType, /* what type of replay counter */
int execMode, /* NTP time get function executed in the
* same task of the caller or otherwise*/
char * pServerIpAddr, /* NTP time server IP address */
UINT16 ntpPort, /* NTP Port */
FUNCPTR ntpTimeGetFunc /* NTP time get function */
)
{
#ifdef X917_KEY_GENERATION_SCHEME
{
int i;
/* init. a default random key */
for ( i = 0; i < KEY_DATA_LEN; i++)
randomKey[i] = i;
/* init. DES key schedule */
dot1xDesKey(keySchedule, randomKey, 0);
}
#endif
if ((replayCntType = cntType) == DOT1X_AUTH_LOCAL_COUNTER)
return;
if (pServerIpAddr)
dot1xKeyNtpTimeServerSet(pServerIpAddr);
dot1xKeyNtpPortSet(ntpPort);
if (ntpTimeGetFunc)
dot1xKeyNtpTimeGetFuncSet(ntpTimeGetFunc);
/* check if using the NTP timer as the replay counter */
if (cntType == DOT1X_AUTH_SNTP_COUNTER &&
timeDesc.timeServer &&
timeDesc.ntpTimeGetFunc)
{
/* depending on execMode, either call the timeGetFunction in the same
* thread of the caller or execute it in a new thread. This is because
* the timeGetFunction may take as much as 20 seconds before it gets
* back to the caller
*/
if (execMode == DOT1X_KEY_TIME_ASYNC_MODE)
dot1xKeyNtpTimeGetAsync();
else
{
dot1xKeyNtpTimeGet();
}
}
}
/*****************************************************************************
*
* dot1xKeyNtpTimeGetAsync - Get the NTP time asynchronisely
*
* This routine spawns a task to perform the NTP time get function. It allows
* caller to return before the dot1xKeyNtpTimeGet function is done.
*
* RETURNS: NONE.
*
* NOMANUAL
*/
void dot1xKeyNtpTimeGetAsync (void)
{
TASK_ID ntpTask = taskSpawn("dot1xKeyNtpTime", 200, 0, 10 * 1024, (FUNCPTR)dot1xKeyNtpTimeGet,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
if(ntpTask == TASK_ID_ERROR)
{
printf("dot1xKeyNtpTimeGetAsync: Error spawning dot1xKeyNtpTime task");
}
}
/*****************************************************************************
*
* dot1xKeyNtpTimeGet - Get the NTP time
*
* This routine retrieves the NTP time from the remote server and stores the
* value in a static local variable.
*
* RETURNS: NONE.
*
* NOMANUAL
*/
void dot1xKeyNtpTimeGet (void)
{
/* check to see if there is a valid time server */
if (!timeDesc.timeServer)
return;
/* check if there is a valid time get function */
if (!timeDesc.ntpTimeGetFunc)
return;
if (timeDesc.ntpTimeGetFunc(timeDesc.timeServer,
timeDesc.ntpPort,
sysClkRateGet() * 20,
&timeDesc.baseTime) == OK)
{
/* get the vxTicks */
timeDesc.lastTick = tickGet();
}
}
#ifdef X917_KEY_GENERATION_SCHEME
/****************************************************************************
*
* keyDataGet - Generate a 64bit key using X9.17 Key Generation algorithm.
*
* This routine generates a 64bit key data based on the ANSI X9.17 Key
* Generation algorithm. The result is filled into the buffer passed by the
* caller.
*
* RETURNS: NONE.
*
* NOMANUAL.
*/
LOCAL void keyDataGet
(
UINT8 * pResultBuf /* point to a 8 byte buffer for storing the result*/
)
{
UINT8 desPass1Result[KEY_DATA_LEN];
UINT8 tempResult[KEY_DATA_LEN];
UINT8 timeMaterial[KEY_DATA_LEN];
int i;
UINT32 ticks;
/* compose a time material, use vxTicks + portion of random key */
ticks = tickGet();
bcopy((char *)&ticks, (char *)timeMaterial, 4);
bcopy((char *)randomKey + 4, (char *)timeMaterial + 4, 4);
/* first output from DES function */
dot1xDes(keySchedule, timeMaterial, desPass1Result);
/* DES output XOR seed */
for (i = 0; i < KEY_DATA_LEN; i++)
tempResult[i] = desPass1Result[i] ^ keySeed[i];
/* perform another DES function to generate the key*/
dot1xDes(keySchedule, tempResult, pResultBuf);
/* calculate the next seed */
for (i = 0; i < KEY_DATA_LEN; i++)
tempResult[i] = desPass1Result[i] ^ pResultBuf[i];
dot1xDes(keySchedule, tempResult, keySeed);
}
#else
/****************************************************************************
*
* keyDataGet - Generate the key data using simple random number generator.
*
* This routine uses the ANSI rand() function to generate the 64bit key.
*
* RETURNS: NONE.
*
* NOMANUAL.
*/
LOCAL void keyDataGet
(
UINT8 * pResultBuf /* point to a 8 byte buffer for storing the result*/
)
{
int i;
UINT32 randomNum;
UINT8 * pKeyData = (UINT8 *)&randomNum;
randomNum = randomNumGet();
for ( i = 0; i < sizeof(UINT32); i++)
pResultBuf[i] = pKeyData[i];
randomNum = randomNumGet();
for ( i = 0; i < sizeof(UINT32); i++)
pResultBuf[i + sizeof(UINT32)] = pKeyData[i];
}
#endif /* end #ifdef X917_KEY_GENERATION_SCHEME */
/****************************************************************************
*
* dot1xKeyRandomKeySet - Set the random Key
*
* This routine is provided to allow external functions to deliever a random
* key to this library which is needed for ANSI X9.17 Key Generation.
* As currently implemented, the session key is delivered here from the Radius
* interface.
*
* RETURNS: NONE.
*
* NOMANUAL
*/
void dot1xKeyRandomKeySet
(
UINT8 * pKey
)
{
#ifdef X917_KEY_GENERATION_SCHEME
int i;
for (i = 0; i < (KEY_DATA_LEN + 4); i++)
randomKey[i] ^= pKey[i];
dot1xDesKey(keySchedule, randomKey, 0);
#endif
}
/****************************************************************************
*
* dot1xAuthWepKeyGenerate - Generate the WEP key.
*
* This routine generates two types of WEP keys based on the passing arguments.
* If pSessionKey is specified, the generated key is part of the sessionKey.
* Otherwise, the key is produced from the output of the selected key data
* generator.
*
* RETURNS: OK or ERROR
*
* NOMANUAL
*/
STATUS dot1xAuthWepKeyGenerate
(
DOT1X_AUTH_GENERIC_KEY_DESC * pSessionKey, /* point to the session key */
DOT1X_AUTH_GENERIC_KEY_DESC * pWepkey /* place to hold the result key */
)
{
int ix;
/* safety check */
if (pWepkey->len <= 0 || pWepkey->len > 1024)
{
printf("Dot1xKey: invalid key length\n");
return ERROR;
}
/* if the session key is null, we'll generate one, otherwise
* simply use the part of the session key as the new key
*/
if (pSessionKey->pKey == NULL)
{
int i;
int numOfWords;
int remainder;
UINT8 keyData[KEY_DATA_LEN];
numOfWords = pWepkey->len/KEY_DATA_LEN;
remainder = pWepkey->len & 0x7;
/* first in KEY_DATA_LEN quantity of the key portion */
for (ix = 0; ix < numOfWords; ix++)
{
dot1xKeyDataFunc(keyData);
for (i = 0; i < KEY_DATA_LEN; i++)
pWepkey->pKey[ix*KEY_DATA_LEN + i] = keyData[i];
}
dot1xKeyDataFunc(keyData);
/* then the remainder */
for (i = 0; i < remainder; i++)
pWepkey->pKey[ix*KEY_DATA_LEN + i] = keyData[i];
DBG_PRINT("dot1xKEY: The generated WEP key:\n");
dbgBufPrint(pWepkey->pKey, pWepkey->len);
}
else
{
/* use part of the session key as the WEP key */
/* check key length */
if (pSessionKey->len < pWepkey->len)
{
printf("dot1xKEY: WEP key length > session key, reduced\n");
pWepkey->len = pSessionKey->len;
}
bcopy((char *)pSessionKey->pKey, (char *)pWepkey->pKey, pWepkey->len);
DBG_PRINT("dot1xKEY: The default WEP key:\n");
dbgBufPrint(pWepkey->pKey, pWepkey->len);
}
return OK;
}
/***************************************************************************
*
* dot1xAuthEapolKeyPacketBuild - Build a key packet
*
* This routine builds an EAPOL key packet. It expects a buffer containing the
* valid key packet header is passed into as first argument. The third argument
* contains at least one send key which has this format: DOT1X_AS_ATTR_HEADER_T +
* the key. This function currently only supports the RC4 key descriptor.
* Please refer to IEEE Std 802.1X-2001 document for the complete description of
* this packet and the algorithm it uses.
*
* RETURNS: OK or ERROR
*
* NOMANUAL
*/
STATUS dot1xAuthEapolKeyPacketBuild
(
char * pPkt, /* points to the beginning of the EAPOL packet */
UINT8 descType, /* Key descriptor type, only RC4 for now */
DOT1X_AUTH_GENERIC_KEY_DESC * pSessionKey, /* session key string */
DOT1X_AUTH_WEP_KEY_DESC * pWepKey /* the WEP key */
)
{
char * pKeyPkt = pPkt + 4;
UINT32 iv[4];
int pktLen;
DOT1X_AUTH_GENERIC_KEY_DESC pSendKey;
DOT1X_AUTH_GENERIC_KEY_DESC pRecvKey;
UINT8 md5Signature[HMAC_MD5_RESULT_LENGTH];
DOT1X_AS_ATTR_HEADER_T * pAttrHeader;
DOT1X_AUTH_GENERIC_KEY_DESC tempKey;
if ((pSessionKey->pKey == NULL) || (pSessionKey->len == 0)) {
DBG_PRINT("dot1xAuthEapolKeyPacketBuild:%s%s",
(pSessionKey->pKey ? "" : " NULL pSessionKey->pKey"),
(pSessionKey->len ? "" : " pSessionKey->len=0"));
return ERROR;
}
DBG_PRINT("dot1xKEY: Received key string length: %d\n", pSessionKey->len);
DBG_PRINT("dot1xKEY: The key string: ");
dbgBufPrint(pSessionKey->pKey, pSessionKey->len);
/* get the sendKey */
pAttrHeader = (DOT1X_AS_ATTR_HEADER_T *)(pSessionKey->pKey);
pSendKey.pKey = pSessionKey->pKey + DOT1X_AS_ATTR_HEADER_LEN;
pSendKey.len = pAttrHeader->len > 32 ? 32 : pAttrHeader->len;
/* get the Receive Key */
if (pSessionKey->len > (pSendKey.len + DOT1X_AS_ATTR_HEADER_LEN))
{
pRecvKey.pKey = pSessionKey->pKey + pSendKey.len +
2 * DOT1X_AS_ATTR_HEADER_LEN;
pAttrHeader = (DOT1X_AS_ATTR_HEADER_T *)(pSessionKey->pKey +
DOT1X_AS_ATTR_HEADER_LEN + pSendKey.len);
pRecvKey.len = pAttrHeader->len > 32 ? 32 : pAttrHeader->len;
}
else
{
pRecvKey.pKey = pSendKey.pKey;
pRecvKey.len = pSendKey.len;
}
/* according to Microsoft document: Making IEEE.11 Networks Enterprise-
* Ready, page 49, Generating the EAPOL-Key Message, the keys are used
* in this way: recvkey for the md5 signature, and IV+sendkey for the
* rc4 encryption. But testing shows this is reversed. That is:
* sendKey for the md5 signature, and IV + recvKey for the rc4 encryption.
*/
/* reverse the keys */
tempKey.pKey = pSendKey.pKey;
tempKey.len = pSendKey.len;
pSendKey.pKey = pRecvKey.pKey;
pSendKey.len = pRecvKey.len;
pRecvKey.pKey = tempKey.pKey;
pRecvKey.len = tempKey.len;
/* currently only support the type 1 key */
if (descType != 1)
return ERROR;
/* get the packet length */
pktLen = (((pPkt[PL_POS]) << 8) | pPkt[PL_POS + 1]) + 4;
/* fill in the Key type */
pKeyPkt[DT_POS] = descType;
/* fill in the Key length
* Even the Key field is empty, this field may still have a valid non-zero
* value. In this case, it tells the supplicant to use the peer key
* generated as part of the EAP authentication process with the length
* specified in this field.
*/
pKeyPkt[KL_POS] = (UINT8)(pWepKey->key.len >> 8);
pKeyPkt[KL_POS + 1] = (UINT8)pWepKey->key.len;
/* set the replay counter field */
if ((replayCntType == DOT1X_AUTH_SNTP_COUNTER) && (timeDesc.baseTime.tv_sec))
{
UINT32 timeSec;
UINT32 timeUsec;
UINT32 ticks;
UINT32 tickRate;
/* difference of the vxTicks between now and the previous time */
if (tickGet() >= timeDesc.lastTick)
ticks = tickGet() - timeDesc.lastTick;
else
{
/* vxTicks wrap around */
ticks = (UINT32)0xFFFFFFFF - timeDesc.lastTick + tickGet();
}
tickRate = sysClkRateGet();
timeSec = ticks / tickRate;
timeUsec = ((ticks % tickRate) * USECS_PER_SECOND)/tickRate;
timeSec += timeDesc.baseTime.tv_sec;
timeUsec += timeDesc.baseTime.tv_usec;
if (timeUsec >= USECS_PER_SECOND)
{
timeUsec = timeUsec - USECS_PER_SECOND;
timeSec += 1;
}
/* reset the lastTick and the time base */
timeDesc.lastTick = tickGet();
timeDesc.baseTime.tv_sec = timeSec;
timeDesc.baseTime.tv_usec = timeUsec;
pKeyPkt[RC_POS] = (UINT8)(timeSec >> 24);
pKeyPkt[RC_POS+1] = (UINT8)(timeSec >> 16);
pKeyPkt[RC_POS+2] = (UINT8)(timeSec >> 8);
pKeyPkt[RC_POS+3] = (UINT8)(timeSec);
pKeyPkt[RC_POS+4] = (UINT8)(timeUsec >> 24);
pKeyPkt[RC_POS+5] = (UINT8)(timeUsec >> 16);
pKeyPkt[RC_POS+6] = (UINT8)(timeUsec >> 8);
pKeyPkt[RC_POS+7] = (UINT8)(timeUsec);
}
else
{
/* increment the 64 bit counter */
if (replayCnt.low == (UINT32)0xFFFFFFFF)
replayCnt.high += 1;
replayCnt.low += 1;
pKeyPkt[RC_POS] = (UINT8)(replayCnt.high >> 24);
pKeyPkt[RC_POS+1] = (UINT8)(replayCnt.high >> 16);
pKeyPkt[RC_POS+2] = (UINT8)(replayCnt.high >> 8);
pKeyPkt[RC_POS+3] = (UINT8)(replayCnt.high);
pKeyPkt[RC_POS+4] = (UINT8)(replayCnt.low >> 24);
pKeyPkt[RC_POS+5] = (UINT8)(replayCnt.low >> 16);
pKeyPkt[RC_POS+6] = (UINT8)(replayCnt.low >> 8);
pKeyPkt[RC_POS+7] = (UINT8)(replayCnt.low);
}
/* generate the IV vector which is a 16 byte random number */
iv[0] = randomNumGet();
iv[1] = randomNumGet();
iv[2] = randomNumGet();
iv[3] = randomNumGet();
bcopy((char *)iv, pKeyPkt + KI_POS, 16);
/* set the key index */
pKeyPkt[KX_POS] = pWepKey->index;
/* set the initial signature field */
bzero(pKeyPkt + KS_POS, 16);
if (pWepKey->key.pKey == NULL)
{
/* the key is not presented, the supplicant will use the session key
* derived from authentication process
*/
}
else
{
UINT8 * pEncryptKey;
DOT1X_WB4_KEY wb4Key;
DBG_PRINT("dot1xKEY: the send key length: %d\n", pSendKey.len);
DBG_PRINT("dot1xKEY: The send key: ");
dbgBufPrint(pSendKey.pKey, pSendKey.len);
/* encrypt the key, the key used for encryption is IV + send key */
/* allocates a buffer to hold the key */
pEncryptKey = malloc(pSendKey.len + 16);
if (pEncryptKey == NULL)
return ERROR;
/* construct the key */
bcopy((char *)iv, (char *)pEncryptKey, 16);
bcopy((char *)pSendKey.pKey, (char *)pEncryptKey + 16, pSendKey.len);
/* set the key field */
bcopy((char *)pWepKey->key.pKey, pKeyPkt + KY_POS, pWepKey->key.len);
/* encrypt the key */
/* encryption algorithm state table initialization */
dot1xWb4KeyGen(pEncryptKey, pSendKey.len + 16, &wb4Key);
/* free the memory */
free((void *)pEncryptKey);
/* encrypt it */
dot1xWb4((UINT8 *)pKeyPkt + KY_POS, pWepKey->key.len, &wb4Key);
}
/* generate this packet's signature with HMAC-MD5 using the key generated
* by the EAP authentication(the session key).
*/
bzero((char *)md5Signature, HMAC_MD5_RESULT_LENGTH);
dot1xHmacMd5((UINT8 *)pPkt, pktLen, pRecvKey.pKey, pRecvKey.len,
md5Signature);
/* fill in the signature field */
bcopy((char *)md5Signature, pKeyPkt + KS_POS, HMAC_MD5_RESULT_LENGTH);
DBG_PRINT("dot1xKEY: The Key packet with key encrypted:\n");
dbgBufPrint((UINT8 *)pPkt, pktLen);
DBG_PRINT("dot1xKEY: The un-encrypted key: \n");
#ifdef DOT1X_KEY_DEBUG
if (pWepKey->key.pKey)
dbgBufPrint(pWepKey->key.pKey, pWepKey->key.len);
else
dbgBufPrint(pSendKey.pKey, pWepKey->key.len);
#endif
/* key packet building done */
return OK;
}
/****************************************************************************
*
* randomNumGet - Get a random number
*
* This routine produces a 32bit random number.
*
* RETURN: the 32bit random number.
*
* NOMANUAL
*/
LOCAL UINT32 randomNumGet (void)
{
UINT32 number;
if (randomSeedSetDone == FALSE)
{
srand(tickGet());
randomSeedSetDone = TRUE;
}
number = (UINT16)rand();
number <<= 16;
number |= (UINT16)rand();
return number;
}
/*****************************************************************************
*
* dot1xKeyRandomSeedSet - Set the random seed
*
* This routine is provided to allow external functions to trigger random seed
* initialization when a un-predicated user event occurs.
*
* RETURNS: NONE
*
* NOMANUAL
*/
void dot1xKeyRandomSeedSet
(
UINT8 * pData, /* un-predicated user event data */
int len /* length of the data */
)
{
UINT32 ticks = tickGet();
srand(ticks);
#ifdef X917_KEY_GENERATION_SCHEME
bcopy((char *)&ticks, (char*)keySeed, 4);
#endif
randomSeedSetDone = TRUE;
}
/****************************************************************************
*
* dot1xKeyNtpTimeGetFuncSet - Initialize the NTP time get function
*
* This routine sets the NTP time get function.
*
* RETURNS: NONE
*
* NOMANUAL
*/
void dot1xKeyNtpTimeGetFuncSet
(
FUNCPTR funcPtr
)
{
timeDesc.ntpTimeGetFunc = funcPtr;
}
/*****************************************************************************
*
* dot1xKeyNtpTimeServerSet - Set the NTP server IP address
*
* This routine sets the NTP time server IP address.
*
* RETURNS: NONE
*
* NOMANUAL
*/
void dot1xKeyNtpTimeServerSet
(
char * pServerAddr /* IP address, must be a NULL terminated string */
)
{
int len;
len = strlen(pServerAddr);
if (timeDesc.timeServer)
free(timeDesc.timeServer);
if ((timeDesc.timeServer = (char *)malloc(len + 1)) == NULL)
{
printf("dot1xKey: ERROR: Can't find the valid memory\n");
return;
}
bcopy(pServerAddr, timeDesc.timeServer, len);
timeDesc.timeServer[len] = 0;
}
/*****************************************************************************
*
* dot1xKeyNtpPortSet - Set the NTP port
*
* This routine sets the NTP time server port.
*
* RETURNS: NONE
*
* NOMANUAL
*/
void dot1xKeyNtpPortSet
(
UINT16 ntpPort /* NTP Port */
)
{
timeDesc.ntpPort = ntpPort;
}
#ifdef DOT1X_KEY_DEBUG
/***************************************************************************
*
* dbgBufPrint - Print a debug message
*
* NOMANUAL
*/
LOCAL void dbgBufPrint
(
UINT8 * pBuf,
int len
)
{
int i = 0;
if (dot1xKeyDebug)
{
printf("\n");
for (i = 0; i < len && i < 500; i++)
printf("%02x ", pBuf[i]);
printf("\n");
}
}
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,105 @@
/* dot1xDebugLib.c - 802.1X debug library */
/* Copyright 2002-2004 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01b,17mar06,rjh Update Description for documentation
01a,26sep05,eja Add support for MD5, GTC, and MSCHAPV2 debug areas
*/
/*
DESCRIPTION
This library provides a debugging routine for 802.1X.
If the driver was compiled with DOT1X_DEBUG_GLOBAL defined, then debug messages
may be printed as the driver executes. There are several different levels of
debug messages:
1 DOT1X_DEBUG_FATAL Show non-recoverable errors only
2 DOT1X_DEBUG_ERROR Show all errors affecting device operation
3 DOT1X_DEBUG_INFO Show diagnostic messages detailing device function
4 DOT1X_DEBUG_FLOOD Many diagnostic messages, often on a per-packet basis
5 DOT1X_DEBUG_NONE Do not show any debug messages
There are also several different debug areas. Each area can have the level of
messages set independently:
0 DOT1X_AREA_ALL All areas below
1 DOT1X_AREA_INIT Device initialization. Covers all of the below.
2 DOT1X_AREA_SUPP SUPP : Supplicant
3 DOT1X_AREA_AUTH AUTH : Authenticator
4 DOT1X_AREA_LEAP LEAP : EAP-LEAP
5 DOT1X_AREA_PEAP PEAP : EAP-PEAP
6 DOT1X_AREA_TLS TLS : EAP-TLS
7 DOT1X_AREA_TTLS TTLS : EAP-TTLS
8 DOT1X_AREA_MSCHAPV2 MSCHAPV2 : EAP-MSCHAP-V2
9 DOT1X_AREA_MSCHAPV2 MD5 : EAP-MD5
10 DOT1X_AREA_GTC GTC : EAP-GTC
11 DOT1X_AREA_EAPOL EAPOL : EAPOL
To change the level of messages printed, you can use the routine
dot1xDebugLevelSet(). Note that debug messages are printed on a global
basis, not per-interface.
for example, to show diagnostic messages for all areas:
-> dot1xDebugLevelSet 0, 3
*/
#include "dot1xDebugLib.h"
INT32 dot1xDebugArray[] =
{
DOT1X_DEBUG_FATAL, /* NULL area */
DOT1X_DEBUG_ERROR, /* Initialization */
DOT1X_DEBUG_ERROR, /* SUPP */
DOT1X_DEBUG_ERROR, /* AUTH */
DOT1X_DEBUG_ERROR, /* LEAP */
DOT1X_DEBUG_ERROR, /* PEAP */
DOT1X_DEBUG_ERROR, /* TLS */
DOT1X_DEBUG_ERROR, /* TTLS */
DOT1X_DEBUG_ERROR, /* MSCHAPV2 */
DOT1X_DEBUG_ERROR, /* MD5 */
DOT1X_DEBUG_ERROR, /* GTC */
DOT1X_DEBUG_ERROR /* EAPOL */
};
#define DOT1X_MAX_DEBUG_AREAS NELEMENTS(dot1xDebugArray)
/****************************************************************************
* dot1xDebugLevelSet - Sets the debug level for the specified area.
*
* This function sets the debug level for the specified area. DOT11_AREA_ALL
* is a valid area, and will set the debug level of all AREAs to the specified
* value.
*
* RETURNS: OK or ERROR
*
* ERRNO: N/A
*/
STATUS dot1xDebugLevelSet
(
int area, /* Debug area to get level for */
int level /* Debug level to set */
)
{
int i;
if(area == DOT1X_AREA_ALL)
{
for(i=1; i<DOT1X_MAX_DEBUG_AREAS; i++)
{
dot1xDebugArray[i] = level;
}
}
else if(area >= DOT1X_MAX_DEBUG_AREAS)
{
return(ERROR);
}
else
{
dot1xDebugArray[area] = level;
}
return(OK);
}
@@ -0,0 +1,501 @@
/* dot1xDesLib.c - 802.1X DES library */
/*
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,16mar06,rjh Add NOMANUAL
01b,19jun03,ggg Make certain globals static or remove altogether
01a,21apr03,ggg written
*/
/*
DESCRIPTION
This library contains routines for perfoming DES en/decryption needed for
802.1X.
INCLUDE FILES: dot1xDesLib.h
\NOMANUAL
*/
/*
* this DES implementation derived from Phil Karn's public domain DES.
*/
#include "vxWorks.h"
#include "string.h"
#include "dot1xDesLib.h"
LOCAL ULONG Spbox[8][64] =
{
{
0x01010400L,0x00000000L,0x00010000L,0x01010404L,
0x01010004L,0x00010404L,0x00000004L,0x00010000L,
0x00000400L,0x01010400L,0x01010404L,0x00000400L,
0x01000404L,0x01010004L,0x01000000L,0x00000004L,
0x00000404L,0x01000400L,0x01000400L,0x00010400L,
0x00010400L,0x01010000L,0x01010000L,0x01000404L,
0x00010004L,0x01000004L,0x01000004L,0x00010004L,
0x00000000L,0x00000404L,0x00010404L,0x01000000L,
0x00010000L,0x01010404L,0x00000004L,0x01010000L,
0x01010400L,0x01000000L,0x01000000L,0x00000400L,
0x01010004L,0x00010000L,0x00010400L,0x01000004L,
0x00000400L,0x00000004L,0x01000404L,0x00010404L,
0x01010404L,0x00010004L,0x01010000L,0x01000404L,
0x01000004L,0x00000404L,0x00010404L,0x01010400L,
0x00000404L,0x01000400L,0x01000400L,0x00000000L,
0x00010004L,0x00010400L,0x00000000L,0x01010004L
}, {
0x80108020L,0x80008000L,0x00008000L,0x00108020L,
0x00100000L,0x00000020L,0x80100020L,0x80008020L,
0x80000020L,0x80108020L,0x80108000L,0x80000000L,
0x80008000L,0x00100000L,0x00000020L,0x80100020L,
0x00108000L,0x00100020L,0x80008020L,0x00000000L,
0x80000000L,0x00008000L,0x00108020L,0x80100000L,
0x00100020L,0x80000020L,0x00000000L,0x00108000L,
0x00008020L,0x80108000L,0x80100000L,0x00008020L,
0x00000000L,0x00108020L,0x80100020L,0x00100000L,
0x80008020L,0x80100000L,0x80108000L,0x00008000L,
0x80100000L,0x80008000L,0x00000020L,0x80108020L,
0x00108020L,0x00000020L,0x00008000L,0x80000000L,
0x00008020L,0x80108000L,0x00100000L,0x80000020L,
0x00100020L,0x80008020L,0x80000020L,0x00100020L,
0x00108000L,0x00000000L,0x80008000L,0x00008020L,
0x80000000L,0x80100020L,0x80108020L,0x00108000L
}, {
0x00000208L,0x08020200L,0x00000000L,0x08020008L,
0x08000200L,0x00000000L,0x00020208L,0x08000200L,
0x00020008L,0x08000008L,0x08000008L,0x00020000L,
0x08020208L,0x00020008L,0x08020000L,0x00000208L,
0x08000000L,0x00000008L,0x08020200L,0x00000200L,
0x00020200L,0x08020000L,0x08020008L,0x00020208L,
0x08000208L,0x00020200L,0x00020000L,0x08000208L,
0x00000008L,0x08020208L,0x00000200L,0x08000000L,
0x08020200L,0x08000000L,0x00020008L,0x00000208L,
0x00020000L,0x08020200L,0x08000200L,0x00000000L,
0x00000200L,0x00020008L,0x08020208L,0x08000200L,
0x08000008L,0x00000200L,0x00000000L,0x08020008L,
0x08000208L,0x00020000L,0x08000000L,0x08020208L,
0x00000008L,0x00020208L,0x00020200L,0x08000008L,
0x08020000L,0x08000208L,0x00000208L,0x08020000L,
0x00020208L,0x00000008L,0x08020008L,0x00020200L
}, {
0x00802001L,0x00002081L,0x00002081L,0x00000080L,
0x00802080L,0x00800081L,0x00800001L,0x00002001L,
0x00000000L,0x00802000L,0x00802000L,0x00802081L,
0x00000081L,0x00000000L,0x00800080L,0x00800001L,
0x00000001L,0x00002000L,0x00800000L,0x00802001L,
0x00000080L,0x00800000L,0x00002001L,0x00002080L,
0x00800081L,0x00000001L,0x00002080L,0x00800080L,
0x00002000L,0x00802080L,0x00802081L,0x00000081L,
0x00800080L,0x00800001L,0x00802000L,0x00802081L,
0x00000081L,0x00000000L,0x00000000L,0x00802000L,
0x00002080L,0x00800080L,0x00800081L,0x00000001L,
0x00802001L,0x00002081L,0x00002081L,0x00000080L,
0x00802081L,0x00000081L,0x00000001L,0x00002000L,
0x00800001L,0x00002001L,0x00802080L,0x00800081L,
0x00002001L,0x00002080L,0x00800000L,0x00802001L,
0x00000080L,0x00800000L,0x00002000L,0x00802080L
}, {
0x00000100L,0x02080100L,0x02080000L,0x42000100L,
0x00080000L,0x00000100L,0x40000000L,0x02080000L,
0x40080100L,0x00080000L,0x02000100L,0x40080100L,
0x42000100L,0x42080000L,0x00080100L,0x40000000L,
0x02000000L,0x40080000L,0x40080000L,0x00000000L,
0x40000100L,0x42080100L,0x42080100L,0x02000100L,
0x42080000L,0x40000100L,0x00000000L,0x42000000L,
0x02080100L,0x02000000L,0x42000000L,0x00080100L,
0x00080000L,0x42000100L,0x00000100L,0x02000000L,
0x40000000L,0x02080000L,0x42000100L,0x40080100L,
0x02000100L,0x40000000L,0x42080000L,0x02080100L,
0x40080100L,0x00000100L,0x02000000L,0x42080000L,
0x42080100L,0x00080100L,0x42000000L,0x42080100L,
0x02080000L,0x00000000L,0x40080000L,0x42000000L,
0x00080100L,0x02000100L,0x40000100L,0x00080000L,
0x00000000L,0x40080000L,0x02080100L,0x40000100L
}, {
0x20000010L,0x20400000L,0x00004000L,0x20404010L,
0x20400000L,0x00000010L,0x20404010L,0x00400000L,
0x20004000L,0x00404010L,0x00400000L,0x20000010L,
0x00400010L,0x20004000L,0x20000000L,0x00004010L,
0x00000000L,0x00400010L,0x20004010L,0x00004000L,
0x00404000L,0x20004010L,0x00000010L,0x20400010L,
0x20400010L,0x00000000L,0x00404010L,0x20404000L,
0x00004010L,0x00404000L,0x20404000L,0x20000000L,
0x20004000L,0x00000010L,0x20400010L,0x00404000L,
0x20404010L,0x00400000L,0x00004010L,0x20000010L,
0x00400000L,0x20004000L,0x20000000L,0x00004010L,
0x20000010L,0x20404010L,0x00404000L,0x20400000L,
0x00404010L,0x20404000L,0x00000000L,0x20400010L,
0x00000010L,0x00004000L,0x20400000L,0x00404010L,
0x00004000L,0x00400010L,0x20004010L,0x00000000L,
0x20404000L,0x20000000L,0x00400010L,0x20004010L
}, {
0x00200000L,0x04200002L,0x04000802L,0x00000000L,
0x00000800L,0x04000802L,0x00200802L,0x04200800L,
0x04200802L,0x00200000L,0x00000000L,0x04000002L,
0x00000002L,0x04000000L,0x04200002L,0x00000802L,
0x04000800L,0x00200802L,0x00200002L,0x04000800L,
0x04000002L,0x04200000L,0x04200800L,0x00200002L,
0x04200000L,0x00000800L,0x00000802L,0x04200802L,
0x00200800L,0x00000002L,0x04000000L,0x00200800L,
0x04000000L,0x00200800L,0x00200000L,0x04000802L,
0x04000802L,0x04200002L,0x04200002L,0x00000002L,
0x00200002L,0x04000000L,0x04000800L,0x00200000L,
0x04200800L,0x00000802L,0x00200802L,0x04200800L,
0x00000802L,0x04000002L,0x04200802L,0x04200000L,
0x00200800L,0x00000000L,0x00000002L,0x04200802L,
0x00000000L,0x00200802L,0x04200000L,0x00000800L,
0x04000002L,0x04000800L,0x00000800L,0x00200002L
}, {
0x10001040L,0x00001000L,0x00040000L,0x10041040L,
0x10000000L,0x10001040L,0x00000040L,0x10000000L,
0x00040040L,0x10040000L,0x10041040L,0x00041000L,
0x10041000L,0x00041040L,0x00001000L,0x00000040L,
0x10040000L,0x10000040L,0x10001000L,0x00001040L,
0x00041000L,0x00040040L,0x10040040L,0x10041000L,
0x00001040L,0x00000000L,0x00000000L,0x10040040L,
0x10000040L,0x10001000L,0x00041040L,0x00040000L,
0x00041040L,0x00040000L,0x10041000L,0x00001000L,
0x00000040L,0x10040040L,0x00001000L,0x00041040L,
0x10001000L,0x00000040L,0x10000040L,0x10040000L,
0x10040040L,0x10000000L,0x00040000L,0x10001040L,
0x00000000L,0x10041040L,0x00040040L,0x10000040L,
0x10040000L,0x10001000L,0x10001040L,0x00000000L,
0x10041040L,0x00041000L,0x00041000L,0x00001040L,
0x00001040L,0x00040040L,0x10000000L,0x10041000L
}
};
/*
* Portable C code to create DES key schedules from user-provided keys
*/
/* Key schedule-related tables from FIPS-46 */
/* permuted choice table (key) */
LOCAL UCHAR pc1[] = {
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4
};
/* number left rotations of pc1 */
LOCAL UCHAR totrot[] = {
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28
};
/* permuted choice key (table) */
LOCAL UCHAR pc2[] = {
14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32
};
/* End of DES-defined tables */
/* bit 0 is left-most in byte */
LOCAL short bytebit[] = {
0200,0100,040,020,010,04,02,01
};
/* Generate key schedule for encryption or decryption
* depending on the value of "decrypt"
*/
void dot1xDesKey
(
DES_KS k,
UCHAR *key,
int decrypt /* 0 = encrypt, 1 = decrypt */
)
{
UCHAR pc1m[56]; /* place to modify pc1 into */
UCHAR pcr[56]; /* place to rotate pc1 into */
register int i,j,l;
int m;
UCHAR ks[8];
for (j=0; j<56; j++) /* convert pc1 to bits of key */
{
l = pc1[j] - 1; /* integer bit location */
m = l & 07; /* find bit */
/* find which key byte l is in */
/* and which bit of that byte and store 1-bit result */
pc1m[j] = (key[l>>3] & bytebit[m]) ? 1 : 0;
}
for (i=0; i<16; i++) /* key chunk for each iteration */
{
memset(ks, 0, sizeof(ks)); /* Clear key schedule */
for (j=0; j<56; j++) /* rotate pc1 the right amount */
pcr[j] = pc1m[(l = j + totrot[decrypt? 15-i : i])
< (j < 28 ? 28 : 56) ? l: l-28];
/* rotate left and right halves independently */
for (j=0; j<48; j++) /* select bits individually */
{
/* check bit that goes to ks[j] */
if (pcr[pc2[j]-1])
{
/* mask it in if it's there */
l= j % 6;
ks[j/6] |= bytebit[l] >> 2;
}
}
/* Now convert to packed odd/even interleaved form */
k[i][0] = ((long)ks[0] << 24) | ((long)ks[2] << 16) |
((long)ks[4] << 8) | ((long)ks[6]);
k[i][1] = ((long)ks[1] << 24) | ((long)ks[3] << 16) |
((long)ks[5] << 8) | ((long)ks[7]);
}
}
/* Tables defined in the Data Encryption Standard documents
* Three of these tables, the initial permutation, the final
* permutation and the expansion operator, are regular enough that
* for speed, we hard-code them. They're here for reference only.
* Also, the S and P boxes are used by a separate program, gensp.c,
* to build the combined SP box, Spbox[]. They're also here just
* for reference.
*/
#if 0
/* initial permutation IP */
LOCAL UCHAR ip[] = {
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7
};
/* final permutation IP^-1 */
LOCAL UCHAR fp[] = {
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25
};
/* expansion operation matrix */
LOCAL UCHAR ei[] = {
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1
};
/* The (in)famous S-boxes */
LOCAL UCHAR sbox[8][64] = {
/* S1 */
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,
/* S2 */
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,
/* S3 */
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,
/* S4 */
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,
/* S5 */
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,
/* S6 */
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,
/* S7 */
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,
/* S8 */
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
};
/* 32-bit permutation function P used on the output of the S-boxes */
LOCAL UCHAR p32i[] = {
16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25
};
#endif /* 0 */
/* Primitive function F.
* Input is r, subkey array in keys, output is XORed into l.
* Each round consumes eight 6-bit subkeys, one for
* each of the 8 S-boxes, 2 longs for each round.
* Each long contains four 6-bit subkeys, each taking up a byte.
* The first long contains, from high to low end, the subkeys for
* S-boxes 1, 3, 5 & 7; the second contains the subkeys for S-boxes
* 2, 4, 6 & 8 (using the origin-1 S-box numbering in the standard,
* not the origin-0 numbering used elsewhere in this code)
* See comments elsewhere about the pre-rotated values of r and Spbox.
*/
#define F(l,r,key){\
work = ((r >> 4) | (r << 28));\
work = work ^ (key [0]);\
l ^= Spbox[6][(int) (work & 0x3f)];\
l ^= Spbox[4][(int) ((work >> 8) & 0x3f)];\
l ^= Spbox[2][(int) ((work >> 16) & 0x3f)];\
l ^= Spbox[0][(int) ((work >> 24) & 0x3f)];\
work = r ^ key[1];\
l ^= Spbox[7][(int) (work & 0x3f)];\
l ^= Spbox[5][(int) ((work >> 8) & 0x3f)];\
l ^= Spbox[3][(int) ((work >> 16) & 0x3f)];\
l ^= Spbox[1][(int) ((work >> 24) & 0x3f)];\
}
/* Encrypt or decrypt a block of data in ECB mode */
void dot1xDes
(
DES_KS ks,
UCHAR * block,
UCHAR * out
)
{
ULONG left,right,work;
/* Read input block and place in left/right in big-endian order */
left = ((ULONG)block[0] << 24) | ((ULONG)block[1] << 16) |
((ULONG)block[2] << 8) | (ULONG)block[3];
right = ((ULONG)block[4] << 24) | ((ULONG)block[5] << 16) |
((ULONG)block[6] << 8) | (ULONG)block[7];
/* Hoey's clever initial permutation algorithm, from Outerbridge
* (see Schneier p 478)
*
* The convention here is the same as Outerbridge: rotate each
* register left by 1 bit, i.e., so that "left" contains permuted
* input bits 2, 3, 4, ... 1 and "right" contains 33, 34, 35, ... 32
* (using origin-1 numbering as in the FIPS). This allows us to avoid
* one of the two rotates that would otherwise be required in each of
* the 16 rounds.
*/
work = ((left >> 4) ^ right) & 0x0f0f0f0fL;
right ^= work;
left ^= work << 4;
work = ((left >> 16) ^ right) & 0xffff;
right ^= work;
left ^= work << 16;
work = ((right >> 2) ^ left) & 0x33333333L;
left ^= work;
right ^= (work << 2);
work = ((right >> 8) ^ left) & 0xff00ffL;
left ^= work;
right ^= (work << 8);
right = (right << 1) | (right >> 31);
work = (left ^ right) & 0xaaaaaaaaL;
left ^= work;
right ^= work;
left = (left << 1) | (left >> 31);
/* Now do the 16 rounds */
F(left,right,ks[0]);
F(right,left,ks[1]);
F(left,right,ks[2]);
F(right,left,ks[3]);
F(left,right,ks[4]);
F(right,left,ks[5]);
F(left,right,ks[6]);
F(right,left,ks[7]);
F(left,right,ks[8]);
F(right,left,ks[9]);
F(left,right,ks[10]);
F(right,left,ks[11]);
F(left,right,ks[12]);
F(right,left,ks[13]);
F(left,right,ks[14]);
F(right,left,ks[15]);
/* Inverse permutation, also from Hoey via Outerbridge and Schneier */
right = (right << 31) | (right >> 1);
work = (left ^ right) & 0xaaaaaaaaL;
left ^= work;
right ^= work;
left = (left >> 1) | (left << 31);
work = ((left >> 8) ^ right) & 0xff00ffL;
right ^= work;
left ^= work << 8;
work = ((left >> 2) ^ right) & 0x33333333L;
right ^= work;
left ^= work << 2;
work = ((right >> 16) ^ left) & 0xffff;
left ^= work;
right ^= work << 16;
work = ((right >> 4) ^ left) & 0x0f0f0f0fL;
left ^= work;
right ^= work << 4;
/* Put the block back into the user's buffer with final swap */
out [0] = (UCHAR) (right >> 24);
out [1] = (UCHAR) (right >> 16);
out [2] = (UCHAR) (right >> 8);
out [3] = (UCHAR) (right);
out [4] = (UCHAR) (left >> 24);
out [5] = (UCHAR) (left >> 16);
out [6] = (UCHAR) (left >> 8);
out [7] = (UCHAR) (left);
}
@@ -0,0 +1,764 @@
/* dot1xMdLib.c - 802.1X message digest library */
/*
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01d,16mar06,rjh Add NOMANUAL
01c,04sep03,ggg Remove warnings for diab MIPS and SH
01b,23apr03,ggg Add LOCAL to MD5_PADDING
01a,21apr03,ggg written
*/
/*
DESCRIPTION
This library contains routines for perfoming message digest functions
needed for 802.1X: MD4, MD5, and HMAC-MD5.
INCLUDE FILES: dot1xMdLib.h
\NOROUTINES
\NOMANUAL
*/
/*
Code within this module is derived from the example appendices to RFCs
1320 (MD4) and 1321 (MD5).
MD.C - RSA Data Security, Inc., MD4 and MD5 message-digest algorithms
Copyright (C) 1991-2, RSA Data Security, Inc.
Created 1991. All rights reserved.
License to copy and use this software is granted provided that it is
identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm"
in all material mentioning or referencing this software or this function.
License is also granted to make and use derivative works provided that
such works are identified as "derived from the RSA Data Security, Inc. MD5
Message-Digest Algorithm" in all material mentioning or referencing the
derived work.
RSA Data Security, Inc. makes no representations concerning either the
merchantability of this software or the suitability of this software
for any particular purpose. It is provided "as is" without express or
implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
#include "vxWorks.h"
#include "string.h"
/* ROTATE_LEFT rotates x left n bits. */
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* MD4 transform definitions appear here ...*/
/* Constants for MD4Transform routine.*/
#define MD4_S11 3
#define MD4_S12 7
#define MD4_S13 11
#define MD4_S14 19
#define MD4_S21 3
#define MD4_S22 5
#define MD4_S23 9
#define MD4_S24 13
#define MD4_S31 3
#define MD4_S32 9
#define MD4_S33 11
#define MD4_S34 15
/* F, G, and H are basic MD4 functions. */
#define MD4_F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define MD4_G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define MD4_H(x, y, z) ((x) ^ (y) ^ (z))
/* FF, GG, and HH transformations for rounds 1, 2, and 3. Rotation is separate from addition to prevent recomputation. */
#define MD4_FF(a, b, c, d, x, s) { \
(a) += MD4_F ((b), (c), (d)) + (x); \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define MD4_GG(a, b, c, d, x, s) { \
(a) += MD4_G ((b), (c), (d)) + (x) + (unsigned long)0x5a827999; \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define MD4_HH(a, b, c, d, x, s) { \
(a) += MD4_H ((b), (c), (d)) + (x) + (unsigned long)0x6ed9eba1; \
(a) = ROTATE_LEFT ((a), (s)); \
}
/* MD5 transform definitions appear here ...*/
/* Constants for MD5Transform routine.*/
#define MD5_S11 7
#define MD5_S12 12
#define MD5_S13 17
#define MD5_S14 22
#define MD5_S21 5
#define MD5_S22 9
#define MD5_S23 14
#define MD5_S24 20
#define MD5_S31 4
#define MD5_S32 11
#define MD5_S33 16
#define MD5_S34 23
#define MD5_S41 6
#define MD5_S42 10
#define MD5_S43 15
#define MD5_S44 21
/* F, G, H and I are basic MD5 functions. */
#define MD5_F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define MD5_G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define MD5_H(x, y, z) ((x) ^ (y) ^ (z))
#define MD5_I(x, y, z) ((y) ^ ((x) | (~z)))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */
#define MD5_FF(a, b, c, d, x, s, ac) { \
(a) += MD5_F ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define MD5_GG(a, b, c, d, x, s, ac) { \
(a) += MD5_G ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define MD5_HH(a, b, c, d, x, s, ac) { \
(a) += MD5_H ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define MD5_II(a, b, c, d, x, s, ac) { \
(a) += MD5_I ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
typedef enum
{
MD4 = 0x04,
MD5 = 0x05
} MD_ALGORITHM;
LOCAL unsigned char MD5_PADDING[64] =
{ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/* ROTATE_LEFT rotates x left n bits. */
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* MD4 transform definitions appear here ...*/
/* Constants for MD4Transform routine.*/
#define MD4_S11 3
#define MD4_S12 7
#define MD4_S13 11
#define MD4_S14 19
#define MD4_S21 3
#define MD4_S22 5
#define MD4_S23 9
#define MD4_S24 13
#define MD4_S31 3
#define MD4_S32 9
#define MD4_S33 11
#define MD4_S34 15
/* F, G, and H are basic MD4 functions. */
#define MD4_F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define MD4_G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define MD4_H(x, y, z) ((x) ^ (y) ^ (z))
/* FF, GG, and HH transformations for rounds 1, 2, and 3. Rotation is separate from addition to prevent recomputation. */
#define MD4_FF(a, b, c, d, x, s) { \
(a) += MD4_F ((b), (c), (d)) + (x); \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define MD4_GG(a, b, c, d, x, s) { \
(a) += MD4_G ((b), (c), (d)) + (x) + (unsigned long)0x5a827999; \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define MD4_HH(a, b, c, d, x, s) { \
(a) += MD4_H ((b), (c), (d)) + (x) + (unsigned long)0x6ed9eba1; \
(a) = ROTATE_LEFT ((a), (s)); \
}
/* MD5 transform definitions appear here ...*/
/* Constants for MD5Transform routine.*/
#define MD5_S11 7
#define MD5_S12 12
#define MD5_S13 17
#define MD5_S14 22
#define MD5_S21 5
#define MD5_S22 9
#define MD5_S23 14
#define MD5_S24 20
#define MD5_S31 4
#define MD5_S32 11
#define MD5_S33 16
#define MD5_S34 23
#define MD5_S41 6
#define MD5_S42 10
#define MD5_S43 15
#define MD5_S44 21
/* F, G, H and I are basic MD5 functions. */
#define MD5_F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define MD5_G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define MD5_H(x, y, z) ((x) ^ (y) ^ (z))
#define MD5_I(x, y, z) ((y) ^ ((x) | (~z)))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */
#define MD5_FF(a, b, c, d, x, s, ac) { \
(a) += MD5_F ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define MD5_GG(a, b, c, d, x, s, ac) { \
(a) += MD5_G ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define MD5_HH(a, b, c, d, x, s, ac) { \
(a) += MD5_H ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define MD5_II(a, b, c, d, x, s, ac) { \
(a) += MD5_I ((b), (c), (d)) + (x) + (unsigned long)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
typedef struct
{
unsigned long state[4]; /* state (ABCD) */
unsigned long count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD_CONTEXT;
LOCAL void MD_init (MD_CONTEXT *sptr_context);
LOCAL void MD_update (MD_CONTEXT *sptr_context, unsigned char * input,
unsigned long inputLen, MD_ALGORITHM algorithm);
LOCAL void MD_final (unsigned char * bptr_digest, MD_CONTEXT *sptr_context,
MD_ALGORITHM algorithm);
LOCAL void MD4_transform (unsigned long state[4], unsigned char block[64]);
LOCAL void MD5_transform (unsigned long state[4], unsigned char block[64]);
LOCAL void MD_encode (unsigned char * bptr_output, unsigned long *ulptr_input,
unsigned long length);
LOCAL void MD_decode (unsigned long *ulptr_output, unsigned char * bptr_input,
unsigned long length);
/*******************************************************************************
*
* dot1xMd - Generates a message digest
*
* This routine generates a message digest of the passed in buffer of the
* specified type of MD4 or MD5.
*
* RETURNS: N/A
*
*/
void dot1xMd
(
unsigned char * bptr_string, /* buffer to take digest of */
unsigned long length, /* length of buffer to digest */
unsigned char * bptr_digest, /* where output digest is stored */
MD_ALGORITHM algorithm /* digest algorithm: MD4 or MD5 */
)
{
MD_CONTEXT sptr_context;
if (bptr_digest == NULL)
{
return;
}
if (length == 0x00000000L)
{
length = strlen ((const char *)bptr_string);
}
#ifdef OPENSSL_FIPS
/* MD5 cannot be used */
if (FIPS_mode())
{
/* Authentication failed. */
printf("dot1x: MD5 is not supported when FIPS mode is enabled!");
return;
}
#endif
MD_init (&sptr_context);
MD_update (&sptr_context, bptr_string, length, algorithm);
MD_final (bptr_digest, &sptr_context, algorithm);
}
/*******************************************************************************
*
* dot1xHmacMd5 - Generates an HMAC-MD5 hash for message authentication
*
* This routine generates an HMAC-MD5 hash for message authentication using
* the passed input data and key and lengths.
*
* RETURNS: N/A
*
*/
void dot1xHmacMd5
(
unsigned char * text, /* pointer to data stream */
int text_len, /* length of data stream */
unsigned char * key, /* pointer to authentication key */
int key_len, /* length of authentication key */
unsigned char * digest /* caller digest to be filled in */
)
{
MD_CONTEXT context;
unsigned char k_ipad[65]; /* inner padding - key XORd with ipad */
unsigned char k_opad[65]; /* outer padding - key XORd with opad */
unsigned char tk[16];
int i;
#ifdef OPENSSL_FIPS
/* MD5 cannot be used */
if (FIPS_mode())
{
/* Authentication failed. */
printf("dot1x: MD5 is not supported when FIPS mode is enabled!");
return;
}
#endif
/* if key is longer than 64 bytes reset it to key=MD5(key) */
if (key_len > 64)
{
MD_CONTEXT tctx;
MD_init(&tctx);
MD_update(&tctx, key, key_len, MD5);
MD_final(tk, &tctx, MD5);
key = tk;
key_len = 16;
}
/*
* the HMAC_MD5 transform looks like:
*
* MD5(K XOR opad, MD5(K XOR ipad, text))
*
* where K is an n byte key
* ipad is the byte 0x36 repeated 64 times
* opad is the byte 0x5c repeated 64 times
* and text is the data being protected
*/
/* start out by storing key in pads */
bzero( (char *)k_ipad, sizeof k_ipad);
bzero( (char *)k_opad, sizeof k_opad);
bcopy( (char *)key, (char *)k_ipad, key_len);
bcopy( (char *)key, (char *)k_opad, key_len);
/* XOR key with ipad and opad values */
for (i=0; i<64; i++)
{
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
/* perform inner MD5 */
MD_init(&context); /* init context for 1st pass */
MD_update(&context, k_ipad, 64, MD5); /* start with inner pad */
MD_update(&context, text, text_len, MD5); /* then text of datagram */
MD_final(digest, &context, MD5); /* finish up 1st pass */
/* perform outer MD5 */
MD_init(&context); /* init context for 2nd pass */
MD_update(&context, k_opad, 64, MD5); /* start with outer pad */
MD_update(&context, digest, 16, MD5); /* then results of 1st hash */
MD_final(digest, &context, MD5); /* finish up 2nd pass */
}
/*****************************************************************************/
/* MD initialization. Begins an MD operation, writing a new sptr_context. */
/*****************************************************************************/
LOCAL void MD_init
(
MD_CONTEXT * sptr_context
)
{
sptr_context->count[0] = 0x00000000L;
sptr_context->count[1] = 0x00000000L;
/* Load magic initialization constants.*/
sptr_context->state[0] = 0x67452301;
sptr_context->state[1] = 0xefcdab89;
sptr_context->state[2] = 0x98badcfe;
sptr_context->state[3] = 0x10325476;
}
/* MD block update operation. Continues an MD message-digest operation, */
/* processing another message block, and updating the sptr_context. */
LOCAL void MD_update
(
MD_CONTEXT * sptr_context,
unsigned char * bptr_input,
unsigned long input_length,
MD_ALGORITHM algorithm
)
/* sptr_context, input block and length of input block and algorithm to use */
{
unsigned long i;
unsigned long index;
unsigned long part_length;
i = 0x00000000L;
/* Compute number of bytes mod 64 */
index = (unsigned long)((sptr_context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((sptr_context->count[0] += ((unsigned long)input_length << 3))
< ((unsigned long)input_length << 3))
{
sptr_context->count[1]++;
}
sptr_context->count[1] += ((unsigned long)input_length >> 29);
part_length = 64 - index;
/* Transform as many times as possible.*/
if (input_length >= part_length)
{
memcpy ((void *)&sptr_context->buffer[index],
(void *)bptr_input, (size_t)part_length);
switch (algorithm)
{
case MD4:
MD4_transform (sptr_context->state, sptr_context->buffer);
for (i = part_length; (i + 63) < input_length; i += 64)
{
MD4_transform (sptr_context->state, &bptr_input[i]);
}
break;
case MD5:
MD5_transform (sptr_context->state, sptr_context->buffer);
for (i = part_length; (i + 63) < input_length; i += 64)
{
MD5_transform (sptr_context->state, &bptr_input[i]);
}
break;
default:
/* error print */
break;
}
index = 0x00000000L;
}
else
{
i = 0x00000000L;
}
/* Buffer remaining input */
memcpy ((void *)&sptr_context->buffer[index], (void *)&bptr_input[i],
(size_t)(input_length-i));
}
/* MD finalization. Ends an MD5 message-digest operation, writing the message digest and zeroizing the sptr_context. */
LOCAL void MD_final
(
unsigned char * bptr_digest,
MD_CONTEXT * sptr_context,
MD_ALGORITHM algorithm
)
{
unsigned char bits[8];
unsigned long index;
unsigned long padding_length;
/* Save number of bits */
MD_encode (bits, sptr_context->count, 8);
/* Pad out to 56 mod 64.*/
index = (unsigned long)((sptr_context->count[0] >> 3) & 0x3f);
padding_length = (index < 56) ? (56 - index) : (120 - index);
MD_update (sptr_context, MD5_PADDING, padding_length, algorithm);
/* Append length (before padding) */
MD_update (sptr_context, bits, 8, algorithm);
/* Store state in digest */
MD_encode (bptr_digest, sptr_context->state, 16);
/* Zeroize sensitive information.*/
memset ((void *)sptr_context, 0, sizeof (*sptr_context));
}
/**********************************************************************/
/* MD4 Basic transform. Transforms state based on block. */
/**********************************************************************/
LOCAL void MD4_transform
(
unsigned long state[4],
unsigned char block[64]
)
{
unsigned long a = state[0];
unsigned long b = state[1];
unsigned long c = state[2];
unsigned long d = state[3];
unsigned long x[16];
MD_decode (x, block, 64);
/* Round 1 */
MD4_FF (a, b, c, d, x[ 0], MD4_S11); /* 1 */
MD4_FF (d, a, b, c, x[ 1], MD4_S12); /* 2 */
MD4_FF (c, d, a, b, x[ 2], MD4_S13); /* 3 */
MD4_FF (b, c, d, a, x[ 3], MD4_S14); /* 4 */
MD4_FF (a, b, c, d, x[ 4], MD4_S11); /* 5 */
MD4_FF (d, a, b, c, x[ 5], MD4_S12); /* 6 */
MD4_FF (c, d, a, b, x[ 6], MD4_S13); /* 7 */
MD4_FF (b, c, d, a, x[ 7], MD4_S14); /* 8 */
MD4_FF (a, b, c, d, x[ 8], MD4_S11); /* 9 */
MD4_FF (d, a, b, c, x[ 9], MD4_S12); /* 10 */
MD4_FF (c, d, a, b, x[10], MD4_S13); /* 11 */
MD4_FF (b, c, d, a, x[11], MD4_S14); /* 12 */
MD4_FF (a, b, c, d, x[12], MD4_S11); /* 13 */
MD4_FF (d, a, b, c, x[13], MD4_S12); /* 14 */
MD4_FF (c, d, a, b, x[14], MD4_S13); /* 15 */
MD4_FF (b, c, d, a, x[15], MD4_S14); /* 16 */
/* Round 2 */
MD4_GG (a, b, c, d, x[ 0], MD4_S21); /* 17 */
MD4_GG (d, a, b, c, x[ 4], MD4_S22); /* 18 */
MD4_GG (c, d, a, b, x[ 8], MD4_S23); /* 19 */
MD4_GG (b, c, d, a, x[12], MD4_S24); /* 20 */
MD4_GG (a, b, c, d, x[ 1], MD4_S21); /* 21 */
MD4_GG (d, a, b, c, x[ 5], MD4_S22); /* 22 */
MD4_GG (c, d, a, b, x[ 9], MD4_S23); /* 23 */
MD4_GG (b, c, d, a, x[13], MD4_S24); /* 24 */
MD4_GG (a, b, c, d, x[ 2], MD4_S21); /* 25 */
MD4_GG (d, a, b, c, x[ 6], MD4_S22); /* 26 */
MD4_GG (c, d, a, b, x[10], MD4_S23); /* 27 */
MD4_GG (b, c, d, a, x[14], MD4_S24); /* 28 */
MD4_GG (a, b, c, d, x[ 3], MD4_S21); /* 29 */
MD4_GG (d, a, b, c, x[ 7], MD4_S22); /* 30 */
MD4_GG (c, d, a, b, x[11], MD4_S23); /* 31 */
MD4_GG (b, c, d, a, x[15], MD4_S24); /* 32 */
/* Round 3 */
MD4_HH (a, b, c, d, x[ 0], MD4_S31); /* 33 */
MD4_HH (d, a, b, c, x[ 8], MD4_S32); /* 34 */
MD4_HH (c, d, a, b, x[ 4], MD4_S33); /* 35 */
MD4_HH (b, c, d, a, x[12], MD4_S34); /* 36 */
MD4_HH (a, b, c, d, x[ 2], MD4_S31); /* 37 */
MD4_HH (d, a, b, c, x[10], MD4_S32); /* 38 */
MD4_HH (c, d, a, b, x[ 6], MD4_S33); /* 39 */
MD4_HH (b, c, d, a, x[14], MD4_S34); /* 40 */
MD4_HH (a, b, c, d, x[ 1], MD4_S31); /* 41 */
MD4_HH (d, a, b, c, x[ 9], MD4_S32); /* 42 */
MD4_HH (c, d, a, b, x[ 5], MD4_S33); /* 43 */
MD4_HH (b, c, d, a, x[13], MD4_S34); /* 44 */
MD4_HH (a, b, c, d, x[ 3], MD4_S31); /* 45 */
MD4_HH (d, a, b, c, x[11], MD4_S32); /* 46 */
MD4_HH (c, d, a, b, x[ 7], MD4_S33); /* 47 */
MD4_HH (b, c, d, a, x[15], MD4_S34); /* 48 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.*/
memset ((void *) x, 0, sizeof (x));
}
/*****************************************************************************/
/* MD5 basic transformation. Transforms state based on block. */
/*****************************************************************************/
LOCAL void MD5_transform
(
unsigned long state[4],
unsigned char block[64]
)
{
unsigned long a = state[0];
unsigned long b = state[1];
unsigned long c = state[2];
unsigned long d = state[3];
unsigned long x[16];
MD_decode (x, block, 64);
/* Round 1 */
MD5_FF (a, b, c, d, x[ 0], MD5_S11, 0xd76aa478); /* 1 */
MD5_FF (d, a, b, c, x[ 1], MD5_S12, 0xe8c7b756); /* 2 */
MD5_FF (c, d, a, b, x[ 2], MD5_S13, 0x242070db); /* 3 */
MD5_FF (b, c, d, a, x[ 3], MD5_S14, 0xc1bdceee); /* 4 */
MD5_FF (a, b, c, d, x[ 4], MD5_S11, 0xf57c0faf); /* 5 */
MD5_FF (d, a, b, c, x[ 5], MD5_S12, 0x4787c62a); /* 6 */
MD5_FF (c, d, a, b, x[ 6], MD5_S13, 0xa8304613); /* 7 */
MD5_FF (b, c, d, a, x[ 7], MD5_S14, 0xfd469501); /* 8 */
MD5_FF (a, b, c, d, x[ 8], MD5_S11, 0x698098d8); /* 9 */
MD5_FF (d, a, b, c, x[ 9], MD5_S12, 0x8b44f7af); /* 10 */
MD5_FF (c, d, a, b, x[10], MD5_S13, 0xffff5bb1); /* 11 */
MD5_FF (b, c, d, a, x[11], MD5_S14, 0x895cd7be); /* 12 */
MD5_FF (a, b, c, d, x[12], MD5_S11, 0x6b901122); /* 13 */
MD5_FF (d, a, b, c, x[13], MD5_S12, 0xfd987193); /* 14 */
MD5_FF (c, d, a, b, x[14], MD5_S13, 0xa679438e); /* 15 */
MD5_FF (b, c, d, a, x[15], MD5_S14, 0x49b40821); /* 16 */
/* Round 2 */
MD5_GG (a, b, c, d, x[ 1], MD5_S21, 0xf61e2562); /* 17 */
MD5_GG (d, a, b, c, x[ 6], MD5_S22, 0xc040b340); /* 18 */
MD5_GG (c, d, a, b, x[11], MD5_S23, 0x265e5a51); /* 19 */
MD5_GG (b, c, d, a, x[ 0], MD5_S24, 0xe9b6c7aa); /* 20 */
MD5_GG (a, b, c, d, x[ 5], MD5_S21, 0xd62f105d); /* 21 */
MD5_GG (d, a, b, c, x[10], MD5_S22, 0x2441453); /* 22 */
MD5_GG (c, d, a, b, x[15], MD5_S23, 0xd8a1e681); /* 23 */
MD5_GG (b, c, d, a, x[ 4], MD5_S24, 0xe7d3fbc8); /* 24 */
MD5_GG (a, b, c, d, x[ 9], MD5_S21, 0x21e1cde6); /* 25 */
MD5_GG (d, a, b, c, x[14], MD5_S22, 0xc33707d6); /* 26 */
MD5_GG (c, d, a, b, x[ 3], MD5_S23, 0xf4d50d87); /* 27 */
MD5_GG (b, c, d, a, x[ 8], MD5_S24, 0x455a14ed); /* 28 */
MD5_GG (a, b, c, d, x[13], MD5_S21, 0xa9e3e905); /* 29 */
MD5_GG (d, a, b, c, x[ 2], MD5_S22, 0xfcefa3f8); /* 30 */
MD5_GG (c, d, a, b, x[ 7], MD5_S23, 0x676f02d9); /* 31 */
MD5_GG (b, c, d, a, x[12], MD5_S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
MD5_HH (a, b, c, d, x[ 5], MD5_S31, 0xfffa3942); /* 33 */
MD5_HH (d, a, b, c, x[ 8], MD5_S32, 0x8771f681); /* 34 */
MD5_HH (c, d, a, b, x[11], MD5_S33, 0x6d9d6122); /* 35 */
MD5_HH (b, c, d, a, x[14], MD5_S34, 0xfde5380c); /* 36 */
MD5_HH (a, b, c, d, x[ 1], MD5_S31, 0xa4beea44); /* 37 */
MD5_HH (d, a, b, c, x[ 4], MD5_S32, 0x4bdecfa9); /* 38 */
MD5_HH (c, d, a, b, x[ 7], MD5_S33, 0xf6bb4b60); /* 39 */
MD5_HH (b, c, d, a, x[10], MD5_S34, 0xbebfbc70); /* 40 */
MD5_HH (a, b, c, d, x[13], MD5_S31, 0x289b7ec6); /* 41 */
MD5_HH (d, a, b, c, x[ 0], MD5_S32, 0xeaa127fa); /* 42 */
MD5_HH (c, d, a, b, x[ 3], MD5_S33, 0xd4ef3085); /* 43 */
MD5_HH (b, c, d, a, x[ 6], MD5_S34, 0x4881d05); /* 44 */
MD5_HH (a, b, c, d, x[ 9], MD5_S31, 0xd9d4d039); /* 45 */
MD5_HH (d, a, b, c, x[12], MD5_S32, 0xe6db99e5); /* 46 */
MD5_HH (c, d, a, b, x[15], MD5_S33, 0x1fa27cf8); /* 47 */
MD5_HH (b, c, d, a, x[ 2], MD5_S34, 0xc4ac5665); /* 48 */
/* Round 4 */
MD5_II (a, b, c, d, x[ 0], MD5_S41, 0xf4292244); /* 49 */
MD5_II (d, a, b, c, x[ 7], MD5_S42, 0x432aff97); /* 50 */
MD5_II (c, d, a, b, x[14], MD5_S43, 0xab9423a7); /* 51 */
MD5_II (b, c, d, a, x[ 5], MD5_S44, 0xfc93a039); /* 52 */
MD5_II (a, b, c, d, x[12], MD5_S41, 0x655b59c3); /* 53 */
MD5_II (d, a, b, c, x[ 3], MD5_S42, 0x8f0ccc92); /* 54 */
MD5_II (c, d, a, b, x[10], MD5_S43, 0xffeff47d); /* 55 */
MD5_II (b, c, d, a, x[ 1], MD5_S44, 0x85845dd1); /* 56 */
MD5_II (a, b, c, d, x[ 8], MD5_S41, 0x6fa87e4f); /* 57 */
MD5_II (d, a, b, c, x[15], MD5_S42, 0xfe2ce6e0); /* 58 */
MD5_II (c, d, a, b, x[ 6], MD5_S43, 0xa3014314); /* 59 */
MD5_II (b, c, d, a, x[13], MD5_S44, 0x4e0811a1); /* 60 */
MD5_II (a, b, c, d, x[ 4], MD5_S41, 0xf7537e82); /* 61 */
MD5_II (d, a, b, c, x[11], MD5_S42, 0xbd3af235); /* 62 */
MD5_II (c, d, a, b, x[ 2], MD5_S43, 0x2ad7d2bb); /* 63 */
MD5_II (b, c, d, a, x[ 9], MD5_S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.*/
memset ((void *)x, 0, sizeof (x));
}
/* Encodes input (unsigned long) into output (unsigned char).
Assumes length is a multiple of 4. */
LOCAL void MD_encode
(
unsigned char * bptr_output,
unsigned long * ulptr_input,
unsigned long length
)
{
unsigned long i;
unsigned long j;
for (i = 0x00000000L, j = 0x00000000L; j < length; ++i, j += 4)
{
bptr_output[j] = (unsigned char)(ulptr_input[i] & 0xff);
bptr_output[j+1] = (unsigned char)((ulptr_input[i] >> 8) & 0xff);
bptr_output[j+2] = (unsigned char)((ulptr_input[i] >> 16) & 0xff);
bptr_output[j+3] = (unsigned char)((ulptr_input[i] >> 24) & 0xff);
}
}
/* Decodes input (unsigned char) into output (unsigned long).
Assumes length is a multiple of 4. */
LOCAL void MD_decode
(
unsigned long * ulptr_output,
unsigned char * bptr_input,
unsigned long length
)
{
unsigned long i;
unsigned long j;
for (i = 0x00000000L, j = 0x00000000L; j < length; ++i, j += 4)
{
ulptr_output[i] = ((unsigned long)bptr_input[j])
| (((unsigned long)bptr_input[j+1]) << 8)
| (((unsigned long)bptr_input[j+2]) << 16)
| (((unsigned long)bptr_input[j+3]) << 24);
}
}
@@ -0,0 +1,317 @@
/* dot1xMemPartLib.c - 802.1X memory partition specific library */
/*
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01g,04apr10,kxr Coverity changes
01f,16mar06,rjh Add NOMANUAL
01e,23aug05,eja Fix partition id corruption on x86
01d,26jul05,eja Add malloc functionality
01c,09jun05,eja Add NULL pointer check in memPartFree routine
01b,08dec04,eja Fix for Trace bug B004 by creating scalable partition
allocation scheme
01a,07dec04,eja Change stdLib.h to stdlib.h for Solaris error
*/
/*
DESCRIPTION
\NOROUTINES
\NOMANUAL
*/
#include "dot1xMemPartLib.h"
#include <stdlib.h>
/* Enumerated type for block alignment within the memory
partition */
typedef enum
{
DOT1X_MEM_ALIGN_8 = 0, /* 8 bit boundary */
DOT1X_MEM_ALIGN_16, /* 16 bit boundary */
DOT1X_MEM_ALIGN_32 /* 32 bit boundary */
} DOT1X_MEM_ALIGN_T;
/*******************************************************************
* DOT11_MEM_PART_T - Memory partition descriptor
*******************************************************************/
typedef struct dot1x_mem_part_s
{
PART_ID id; /* partition ID */
DOT1X_MEM_ALIGN_T alignment; /* Block allocation alignment */
UINT32 allocError; /* allocation error count */
UINT32 freeError; /* deallocation error count */
UINT32 allocSuccess; /* allocation success count */
UINT32 freeSuccess; /* deallocation success count */
void * block; /* Memory block */
} DOT1X_MEM_PART_DESC;
/* Compile time static allocation of memory partition descriptor */
static DOT1X_MEM_PART_DESC * pMemPart = NULL;
/********************************************************************
* dot1xMemPartLibInit - allocate and initialize a memory partition
*
* This routine allocates and initializes a statically allocated
* memory partition.
*
* RETURNS: OK or ERROR if the partition has failed to allocate
* properly.
*/
STATUS dot1xMemPartLibInit(void)
{
UINT32 memSz;
/* Guard against multiple init calls */
if(pMemPart != NULL)
{
/* Partiton is already in use */
return(OK);
}
/* Allocate the partition descriptor */
pMemPart = calloc(1, sizeof(DOT1X_MEM_PART_DESC));
if(pMemPart == NULL)
{
return(ERROR);
}
/* Create a memory partiton on the allocated data block */
memSz = DOT1X_MEM_PART_SZ_MAX;
while(memSz > DOT1X_MEM_PART_SZ_MIN)
{
/* Allocate a block of memory from the system pool */
pMemPart->block = calloc(memSz, sizeof(char));
/* Sanity check */
if(pMemPart->block != NULL)
{
break;
}
/* Keep trying to get half of the last memory size */
memSz >>= 1;
}
/* Make sure that we have allocated enough memory before we
create a part */
if(pMemPart->block != NULL)
{
/* Create a memory partiton on the allocated data block */
pMemPart->id = memPartCreate(pMemPart->block, memSz);
/* Sanity check */
if(pMemPart->id != NULL)
{
/* Reset the partition statistics and counters */
pMemPart->allocError = 0;
pMemPart->freeError = 0;
pMemPart->allocSuccess = 0;
pMemPart->freeSuccess = 0;
pMemPart->alignment = DOT1X_MEM_ALIGN_32;
/* Return the status of the call to the callee */
return(OK);
}
else
{
/* Free up allocated block since we failed to create
a parition on it */
free(pMemPart->block);
free(pMemPart);
pMemPart = NULL;
}
}
/* If we are here then we could not allocate the required
memory so return an error */
return(ERROR);
}
/****************************************************************************
* dot1xMemBlockCalloc - Allocates and clears a block of memory from the
* libraries private memory pool.
*
* This routine attempts to allocate a block of memory from the
* private memory pool. On success the block is cleared and
* the allocation success state variable is incremented. On failure the
* the allocation error state variable is incremented. Once the above
* operations are complete a pointer to the memory block is returned to
* the caller.
*
* RETURNS:
* a reference to a valid memory block on success, else NULL on error.
*
* ERRNO: N/A
*/
void * dot1xMemBlockCalloc
(
size_t elemNum, /* Number of elements to clear */
size_t elemSize /* Size of each element */
)
{
void * pBlock;
UINT32 nBytes = (UINT32)(elemNum*elemSize);
/* Sanity check */
if(pMemPart == NULL)
{
/* Partiton has not been allocated */
return(NULL);
}
/* Allocate a buffer from the memory partition */
if ((pBlock = memPartAlignedAlloc(pMemPart->id, nBytes,
(UINT32)pMemPart->alignment))
!= NULL)
{
/* Clear the allocated buffer */
(void)memset(pBlock, 0, nBytes);
/* For each allocation success update the statistics
counter */
pMemPart->allocSuccess++;
}
else
{
/* For each allocation error update the statistics
counter */
pMemPart->allocError++;
}
/* Return the reference to the callee */
return(pBlock);
}
/****************************************************************************
* dot1xMemBlockMalloc - Allocates a block of memory from the ibraries
* private memory pool.
*
* This routine attempts to allocate a block of memory from the
* private memory pool. On success the allocation success state variable is
* incremented. On failure the the allocation error state variable is
* incremented. Once the above operations are complete a pointer to the
* memory block is returned to the caller.
*
* RETURNS:
* a reference to a valid memory block on success, else NULL on error.
*
* ERRNO: N/A
*/
void * dot1xMemBlockMalloc
(
size_t elemNum, /* Number of elements to clear */
size_t elemSize /* Size of each element */
)
{
void * pBlock;
UINT32 nBytes = (UINT32)(elemNum*elemSize);
/* Sanity check */
if(pMemPart == NULL)
{
/* Partiton has not been allocated */
return(NULL);
}
/* Allocate a buffer from the memory partition */
if ((pBlock = memPartAlignedAlloc(pMemPart->id, nBytes,
(UINT32)pMemPart->alignment))
!= NULL)
{
/* For each allocation success update the statistics
counter */
pMemPart->allocSuccess++;
}
else
{
/* For each allocation error update the statistics
counter */
pMemPart->allocError++;
}
/* Return the reference to the callee */
return(pBlock);
}
/****************************************************************************
* dot1xMemBlockFree - Releases a block of memory to the libraries private
* memory pool.
*
* This routine attempts to deallocate a block of memory from the
* private memory pool. On success the dealloction success
* state variable is incremented. On failure the the dealloction error state
* variable is incremented. Once the above operations are complete a status
* value of ERROR or SUCCESS is returned to the callee.
*
* RETURNS: OK on successful deallocation, else ERROR.
*
* ERRNO: N/A
*/
STATUS dot1xMemBlockFree
(
void * pBlock /* Reference to an allocated memory block */
)
{
STATUS retVal;
/* Sanity check */
if(pMemPart == NULL || pBlock == NULL)
{
/* Partiton has not been allocated */
return(ERROR);
}
/* Attempt to free the allocated block */
if ((retVal = memPartFree(pMemPart->id, pBlock))
== ERROR)
{
/* For each deallocation error update the statistics
counter */
pMemPart->freeError++;
}
else
{
/* For each deallocation success update the statistics
counter */
pMemPart->freeSuccess++;
}
/* Reclaim the allocated block */
return(retVal);
}
/****************************************************************************
* dot1xMemPartShow - Print partition info to the console
*
* This routine calls the low level memory partition driver method
* that displays partition info on the console.
*
* RETURNS: OK, else ERROR.
*
* ERRNO: N/A
*/
STATUS dot1xMemPartShow(void)
{
/* Sanity check */
if(pMemPart == NULL)
{
/* Partiton has not been allocated */
return(ERROR);
}
/* Print partition statistics to the console */
return(memPartShow(pMemPart->id, DOT1X_MEM_PART_STATS_MODE));
}
@@ -0,0 +1,308 @@
/* dot1xVirtualEnd.c - (END) */
/*
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01j,20mar08,mry Removing old supplicant IOCTLs
01i,16mar06,rjh Add NOMANUAL
01h,26jul05,eja Break dependency on supplicant and authenticator due to
single configuration function
01g,30may05,eja remove support for wlanconfig() since support has been moved
to the authenticator
01f,20may05,eja Fix compiler warnings
01e,17may05,eja Add wrapper for base6.1 only usage
01d,12may05,alm Update comments
01c,10may05,eja RTP ioctl implementation
01b,10may05,alm Add description
01a,04may05,eja Add kernel mode tags and includes to stop diab bcopy warnings
*/
/*
DESCRIPTION
This library implements RTP callable APIs by way of a virtual MUX driver.
\NOROUTINES
\NOMANUAL
*/
/* includes */
#include <vxWorks.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <end.h>
#include <endLib.h>
#include <muxTkLib.h>
#include <dot1xCommonIoctls.h>
#include <dot1xVirtEndLib.h>
/* The definition of the driver control structure */
typedef struct virt_end_dev
{
END_OBJ end; /* The class we inherit from */
int unit; /* unit number */
VIRT_END_CFG_HANDLER pSuppCfgHandler; /* supplicant config handler */
VIRT_END_CFG_HANDLER pAuthCfgHandler; /* authenticator config handler */
} VIRT_END_DEV;
/* Local functions */
/* vxWorks Base6.X only */
#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)
END_OBJ * dot1xVirtEndDevLoad(char *);
STATUS dot1xVirtEndDevUnload(VIRT_END_DEV *);
int dot1xVirtEndDevIoctl(VIRT_END_DEV *, int, caddr_t);
/* Declare our function table. This is static across all device
instances. */
LOCAL NET_FUNCS dot1xVirtEndDevFuncTable =
{
NULL, /* Function to start the device. */
NULL, /* Function to stop the device. */
(FUNCPTR)dot1xVirtEndDevUnload,/* Unloading function for the driver. */
(FUNCPTR)dot1xVirtEndDevIoctl, /* Ioctl function for the driver. */
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
static BOOL virtEndDevInitialized = FALSE;
#endif
/***************************************************************************
* dot1xVirtEndDevInit - virtual mux init call
*
* This routine initializes and loads the device.
*
* RETURNS: pCookie or NULL
*
* \IFSET KERNEL
*/
void * dot1xVirtEndDevInit(void)
{
void * pCookie = NULL;
/* vxWorks Base6.X only */
#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)
/* Load the Virt mux driver */
if(!virtEndDevInitialized)
{
pCookie = muxDevLoad(0, (void*)dot1xVirtEndDevLoad,
"Virtual END driver config", 0, NULL);
if(pCookie != NULL)
{
/* Device is running */
virtEndDevInitialized = TRUE;
}
}
#endif
/* Return the mux cookie to the caller */
return(pCookie);
}
/***************************************************************************
* dot1xVirtEndDevHandlerInstall -
*
* This routine installs a supplicant or authenticator configuration
* handler.
*
* RETURNS: OK or ERROR
*
* \IFSET KERNEL
*/
STATUS dot1xVirtEndDevHandlerInstall
(
void * pCookie, /* device end object */
int type, /* handler type */
void * pHandler /* handler */
)
{
STATUS status = OK;
VIRT_END_DEV * pDev = pCookie;
/* vxWorks Base6.X only */
#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)
/* sanity check */
if(pDev == NULL)
{
return(ERROR);
}
/* Install the desired handler */
switch(type)
{
case DOT1X_VIRT_END_SUPP_HDLR:
pDev->pSuppCfgHandler = pHandler;
break;
case DOT1X_VIRT_END_AUTH_HDLR:
pDev->pAuthCfgHandler = pHandler;
break;
default:
status = ERROR;
break;
}
#endif
/* Return operation status to the caller */
return(status);
}
/***************************************************************************
* dot1xVirtEndDevLoad - load the device into the mux
*
* This routine loads the device into the mux
*
* RETURNS: END_OBJ* or NULL.
*
* NOMANUAL
*/
END_OBJ * dot1xVirtEndDevLoad
(
char * pInitString /* String to be parsed by the driver. */
)
{
/* vxWorks Base6.X only */
#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)
VIRT_END_DEV * pDrvCtrl;
/* Sanity check */
if(pInitString == NULL)
{
return(NULL);
}
/* On the first call we need to pass back the interface name to the
caller */
if(pInitString[0] == EOS)
{
/* First pass */
bcopy(DOT1X_VIRT_END_DEV_NAME, pInitString,
DOT1X_VIRT_END_DEV_NAME_LEN);
return(NULL);
}
else /* This the second call so we need to allocate the structures */
{
/* Allocate the control structure */
if((pDrvCtrl = calloc(1, sizeof(VIRT_END_DEV))) == NULL)
{
goto error;
}
/* Create and init the end object */
if(END_OBJ_INIT(&pDrvCtrl->end, NULL, DOT1X_VIRT_END_DEV_NAME,
pDrvCtrl->unit, &dot1xVirtEndDevFuncTable,
"802.1X Virtual END Device") == ERROR)
{
goto error;
}
/* Return the end object to the caller */
return(&pDrvCtrl->end);
}
error:
/* Sanity check */
if(pDrvCtrl != NULL)
{
free((void*)pDrvCtrl);
}
#endif
/* Error condition */
return(NULL);
}
/***************************************************************************
* dot1xVirtEndDevIoctl - perform device specific operations
*
* This routine performs device specific operations
*
* RETURNS: OK, ERROR or EINVAL.
*
* NOMANUAL
*/
int dot1xVirtEndDevIoctl
(
VIRT_END_DEV * pDrvCtrl, /* device receiving command */
int cmd, /* ioctl command code */
caddr_t data /* command argument */
)
{
int status = ERROR;
/* vxWorks Base6.X only */
#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)
/* Handle the incoming command */
switch((UINT32)cmd)
{
/* Handler authenticator configuration requests from an RTP */
case EIOCAUTHSVRLIBINIT: /* Init authentication server */
case EIOCAUTHSVRLIBSHUTDOWN: /* Shutdown authentication server */
case EIOCAUTHINIT: /* Init autheticator */
case EIOCAUTHSHUTDOWN: /* Shutdown authenticator */
case EIOCAUTHATTACH: /* Attach to autheticator */
case EIOCAUTHDETACH: /* Detach from authenticator */
if(pDrvCtrl->pAuthCfgHandler != NULL)
{
/* pass command to handler */
status = pDrvCtrl->pAuthCfgHandler(cmd, data);
}
break;
case EIOCAUTHWLANCONFIG:
default:
status = EINVAL;
break;
}
#endif
/* Call status */
return(status);
}
/***************************************************************************
* dot1xVirtEndDevUnload - unload mux device
*
* This routine unload mux device
*
* RETURNS: OK or ERROR.
*
* NOMANUAL
*/
STATUS dot1xVirtEndDevUnload
(
VIRT_END_DEV * pDrvCtrl /* device to be unloaded */
)
{
/* vxWorks Base6.X only */
#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)
END_OBJECT_UNLOAD(&pDrvCtrl->end);
cfree((void*)pDrvCtrl);
#endif
return(OK);
}
@@ -0,0 +1,135 @@
/* dot1xWb4Lib.c - 802.1X stream cipher library */
/*
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,16mar06,rjh Add NOMANUAL
01b,05may03,ggg Update comments
01a,21apr03,ggg File name, location change
*/
/*
DESCRIPTION
This library contains routines for applying the stream cipher to data.
INCLUDE FILES: dot1xWb4Lib.h
\NOROUTINES
\NOMANUAL
*/
#include "vxWorks.h"
#include "dot1xWb4Lib.h"
/*******************************************************************************
*
* swap_byte - utility routine for swapping bytes
*
* This routine swaps bytes
*
* RETURNS: N/A
*
*/
LOCAL void swap_byte
(
unsigned char * a,
unsigned char * b
)
{
unsigned char swapByte;
swapByte = *a;
*a = *b;
*b = swapByte;
}
/*******************************************************************************
*
* dot1xWb4KeyGen - generates key information for applying the stream cipher
*
* This routine generates key information needed for applying the stream
* cipher. The generate <key> is passed to dot1xWb4 to apply it to data.
*
* RETURNS: N/A
*
*/
void dot1xWb4KeyGen
(
unsigned char * key_data_ptr, /* incoming key */
int key_data_len, /* length of incoming key */
DOT1X_WB4_KEY * key /* pointer to generated key information */
)
{
unsigned char index1;
unsigned char index2;
unsigned char * state;
short counter;
state = &key->state[0];
for(counter = 0; counter < 256; counter++)
state[counter] = counter;
key->x = 0;
key->y = 0;
index1 = 0;
index2 = 0;
for(counter = 0; counter < 256; counter++)
{
index2 = (key_data_ptr[index1] + state[counter] + index2) % 256;
swap_byte(&state[counter], &state[index2]);
index1 = (index1 + 1) % key_data_len;
}
}
/*******************************************************************************
*
* dot1xWb4 - applies stream cipher to data
*
* This routine applies the stream cipher to the passed in data buffer using
* the passed in key.
*
*
* RETURNS: N/A
*
*/
void dot1xWb4
(
unsigned char * buffer_ptr, /* data to apply stream cipher to */
int buffer_len, /* length of data */
DOT1X_WB4_KEY * key /* key information */
)
{
unsigned char x;
unsigned char y;
unsigned char * state;
unsigned char xorIndex;
short counter;
x = key->x;
y = key->y;
state = &key->state[0];
for(counter = 0; counter < buffer_len; counter ++)
{
x = (x + 1) % 256;
y = (state[x] + y) % 256;
swap_byte(&state[x], &state[y]);
xorIndex = (state[x] + state[y]) % 256;
buffer_ptr[counter] ^= state[xorIndex];
}
key->x = x;
key->y = y;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,177 @@
/******************************************************************************
******************************************************************************
**** This file was automatically generated by Epilogue Technology's
**** Emissary SNMP MIB Compiler, version 9.2.
**** This file was generated using the -leaf switch.
****
**** This file #defines C preprocessor macros providing a variety of
**** information for the leaf objects in the MIB.
****
**** The file includes a LEAF_xxx macro for each leaf object in the
**** MIB (xxx is replaced by the object's name). The value of the
**** LEAF_xxx macro is the final component of the object's object
**** identifier.
****
**** If the object's SYNTAX clause included named INTEGER values,
**** then there is a VAL_xxx_yyy macro for each named value (xxx is
**** replaced by the object's name and yyy by the value's name). The
**** value of the VAL_xxx_yyy macro is the value associated with the
**** named value.
****
**** If the object's SYNTAX clause specified a set of range limitations
**** for the value of the object, then there are one or more sets of
**** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of
**** each range limitation.
****
**** If the object's SYNTAX clause specified a set of size constraints
**** for the value of the object, then there are one or more sets of
**** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper
**** bound of each size constraint. (If the size constraint is a single
**** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx
**** macros are replaced by a single SIZE_xxx macro.)
****
**** DO NOT MODIFY THIS FILE BY HAND.
****
**** Last build date: Thu Jan 31 13:22:19 2002
**** from file:
**** ieee8021x.mib
******************************************************************************
******************************************************************************
*/
#define LEAF_dot1xPaeSystemAuthControl 1
#define VAL_dot1xPaeSystemAuthControl_enabled 1L
#define VAL_dot1xPaeSystemAuthControl_disabled 2L
#define LEAF_dot1xPaePortNumber 1
#define LEAF_dot1xPaePortProtocolVersion 2
#define LEAF_dot1xPaePortCapabilities 3
#define VAL_dot1xPaePortCapabilities_dot1xPaePortAuthCapable 0L
#define VAL_dot1xPaePortCapabilities_dot1xPaePortSuppCapable 1L
#define LEAF_dot1xPaePortInitialize 4
#define VAL_dot1xPaePortInitialize_true 1L
#define VAL_dot1xPaePortInitialize_false 2L
#define LEAF_dot1xPaePortReauthenticate 5
#define VAL_dot1xPaePortReauthenticate_true 1L
#define VAL_dot1xPaePortReauthenticate_false 2L
#define LEAF_dot1xAuthPaeState 1
#define VAL_dot1xAuthPaeState_initialize 1L
#define VAL_dot1xAuthPaeState_disconnected 2L
#define VAL_dot1xAuthPaeState_connecting 3L
#define VAL_dot1xAuthPaeState_authenticating 4L
#define VAL_dot1xAuthPaeState_authenticated 5L
#define VAL_dot1xAuthPaeState_aborting 6L
#define VAL_dot1xAuthPaeState_held 7L
#define VAL_dot1xAuthPaeState_forceAuth 8L
#define VAL_dot1xAuthPaeState_forceUnauth 9L
#define LEAF_dot1xAuthBackendAuthState 2
#define VAL_dot1xAuthBackendAuthState_request 1L
#define VAL_dot1xAuthBackendAuthState_response 2L
#define VAL_dot1xAuthBackendAuthState_success 3L
#define VAL_dot1xAuthBackendAuthState_fail 4L
#define VAL_dot1xAuthBackendAuthState_timeout 5L
#define VAL_dot1xAuthBackendAuthState_idle 6L
#define VAL_dot1xAuthBackendAuthState_initialize 7L
#define LEAF_dot1xAuthAdminControlledDirections 3
#define VAL_dot1xAuthAdminControlledDirections_both 0L
#define VAL_dot1xAuthAdminControlledDirections_in 1L
#define LEAF_dot1xAuthOperControlledDirections 4
#define VAL_dot1xAuthOperControlledDirections_both 0L
#define VAL_dot1xAuthOperControlledDirections_in 1L
#define LEAF_dot1xAuthAuthControlledPortStatus 5
#define VAL_dot1xAuthAuthControlledPortStatus_authorized 1L
#define VAL_dot1xAuthAuthControlledPortStatus_unauthorized 2L
#define LEAF_dot1xAuthAuthControlledPortControl 6
#define VAL_dot1xAuthAuthControlledPortControl_forceUnauthorized 1L
#define VAL_dot1xAuthAuthControlledPortControl_auto 2L
#define VAL_dot1xAuthAuthControlledPortControl_forceAuthorized 3L
#define LEAF_dot1xAuthQuietPeriod 7
#define LEAF_dot1xAuthTxPeriod 8
#define LEAF_dot1xAuthSuppTimeout 9
#define LEAF_dot1xAuthServerTimeout 10
#define LEAF_dot1xAuthMaxReq 11
#define LEAF_dot1xAuthReAuthPeriod 12
#define LEAF_dot1xAuthReAuthEnabled 13
#define VAL_dot1xAuthReAuthEnabled_true 1L
#define VAL_dot1xAuthReAuthEnabled_false 2L
#define LEAF_dot1xAuthKeyTxEnabled 14
#define VAL_dot1xAuthKeyTxEnabled_true 1L
#define VAL_dot1xAuthKeyTxEnabled_false 2L
#define LEAF_dot1xAuthEapolFramesRx 1
#define LEAF_dot1xAuthEapolFramesTx 2
#define LEAF_dot1xAuthEapolStartFramesRx 3
#define LEAF_dot1xAuthEapolLogoffFramesRx 4
#define LEAF_dot1xAuthEapolRespIdFramesRx 5
#define LEAF_dot1xAuthEapolRespFramesRx 6
#define LEAF_dot1xAuthEapolReqIdFramesTx 7
#define LEAF_dot1xAuthEapolReqFramesTx 8
#define LEAF_dot1xAuthInvalidEapolFramesRx 9
#define LEAF_dot1xAuthEapLengthErrorFramesRx 10
#define LEAF_dot1xAuthLastEapolFrameVersion 11
#define LEAF_dot1xAuthLastEapolFrameSource 12
#define SIZE_dot1xAuthLastEapolFrameSource 6L
#define LEAF_dot1xAuthEntersConnecting 1
#define LEAF_dot1xAuthEapLogoffsWhileConnecting 2
#define LEAF_dot1xAuthEntersAuthenticating 3
#define LEAF_dot1xAuthAuthSuccessWhileAuthenticating 4
#define LEAF_dot1xAuthAuthTimeoutsWhileAuthenticating 5
#define LEAF_dot1xAuthAuthFailWhileAuthenticating 6
#define LEAF_dot1xAuthAuthReauthsWhileAuthenticating 7
#define LEAF_dot1xAuthAuthEapStartsWhileAuthenticating 8
#define LEAF_dot1xAuthAuthEapLogoffWhileAuthenticating 9
#define LEAF_dot1xAuthAuthReauthsWhileAuthenticated 10
#define LEAF_dot1xAuthAuthEapStartsWhileAuthenticated 11
#define LEAF_dot1xAuthAuthEapLogoffWhileAuthenticated 12
#define LEAF_dot1xAuthBackendResponses 13
#define LEAF_dot1xAuthBackendAccessChallenges 14
#define LEAF_dot1xAuthBackendOtherRequestsToSupplicant 15
#define LEAF_dot1xAuthBackendNonNakResponsesFromSupplicant 16
#define LEAF_dot1xAuthBackendAuthSuccesses 17
#define LEAF_dot1xAuthBackendAuthFails 18
#define LEAF_dot1xAuthSessionOctetsRx 1
#define LEAF_dot1xAuthSessionOctetsTx 2
#define LEAF_dot1xAuthSessionFramesRx 3
#define LEAF_dot1xAuthSessionFramesTx 4
#define LEAF_dot1xAuthSessionId 5
#define MINSIZE_dot1xAuthSessionId 0L
#define MAXSIZE_dot1xAuthSessionId 255L
#define LEAF_dot1xAuthSessionAuthenticMethod 6
#define VAL_dot1xAuthSessionAuthenticMethod_remoteAuthServer 1L
#define VAL_dot1xAuthSessionAuthenticMethod_localAuthServer 2L
#define LEAF_dot1xAuthSessionTime 7
#define LEAF_dot1xAuthSessionTerminateCause 8
#define VAL_dot1xAuthSessionTerminateCause_supplicantLogoff 1L
#define VAL_dot1xAuthSessionTerminateCause_portFailure 2L
#define VAL_dot1xAuthSessionTerminateCause_supplicantRestart 3L
#define VAL_dot1xAuthSessionTerminateCause_reauthFailed 4L
#define VAL_dot1xAuthSessionTerminateCause_authControlForceUnauth 5L
#define VAL_dot1xAuthSessionTerminateCause_portReInit 6L
#define VAL_dot1xAuthSessionTerminateCause_portAdminDisabled 7L
#define VAL_dot1xAuthSessionTerminateCause_notTerminatedYet 999L
#define LEAF_dot1xAuthSessionUserName 9
#define MINSIZE_dot1xAuthSessionUserName 0L
#define MAXSIZE_dot1xAuthSessionUserName 255L
#define LEAF_dot1xSuppPaeState 1
#define VAL_dot1xSuppPaeState_disconnected 1L
#define VAL_dot1xSuppPaeState_logoff 2L
#define VAL_dot1xSuppPaeState_connecting 3L
#define VAL_dot1xSuppPaeState_authenticating 4L
#define VAL_dot1xSuppPaeState_authenticated 5L
#define VAL_dot1xSuppPaeState_acquired 6L
#define VAL_dot1xSuppPaeState_held 7L
#define LEAF_dot1xSuppHeldPeriod 2
#define LEAF_dot1xSuppAuthPeriod 3
#define LEAF_dot1xSuppStartPeriod 4
#define LEAF_dot1xSuppMaxStart 5
#define LEAF_dot1xSuppEapolFramesRx 1
#define LEAF_dot1xSuppEapolFramesTx 2
#define LEAF_dot1xSuppEapolStartFramesTx 3
#define LEAF_dot1xSuppEapolLogoffFramesTx 4
#define LEAF_dot1xSuppEapolRespIdFramesTx 5
#define LEAF_dot1xSuppEapolRespFramesTx 6
#define LEAF_dot1xSuppEapolReqIdFramesRx 7
#define LEAF_dot1xSuppEapolReqFramesRx 8
#define LEAF_dot1xSuppInvalidEapolFramesRx 9
#define LEAF_dot1xSuppEapLengthErrorFramesRx 10
#define LEAF_dot1xSuppLastEapolFrameVersion 11
#define LEAF_dot1xSuppLastEapolFrameSource 12
#define SIZE_dot1xSuppLastEapolFrameSource 6L
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,80 @@
/* snmpDot1x.h - 802.1X MIB API method routines header file */
#include "copyright_wrs.h"
/*
modification history
--------------------
01b,21apr03,ggg File name, location change
01a,04Apr03,ggg written
*/
#ifndef __INCsnmpDot1xh
#define __INCsnmpDot1xh
#ifdef __cplusplus
extern "C" {
#endif
#include "wrn/wm/snmp/vxagent/snmpdLib.h"
#include "dot1xMibLeaf.h"
#include "dot1xMibLib.h"
#define PORT_NUM_LEN 1
void dot1xPaePortEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaePortEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaePortEntry_test (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaePortEntry_set (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaeSystem_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaeSystem_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaeSystem_test (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xPaeSystem_set (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthConfigEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthConfigEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthConfigEntry_test (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthConfigEntry_set (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthStatsEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthStatsEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthDiagEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthDiagEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthSessionStatsEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xAuthSessionStatsEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xSuppConfigEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xSuppConfigEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xSuppConfigEntry_test (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xSuppConfigEntry_set (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xSuppStatsEntry_get (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
void dot1xSuppStatsEntry_next (OIDC_T, int, OIDC_T *, SNMP_PKT_T *, VB_T *);
#ifdef __cplusplus
}
#endif
#endif /* __INCsnmpDot1xh */