| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-2010 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_security.h $ |
|---|
| 39 | * $brcm_Revision: 13 $ |
|---|
| 40 | * $brcm_Date: 10/7/10 11:04a $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/modules/security/7400/include/nexus_security.h $ |
|---|
| 47 | * |
|---|
| 48 | * 13 10/7/10 11:04a erickson |
|---|
| 49 | * SW7420-1148: add destructor hints |
|---|
| 50 | * |
|---|
| 51 | * 12 5/10/10 10:47a erickson |
|---|
| 52 | * SW7550-415: add NEXUS_Security_GetDefaultClearKey. remove redundant |
|---|
| 53 | * comments. |
|---|
| 54 | * |
|---|
| 55 | * 11 3/16/10 9:46a erickson |
|---|
| 56 | * SW7400-2678: add NEXUS_Security_InvalidateKey |
|---|
| 57 | * |
|---|
| 58 | * 10 1/7/09 2:30p jgarrett |
|---|
| 59 | * PR 50093: Adding Multi2 |
|---|
| 60 | * |
|---|
| 61 | * 9 9/3/08 3:29p erickson |
|---|
| 62 | * PR45612: update |
|---|
| 63 | * |
|---|
| 64 | * 8 6/23/08 6:15p mphillip |
|---|
| 65 | * PR40027: Tidy up naming conventions to match with Nexus |
|---|
| 66 | * |
|---|
| 67 | * 7 6/17/08 6:16p mphillip |
|---|
| 68 | * PR40027: Retrieve more information from KeySlotHandle |
|---|
| 69 | * |
|---|
| 70 | * 6 6/17/08 11:14a mphillip |
|---|
| 71 | * PR40027: M2M function headers |
|---|
| 72 | * |
|---|
| 73 | * 5 6/17/08 12:31a mphillip |
|---|
| 74 | * PR40027: Keyslot changes for shim layer |
|---|
| 75 | * |
|---|
| 76 | * 4 5/29/08 10:57a mphillip |
|---|
| 77 | * PR38369: Fix consts to allow kernel builds |
|---|
| 78 | * |
|---|
| 79 | * 3 5/28/08 2:32p mphillip |
|---|
| 80 | * PR38369: Refactor keyslot configuration to Security module from Crypto |
|---|
| 81 | * module |
|---|
| 82 | * |
|---|
| 83 | * 2 2/29/08 11:04a erickson |
|---|
| 84 | * PR37137: create stub to remove sync thunk warning |
|---|
| 85 | * |
|---|
| 86 | * 1 1/18/08 2:21p jgarrett |
|---|
| 87 | * PR 38808: Merging to main branch |
|---|
| 88 | * |
|---|
| 89 | * Nexus_Devel/1 11/15/07 3:54p erickson |
|---|
| 90 | * PR37137: added Security module |
|---|
| 91 | * |
|---|
| 92 | **************************************************************************/ |
|---|
| 93 | #ifndef NEXUS_SECURITY_H__ |
|---|
| 94 | #define NEXUS_SECURITY_H__ |
|---|
| 95 | |
|---|
| 96 | #include "nexus_security_datatypes.h" |
|---|
| 97 | |
|---|
| 98 | /*=*********************************** |
|---|
| 99 | *************************************/ |
|---|
| 100 | |
|---|
| 101 | #ifdef __cplusplus |
|---|
| 102 | extern "C" |
|---|
| 103 | { |
|---|
| 104 | #endif |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | Summary: |
|---|
| 108 | This function retrieves keyslot information from a keyslot handle. |
|---|
| 109 | |
|---|
| 110 | Description: |
|---|
| 111 | This function shall retrieve keyslot information from a keyslot handle. |
|---|
| 112 | |
|---|
| 113 | See Also: |
|---|
| 114 | NEXUS_KeySlotInfo |
|---|
| 115 | **/ |
|---|
| 116 | void NEXUS_Security_GetKeySlotInfo( |
|---|
| 117 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 118 | NEXUS_SecurityKeySlotInfo * pKeyslotInfo /* [out] */ |
|---|
| 119 | ); |
|---|
| 120 | |
|---|
| 121 | /** |
|---|
| 122 | Summary: |
|---|
| 123 | Get default NEXUS_SecurityClearKey |
|---|
| 124 | **/ |
|---|
| 125 | void NEXUS_Security_GetDefaultClearKey( |
|---|
| 126 | NEXUS_SecurityClearKey *pClearKey /* [out] */ |
|---|
| 127 | ); |
|---|
| 128 | |
|---|
| 129 | /** |
|---|
| 130 | Summary: |
|---|
| 131 | This function loads a clear key to a keyslot. |
|---|
| 132 | |
|---|
| 133 | Description: |
|---|
| 134 | This function shall load clear key into the keyslot. |
|---|
| 135 | |
|---|
| 136 | Performance and Timing: |
|---|
| 137 | This is a synchronous function that will return when it is done. |
|---|
| 138 | **/ |
|---|
| 139 | NEXUS_Error NEXUS_Security_LoadClearKey( |
|---|
| 140 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 141 | const NEXUS_SecurityClearKey *pClearKey |
|---|
| 142 | ); |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | /** |
|---|
| 146 | Summary: |
|---|
| 147 | This function retrieves default keyslot settings. |
|---|
| 148 | |
|---|
| 149 | See Also: |
|---|
| 150 | NEXUS_SecurityKeySlotSettings |
|---|
| 151 | **/ |
|---|
| 152 | void NEXUS_Security_GetDefaultKeySlotSettings( |
|---|
| 153 | NEXUS_SecurityKeySlotSettings *pSettings /* [out] */ |
|---|
| 154 | ); |
|---|
| 155 | |
|---|
| 156 | /** |
|---|
| 157 | Summary: |
|---|
| 158 | This function creates a keyslot handle. |
|---|
| 159 | |
|---|
| 160 | Description: |
|---|
| 161 | This function shall create a keyslot handle based on the provided information. |
|---|
| 162 | |
|---|
| 163 | Performance and Timing: |
|---|
| 164 | This is a synchronous function that will return when it is done. |
|---|
| 165 | |
|---|
| 166 | Returns: |
|---|
| 167 | NEXUS_KeySlotHandle on success, NULL on failure. |
|---|
| 168 | |
|---|
| 169 | See Also: |
|---|
| 170 | NEXUS_Security_GetDefaultKeySlotSettings |
|---|
| 171 | NEXUS_Security_FreeKeySlot |
|---|
| 172 | |
|---|
| 173 | **/ |
|---|
| 174 | NEXUS_KeySlotHandle NEXUS_Security_AllocateKeySlot( /* attr{destructor=NEXUS_Security_FreeKeySlot} */ |
|---|
| 175 | const NEXUS_SecurityKeySlotSettings *pSettings |
|---|
| 176 | ); |
|---|
| 177 | |
|---|
| 178 | /** |
|---|
| 179 | Summary: |
|---|
| 180 | **/ |
|---|
| 181 | NEXUS_KeySlotHandle NEXUS_Security_LocateCaKeySlotAssigned( /* attr{destructor=NEXUS_Security_FreeKeySlot} */ |
|---|
| 182 | unsigned long pidchannel |
|---|
| 183 | ); |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | /***************************************************************************** |
|---|
| 187 | Summary: |
|---|
| 188 | This function frees a keyslot handle. |
|---|
| 189 | |
|---|
| 190 | Description: |
|---|
| 191 | See Also: |
|---|
| 192 | NEXUS_Security_AllocateKeySlot |
|---|
| 193 | **/ |
|---|
| 194 | void NEXUS_Security_FreeKeySlot( |
|---|
| 195 | NEXUS_KeySlotHandle keyHandle |
|---|
| 196 | ); |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | /** |
|---|
| 200 | Summary: |
|---|
| 201 | This function adds a PID channel to the CA or CACP keyslot. |
|---|
| 202 | |
|---|
| 203 | Description: |
|---|
| 204 | This function shall add a PID channel to the CA or CACP keyslot. The newly |
|---|
| 205 | added PID channel will use the alogirthm and key value of the CA or CACP |
|---|
| 206 | keyslot for descrambling or descrambling followed by CPS. |
|---|
| 207 | |
|---|
| 208 | See Also: |
|---|
| 209 | NEXUS_Security_RemovePidChannelFromKeySlot |
|---|
| 210 | **/ |
|---|
| 211 | NEXUS_Error NEXUS_Security_AddPidChannelToKeySlot( |
|---|
| 212 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 213 | unsigned int pidChannel |
|---|
| 214 | ); |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | /** |
|---|
| 218 | Summary: |
|---|
| 219 | This function removes a PID channel from the CA or CACP keyslot. |
|---|
| 220 | |
|---|
| 221 | Description: |
|---|
| 222 | This function shall remove a PID channel from the CA or CACP keyslot. The |
|---|
| 223 | removed PID channel will NOT use the algorithm and key value of the CA or CACP |
|---|
| 224 | keyslot anymore. |
|---|
| 225 | |
|---|
| 226 | See Also: |
|---|
| 227 | NEXUS_Security_AddPidChannelToKeySlot |
|---|
| 228 | |
|---|
| 229 | **/ |
|---|
| 230 | NEXUS_Error NEXUS_Security_RemovePidChannelFromKeySlot( |
|---|
| 231 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 232 | unsigned int pidChannel |
|---|
| 233 | ); |
|---|
| 234 | |
|---|
| 235 | /** |
|---|
| 236 | Summary: |
|---|
| 237 | This function retrieves default settings for CACP key invalidation. |
|---|
| 238 | |
|---|
| 239 | Description: |
|---|
| 240 | This function shall retrieve default settings for CACP key invalidation. |
|---|
| 241 | |
|---|
| 242 | See Also: |
|---|
| 243 | NEXUS_Security_InvalidateKey |
|---|
| 244 | **/ |
|---|
| 245 | void NEXUS_Security_GetDefaultInvalidateKeySettings( |
|---|
| 246 | NEXUS_SecurityInvalidateKeySettings *pSettings /* [out] */ |
|---|
| 247 | ); |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | /** |
|---|
| 251 | Summary: |
|---|
| 252 | This function invalidates the current settings for the key slot specified by keyHandle |
|---|
| 253 | |
|---|
| 254 | Description: |
|---|
| 255 | See Also: |
|---|
| 256 | NEXUS_SecurityInvalidateKeySettings |
|---|
| 257 | **/ |
|---|
| 258 | NEXUS_Error NEXUS_Security_InvalidateKey( |
|---|
| 259 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 260 | const NEXUS_SecurityInvalidateKeySettings *pSettings |
|---|
| 261 | ); |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | /** |
|---|
| 265 | Summary: |
|---|
| 266 | This function retrieves default algorithm settings. |
|---|
| 267 | **/ |
|---|
| 268 | void NEXUS_Security_GetDefaultAlgorithmSettings( |
|---|
| 269 | NEXUS_SecurityAlgorithmSettings *pSettings /* [out] */ |
|---|
| 270 | ); |
|---|
| 271 | |
|---|
| 272 | /** |
|---|
| 273 | Summary: |
|---|
| 274 | This function configures algorithm on a keyslot. |
|---|
| 275 | |
|---|
| 276 | Description: |
|---|
| 277 | Performance and Timing: |
|---|
| 278 | This is a synchronous function that will return when it is done. |
|---|
| 279 | |
|---|
| 280 | See Also: |
|---|
| 281 | NEXUS_Security_AllocateKeySlot |
|---|
| 282 | NEXUS_Security_GetDefaultAlgorithmSettings |
|---|
| 283 | **/ |
|---|
| 284 | NEXUS_Error NEXUS_Security_ConfigAlgorithm( |
|---|
| 285 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 286 | const NEXUS_SecurityAlgorithmSettings *pSettings |
|---|
| 287 | ); |
|---|
| 288 | |
|---|
| 289 | /** |
|---|
| 290 | Summary: |
|---|
| 291 | This function retrieves default multi2 settings. |
|---|
| 292 | **/ |
|---|
| 293 | void NEXUS_Security_GetDefaultMulti2Settings( |
|---|
| 294 | NEXUS_SecurityMulti2Settings *pSettings /* [out] */ |
|---|
| 295 | ); |
|---|
| 296 | |
|---|
| 297 | /** |
|---|
| 298 | Summary: |
|---|
| 299 | This function configures Multi2 on a keyslot. |
|---|
| 300 | |
|---|
| 301 | Description: |
|---|
| 302 | This function shall configure multi2 on a keyslot. |
|---|
| 303 | |
|---|
| 304 | Performance and Timing: |
|---|
| 305 | This is a synchronous function that will return when it is done. |
|---|
| 306 | |
|---|
| 307 | See Also: |
|---|
| 308 | NEXUS_Security_AllocateKeySlot |
|---|
| 309 | NEXUS_Security_GetDefaultAlgorithmSettings |
|---|
| 310 | **/ |
|---|
| 311 | NEXUS_Error NEXUS_Security_ConfigMulti2( |
|---|
| 312 | NEXUS_KeySlotHandle keyHandle, |
|---|
| 313 | const NEXUS_SecurityMulti2Settings *pSettings |
|---|
| 314 | ); |
|---|
| 315 | |
|---|
| 316 | #ifdef __cplusplus |
|---|
| 317 | } /* extern "C" */ |
|---|
| 318 | #endif |
|---|
| 319 | |
|---|
| 320 | #endif |
|---|