Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with the following added to such license: |
| 12 | |
| 13 | As a special exception, the copyright holders of this software give |
| 14 | you permission to link this software with independent modules, and |
| 15 | to copy and distribute the resulting executable under terms of your |
| 16 | choice, provided that you also meet, for each linked independent |
| 17 | module, the terms and conditions of the license of that module. |
| 18 | An independent module is a module which is not derived from this |
| 19 | software. The special exception does not apply to any modifications |
| 20 | of the software. |
| 21 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written consent. |
| 26 | |
| 27 | :> |
| 28 | */ |
| 29 | |
| 30 | #ifndef _DPOE_SEC_USER_CFG_H_ |
| 31 | #define _DPOE_SEC_USER_CFG_H_ |
| 32 | |
| 33 | #include "bcm_dev_log.h" |
| 34 | |
| 35 | extern dev_log_id dpoe_sec_log_id[]; |
| 36 | |
| 37 | typedef void* dpoe_sec_sha1_hash; /* A data type for holding an SHA1 hash context */ |
| 38 | typedef uint8_t dpoe_sec_sha1_digest[20]; /* A data type for holding an SHA1 hash */ |
| 39 | typedef void* dpoe_sec_md5_hash; /* A data type for holding an MD5 hash context */ |
| 40 | typedef uint8_t dpoe_sec_md5_digest[16]; /* A data type for holding an MD5 hash */ |
| 41 | typedef void* dpoe_sec_rsa_key; /* A data type for holding an RSA key */ |
| 42 | typedef void* dpoe_sec_aes_key; /* A data type for holding an AES key */ |
| 43 | |
| 44 | static inline void dpoe_sec_sha1_init(dpoe_sec_sha1_hash *sha1) |
| 45 | { |
| 46 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should initialize/reset an SHA1 hash context\n"); |
| 47 | BUG(); |
| 48 | } |
| 49 | |
| 50 | static inline void dpoe_sec_sha1_update(dpoe_sec_sha1_hash *sha1, const void* data, size_t len) |
| 51 | { |
| 52 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should update an SHA1 hash context\n"); |
| 53 | BUG(); |
| 54 | } |
| 55 | |
| 56 | static inline void dpoe_sec_sha1_final(dpoe_sec_sha1_digest md, dpoe_sec_sha1_hash *sha1) |
| 57 | { |
| 58 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should finalize an SHA1 hash context\n"); |
| 59 | BUG(); |
| 60 | } |
| 61 | |
| 62 | static inline void dpoe_sec_md5_init(dpoe_sec_md5_hash *md5) |
| 63 | { |
| 64 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should initialize/reset an MD5 hash context\n"); |
| 65 | BUG(); |
| 66 | } |
| 67 | |
| 68 | static inline void dpoe_sec_md5_update(dpoe_sec_md5_hash *md5, const void* data, size_t len) |
| 69 | { |
| 70 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should update an MD5 hash context\n"); |
| 71 | BUG(); |
| 72 | } |
| 73 | |
| 74 | static inline void dpoe_sec_md5_final(dpoe_sec_md5_digest md, dpoe_sec_md5_hash *md5) |
| 75 | { |
| 76 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should finalize an MD5 hash context\n"); |
| 77 | BUG(); |
| 78 | } |
| 79 | |
| 80 | static inline void dpoe_sec_prf_expand_4346( |
| 81 | uint8_t *secret, |
| 82 | uint32_t secret_len, |
| 83 | const uint8_t *label, |
| 84 | uint32_t label_len, |
| 85 | const uint8_t *seed, |
| 86 | uint32_t seed_len, |
| 87 | uint8_t *output, |
| 88 | uint32_t output_len) |
| 89 | { |
| 90 | 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"); |
| 91 | BUG(); |
| 92 | } |
| 93 | |
| 94 | static inline dpoe_sec_rsa_key *dpoe_sec_rsa_generate_key(int bits) |
| 95 | { |
| 96 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should generate an RSA key\n"); |
| 97 | BUG(); |
| 98 | } |
| 99 | |
| 100 | static inline void dpoe_sec_rsa_key_free(dpoe_sec_rsa_key *rsa) |
| 101 | { |
| 102 | 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"); |
| 103 | BUG(); |
| 104 | } |
| 105 | |
| 106 | static inline bcmos_bool dpoe_sec_rsa_public_get(dpoe_sec_rsa_key *rsa, uint8_t *rsa_modulus, uint8_t *rsa_exp) |
| 107 | { |
| 108 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should retrieve the public modulus and exponent of an RSA key\n"); |
| 109 | BUG(); |
| 110 | } |
| 111 | |
| 112 | static inline int dpoe_sec_rsa_size(dpoe_sec_rsa_key *rsa) |
| 113 | { |
| 114 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should return the size of an RSA key in bytes\n"); |
| 115 | BUG(); |
| 116 | } |
| 117 | |
| 118 | static inline int dpoe_sec_rsa_private_decrypt( |
| 119 | int flen, |
| 120 | const uint8_t *from, |
| 121 | uint8_t *to, |
| 122 | dpoe_sec_rsa_key *rsa) |
| 123 | { |
| 124 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform RSA decryption using a private key\n"); |
| 125 | BUG(); |
| 126 | } |
| 127 | |
| 128 | static inline int dpoe_sec_rsa_public_decrypt( |
| 129 | int flen, |
| 130 | const uint8_t *from, |
| 131 | uint8_t *to, |
| 132 | dpoe_sec_rsa_key *rsa) |
| 133 | { |
| 134 | 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"); |
| 135 | BUG(); |
| 136 | } |
| 137 | |
| 138 | static inline dpoe_sec_rsa_key *dpoe_sec_x509_pub_key_get(const uint8_t *cert, uint32_t cert_len) |
| 139 | { |
| 140 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should retrieve an RSA public key from an X.509 cetificate\n"); |
| 141 | BUG(); |
| 142 | } |
| 143 | |
| 144 | static inline void dpoe_sec_aes_set_encrypt_key(const uint8_t *user_key, const int bits, dpoe_sec_aes_key *key) |
| 145 | { |
| 146 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should initialize the AES key with the provided data\n"); |
| 147 | BUG(); |
| 148 | } |
| 149 | |
| 150 | static inline void dpoe_sec_aes_wrap_key( |
| 151 | dpoe_sec_aes_key *key, |
| 152 | uint8_t *out, |
| 153 | const uint8_t *in, |
| 154 | uint32_t len) |
| 155 | { |
| 156 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform an AES key wrap on in\n"); |
| 157 | BUG(); |
| 158 | } |
| 159 | |
| 160 | static inline void dpoe_sec_aes_cmac(uint8_t *key, uint8_t *msg, uint32_t len, uint8_t *code) |
| 161 | { |
| 162 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform AES CMAC\n"); |
| 163 | BUG(); |
| 164 | } |
| 165 | |
| 166 | static inline void dpoe_sec_aes_cmac_kdf( |
| 167 | uint8_t *key, |
| 168 | const char *label, |
| 169 | uint8_t *ctx, |
| 170 | uint32_t ctx_len, |
| 171 | uint8_t *out_buf) |
| 172 | { |
| 173 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should perform the AES CMAC key derivation function\n"); |
| 174 | BUG(); |
| 175 | } |
| 176 | |
| 177 | static inline bcmos_errno dpoe_sec_send_eapol( |
| 178 | bcmolt_devid device, |
| 179 | bcmolt_epon_link_key *link_key, |
| 180 | uint8_t *eapol, |
| 181 | uint16_t length) |
| 182 | { |
| 183 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should transmit an EAPOL frame to the specified link\n"); |
| 184 | BUG(); |
| 185 | } |
| 186 | |
| 187 | static inline bcmos_errno dpoe_sec_rng_seed(void) |
| 188 | { |
| 189 | BCM_LOG(INFO, dpoe_sec_log_id[current_device], "This function should seed a cryptographically valid pseudo-random number generator\n"); |
| 190 | return BCM_ERR_OK; |
| 191 | } |
| 192 | |
| 193 | static inline void dpoe_sec_generate_n_byte_random_number(uint8_t *output, int length) |
| 194 | { |
| 195 | BCM_LOG(ERROR, dpoe_sec_log_id[current_device], "This function should generate a pseudo-random number of the specified length\n"); |
| 196 | BUG(); |
| 197 | } |
| 198 | |
| 199 | #endif /* _DPOE_SEC_USER_CFG_H_ */ |
| 200 | |