blob: b42fddc16a4368d1e085c9798caa5e0cee0e7b02 [file] [log] [blame]
/*
<:copyright-BRCM:2016:DUAL/GPL:standard
Broadcom Proprietary and Confidential.(c) 2016 Broadcom
All Rights Reserved
Unless you and Broadcom execute a separate written software license
agreement governing use of this software, this software is licensed
to you under the terms of the GNU General Public License version 2
(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
with the following added to such license:
As a special exception, the copyright holders of this software give
you permission to link this software with independent modules, and
to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent
module, the terms and conditions of the license of that module.
An independent module is a module which is not derived from this
software. The special exception does not apply to any modifications
of the software.
Not withstanding the above, under no circumstances may you combine
this software in any way with any other Broadcom software provided
under a license other than the GPL, without Broadcom's express prior
written consent.
:>
*/
#ifndef _DPOE_SEC_UTIL_H_
#define _DPOE_SEC_UTIL_H_
#include "bcmos_system.h"
#include "bcm_dev_log.h"
#include "bcmolt_buf.h"
#include "bcmolt_utils.h"
#include "bcmolt_model_types.h"
#include "dpoe_sec_user_cfg.h"
/* the EAPOL Ethernet type */
#define ETHERTYPE_EAPOL 0x888e
#define EAPOL_PROTOCOL_VERSION_DPOE 3
typedef enum
{
EAPOL_TYPE_PACKET,
EAPOL_TYPE_START,
EAPOL_TYPE_LOG_OFF,
EAPOL_TYPE_KEY,
EAPOL_TYPE_ASF_ALERT,
EAPOL_TYPE_MKA
} eapol_type;
typedef struct
{
bcmos_mac_address da;
bcmos_mac_address sa;
uint16_t ether_type;
uint8_t eapol_version;
uint8_t eapol_packet_type;
uint16_t eapol_length;
} eapol_msg_hdr;
#define EAPOL_MSG_HDR_SIZE 18
#define LINK_KEY_FMT_STR "PON %u, "BCMOS_MACADDR_FMT_STR
#define LINK_KEY_DATA(lr) (lr)->key.epon_ni, BCMOS_MACADDR_PARAMS(&(lr)->key.mac_address)
#define DPOE_SEC_LINK_LOG(level, lr, fmt, args...) \
BCM_LOG(level, dpoe_sec_log_id[(lr)->device], LINK_KEY_FMT_STR": "fmt, LINK_KEY_DATA(lr), ##args)
static const uint32_t DPOE_SEC_OAM_TIMEOUT = 2 * 1000 * 1000; /* 2 seconds */
bcmos_bool dpoe_sec_eapol_unpack(bcmolt_buf *buf, eapol_msg_hdr *eapol);
bcmos_errno bcmolt_epon_link_encryption_key_set(
bcmolt_devid device,
bcmolt_epon_link_key *link_key,
bcmos_bool up,
bcmolt_epon_encryption_mode mode,
bcmolt_epon_key_choice key_choice,
bcmolt_encryption_information_container *key_info);
#endif /* _DPOE_SEC_UTIL_H_ */