blob: e06d3e92bec30cba255445d8b796576d887e1313 [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_USER_CFG_H_
#define _DPOE_SEC_USER_CFG_H_
#include "bcm_dev_log.h"
extern dev_log_id dpoe_sec_log_id[];
typedef void* dpoe_sec_sha1_hash; /* A data type for holding an SHA1 hash context */
typedef uint8_t dpoe_sec_sha1_digest[20]; /* A data type for holding an SHA1 hash */
typedef void* dpoe_sec_md5_hash; /* A data type for holding an MD5 hash context */
typedef uint8_t dpoe_sec_md5_digest[16]; /* A data type for holding an MD5 hash */
typedef void* dpoe_sec_rsa_key; /* A data type for holding an RSA key */
typedef void* dpoe_sec_aes_key; /* A data type for holding an AES key */
static inline void dpoe_sec_sha1_init(dpoe_sec_sha1_hash *sha1)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should initialize/reset an SHA1 hash context\n");
BUG();
}
static inline void dpoe_sec_sha1_update(dpoe_sec_sha1_hash *sha1, const void* data, size_t len)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should update an SHA1 hash context\n");
BUG();
}
static inline void dpoe_sec_sha1_final(dpoe_sec_sha1_digest md, dpoe_sec_sha1_hash *sha1)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should finalize an SHA1 hash context\n");
BUG();
}
static inline void dpoe_sec_md5_init(dpoe_sec_md5_hash *md5)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should initialize/reset an MD5 hash context\n");
BUG();
}
static inline void dpoe_sec_md5_update(dpoe_sec_md5_hash *md5, const void* data, size_t len)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should update an MD5 hash context\n");
BUG();
}
static inline void dpoe_sec_md5_final(dpoe_sec_md5_digest md, dpoe_sec_md5_hash *md5)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should finalize an MD5 hash context\n");
BUG();
}
static inline void dpoe_sec_prf_expand_4346(
uint8_t *secret,
uint32_t secret_len,
const uint8_t *label,
uint32_t label_len,
const uint8_t *seed,
uint32_t seed_len,
uint8_t *output,
uint32_t output_len)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform the pseudo-random function for expansion of secrets as defined in RFC 4346, section 5\n");
BUG();
}
static inline dpoe_sec_rsa_key *dpoe_sec_rsa_generate_key(int bits)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should generate an RSA key\n");
BUG();
}
static inline void dpoe_sec_rsa_key_free(dpoe_sec_rsa_key *rsa)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should release any resources allocated for an RSA key by either dpoe_sec_rsa_generate_key or dpoe_sec_x509_pub_key_get\n");
BUG();
}
static inline bcmos_bool dpoe_sec_rsa_public_get(dpoe_sec_rsa_key *rsa, uint8_t *rsa_modulus, uint8_t *rsa_exp)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should retrieve the public modulus and exponent of an RSA key\n");
BUG();
}
static inline int dpoe_sec_rsa_size(dpoe_sec_rsa_key *rsa)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should return the size of an RSA key in bytes\n");
BUG();
}
static inline int dpoe_sec_rsa_private_decrypt(
int flen,
const uint8_t *from,
uint8_t *to,
dpoe_sec_rsa_key *rsa)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform RSA decryption using a private key\n");
BUG();
}
static inline int dpoe_sec_rsa_public_decrypt(
int flen,
const uint8_t *from,
uint8_t *to,
dpoe_sec_rsa_key *rsa)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform RSA decryption using a public key (also known as signature verification)\n");
BUG();
}
static inline dpoe_sec_rsa_key *dpoe_sec_x509_pub_key_get(const uint8_t *cert, uint32_t cert_len)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should retrieve an RSA public key from an X.509 cetificate\n");
BUG();
}
static inline void dpoe_sec_aes_set_encrypt_key(const uint8_t *user_key, const int bits, dpoe_sec_aes_key *key)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should initialize the AES key with the provided data\n");
BUG();
}
static inline void dpoe_sec_aes_wrap_key(
dpoe_sec_aes_key *key,
uint8_t *out,
const uint8_t *in,
uint32_t len)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform an AES key wrap on in\n");
BUG();
}
static inline void dpoe_sec_aes_cmac(uint8_t *key, uint8_t *msg, uint32_t len, uint8_t *code)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform AES CMAC\n");
BUG();
}
static inline void dpoe_sec_aes_cmac_kdf(
uint8_t *key,
const char *label,
uint8_t *ctx,
uint32_t ctx_len,
uint8_t *out_buf)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform the AES CMAC key derivation function\n");
BUG();
}
static inline bcmos_errno dpoe_sec_send_eapol(
bcmolt_devid device,
bcmolt_epon_link_key *link_key,
uint8_t *eapol,
uint16_t length)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should transmit an EAPOL frame to the specified link\n");
BUG();
}
static inline bcmos_errno dpoe_sec_rng_seed(void)
{
BCM_LOG(INFO, dpoe_sec_log_id[current_device], "This function should seed a cryptographically valid pseudo-random number generator\n");
return BCM_ERR_OK;
}
static inline void dpoe_sec_generate_n_byte_random_number(uint8_t *output, int length)
{
BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should generate a pseudo-random number of the specified length\n");
BUG();
}
#endif /* _DPOE_SEC_USER_CFG_H_ */