| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002-2008, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bhdmlib_hdcp.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/11 $ |
|---|
| 12 | * $brcm_Date: 4/2/08 4:30p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/syslib/hdmlib/bhdmlib_hdcp.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/11 4/2/08 4:30p vle |
|---|
| 21 | * PR 40101: Fix compiler errors when not building with HDCP. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/10 4/2/08 2:31p vle |
|---|
| 24 | * PR 40101: Time HDCP Keyloader function to accurately calculate |
|---|
| 25 | * appropriate wait time before reading R0' |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/9 7/16/07 6:19p vle |
|---|
| 28 | * PR 32662: Add BHDMlib_HDCP_Close(...) prototype |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/8 8/11/06 3:49p rgreen |
|---|
| 31 | * PR22187: Fix HDCP Key Loader to use standalone HSM PI |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/7 8/11/06 1:15p rgreen |
|---|
| 34 | * PR22187: Fix HDCP Key Loader to use standalone HSM PI |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/6 8/18/04 4:40p rgreen |
|---|
| 37 | * PR 12116: Add HDCP Key Loading Support |
|---|
| 38 | * Use new BHDM_EncryptedHdcpStructure for HDCP Key loading |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/5 5/13/04 4:32p rgreen |
|---|
| 41 | * PR 10273: HDMI / HDCP Revocation/renewability support requirement |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/4 4/5/04 1:17p rgreen |
|---|
| 44 | * PR8896: HDMI API Development/Test |
|---|
| 45 | * PR10273: HDCP Revocation/renewability support |
|---|
| 46 | * Add support to AuthenticateReceiver function for checking Revoked KSVs |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/3 2/13/04 7:57p rgreen |
|---|
| 49 | * PR8896: HDMI API Development/Test |
|---|
| 50 | * Add code to support Repeater Authentication; |
|---|
| 51 | * Use SIMULATE_REPEATER to generate Tx verifications values contained in |
|---|
| 52 | * the HDCP 1.1 Spec |
|---|
| 53 | * Modify BHDM_HDCP_AuthenticateRepeater call |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/2 1/27/04 1:04p rgreen |
|---|
| 56 | * PR8896: HDMI API Development/Test |
|---|
| 57 | * Move AuthenticateRepeater function to BHDMlib; needs access to XPT |
|---|
| 58 | * handle for authentication with HDCP Repeater |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/1 1/20/04 7:38p rgreen |
|---|
| 61 | * PR8896: HDMI API Development/Test |
|---|
| 62 | * Create HDMI HDCP Syslib to utilize XPT Key Serializer |
|---|
| 63 | * |
|---|
| 64 | ***************************************************************************/ |
|---|
| 65 | |
|---|
| 66 | #ifndef BHDMLIB_HDCP_H__ |
|---|
| 67 | #define BHDMLIB_HDCP_H__ |
|---|
| 68 | |
|---|
| 69 | #include "bhdm.h" |
|---|
| 70 | #include "bhdm_hdcp.h" |
|---|
| 71 | #include "btmr.h" |
|---|
| 72 | #include "bhdmlib_hdcp_keyloader.h" |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | #if BHSM_AEGIS_SUPPORT |
|---|
| 77 | #define BHDMLIB_KeyHandle BHSM_Handle |
|---|
| 78 | #define hHANDLE hHsm |
|---|
| 79 | #define hHDCP_BHDMLIB_KeyHandle hHDCP->hHsm |
|---|
| 80 | #else |
|---|
| 81 | #define BHDMLIB_KeyHandle BXPT_Handle |
|---|
| 82 | #define hHANDLE hXPT |
|---|
| 83 | #define hHDCP_BHDMLIB_KeyHandle hHDCP->hXPT |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | #ifdef __cplusplus |
|---|
| 87 | extern "C" { |
|---|
| 88 | #endif |
|---|
| 89 | |
|---|
| 90 | /****************************************************************************** |
|---|
| 91 | Summary: |
|---|
| 92 | HDMI Context Handle |
|---|
| 93 | *******************************************************************************/ |
|---|
| 94 | typedef struct BHDMlib_HDCP_P_Handle *BHDMlib_HDCP_Handle ; |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | /****************************************************************************** |
|---|
| 99 | Summary: |
|---|
| 100 | Open an HDMI HDCP handle to support HDP functions between the Transmitter and |
|---|
| 101 | the Receiver. |
|---|
| 102 | |
|---|
| 103 | Description: |
|---|
| 104 | This function initializes the handle/devices needed to support HDCP operations |
|---|
| 105 | between HDCP capable Transmitters and the Receivers |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | Input: |
|---|
| 109 | hHDMI - The HDMI device handle that the application created earlier |
|---|
| 110 | during the system initialization sequence. |
|---|
| 111 | |
|---|
| 112 | hXPT - pointer to the XPT device handle that the application created earlier |
|---|
| 113 | during the system initialization sequence. |
|---|
| 114 | |
|---|
| 115 | Output: |
|---|
| 116 | pHdcpHandle - pointer to a newly created HDMI/HDCP device handle. |
|---|
| 117 | |
|---|
| 118 | Returns: |
|---|
| 119 | BERR_SUCCESS - HDMI HDCP device handle successfully created |
|---|
| 120 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 121 | BERR_OUT_OF_SYSTEM_MEMORY - Not enough memory to create HDCP handle |
|---|
| 122 | |
|---|
| 123 | See Also: |
|---|
| 124 | o BHDM_Handle |
|---|
| 125 | o BXPT_Handle |
|---|
| 126 | |
|---|
| 127 | *******************************************************************************/ |
|---|
| 128 | BERR_Code BHDMlib_HDCP_Open( |
|---|
| 129 | BHDMlib_HDCP_Handle *pHdcpHandle, /* [out] HDMI HDCP handle */ |
|---|
| 130 | BHDM_Handle hHDMI, /* [in] HDMI device handle */ |
|---|
| 131 | BHDMLIB_KeyHandle hHANDLE |
|---|
| 132 | ) ; |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | /****************************************************************************** |
|---|
| 136 | Summary: |
|---|
| 137 | Close an HDMI HDCP handle |
|---|
| 138 | |
|---|
| 139 | Description: |
|---|
| 140 | This function uninitializes the handle/devices support HDCP operations |
|---|
| 141 | between HDCP capable Transmitters and the Receivers |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | Input: |
|---|
| 145 | hHDCP - The HDCP device handle that the application created earlier |
|---|
| 146 | during the system initialization sequence. |
|---|
| 147 | |
|---|
| 148 | Returns: |
|---|
| 149 | BERR_SUCCESS - HDMI HDCP device handle successfully created |
|---|
| 150 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 151 | BERR_OUT_OF_SYSTEM_MEMORY - Not enough memory to create HDCP handle |
|---|
| 152 | |
|---|
| 153 | See Also: |
|---|
| 154 | o BHDM_Handle |
|---|
| 155 | |
|---|
| 156 | *******************************************************************************/ |
|---|
| 157 | BERR_Code BHDMlib_HDCP_Close( |
|---|
| 158 | BHDMlib_HDCP_Handle hHDCP /* [in] HDCP lib handle */ |
|---|
| 159 | ); |
|---|
| 160 | |
|---|
| 161 | /****************************************************************************** |
|---|
| 162 | Summary: |
|---|
| 163 | Authenticate the HDCP link between the Transmitter and the Receiver. |
|---|
| 164 | |
|---|
| 165 | Description: |
|---|
| 166 | This function does the HDCP Authentication with a receiver as specified in the |
|---|
| 167 | HDCP specification. The return codes will indicate the source of failure; |
|---|
| 168 | if any. |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | Input: |
|---|
| 172 | hHDMI - The HDMI device handle that the application created earlier |
|---|
| 173 | during the system initialization sequence. |
|---|
| 174 | |
|---|
| 175 | AnSelection - HDCP An value to be generated by the HDCP core |
|---|
| 176 | |
|---|
| 177 | pTxAksv - pointer to the Transmitter Key Selection Vector (Aksv) shipped |
|---|
| 178 | with the HDCP key set from Digital-CP (www.digital-cp.com) |
|---|
| 179 | |
|---|
| 180 | pRekovedKsvList - pointer to list of revoked Ksvs retrieved from SRM message |
|---|
| 181 | |
|---|
| 182 | uiNumRevokedKsvs - number of Ksvs in the revoked list |
|---|
| 183 | |
|---|
| 184 | Output: |
|---|
| 185 | <none> |
|---|
| 186 | |
|---|
| 187 | Returns: |
|---|
| 188 | BERR_SUCCESS - HDCP protected link created. |
|---|
| 189 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 190 | BHDM_HDCP_RX_NO_DEVICE - No Rx Device is attached |
|---|
| 191 | BHDM_HDCP_RX_NO_HDCP_SUPPORT - Attached Rx Device has no HDCP support |
|---|
| 192 | BHDM_HDCP_RX_BKSV_ERROR - Attached Rx Device has invalid Bksv |
|---|
| 193 | BHDM_HDCP_TX_AKSV_ERROR - Transmtter Aksv value is invalid |
|---|
| 194 | BHDM_HDCP_AUTHENTICATE_ERROR - Link Authentication Value (R0) failed |
|---|
| 195 | |
|---|
| 196 | Note: |
|---|
| 197 | The pRevokedKsvList should be passed in as big-endian (the same endian-ness |
|---|
| 198 | contained in the original SRM message). |
|---|
| 199 | The HDCP keys are loaded using the Serializer in transport porting interface. |
|---|
| 200 | Use NULL and 0 for pRevokedKsvList and uiNumRevokedKsvs if no DCP LLC SRM |
|---|
| 201 | messages are available. |
|---|
| 202 | |
|---|
| 203 | See Also: |
|---|
| 204 | o BHDM_Handle |
|---|
| 205 | o BXPT_Handle |
|---|
| 206 | o BHDM_HDCP_AnSelect |
|---|
| 207 | o BHDM_HDCP_EnableSerialKeyLoad |
|---|
| 208 | |
|---|
| 209 | *******************************************************************************/ |
|---|
| 210 | BERR_Code BHDMlib_HDCP_AuthenticateReceiver( |
|---|
| 211 | BHDMlib_HDCP_Handle hHDCP, /* [in] HDMI HDCP handle */ |
|---|
| 212 | BHDM_HDCP_AnSelect AnSelection, /* [in] HDCP An type value to use */ |
|---|
| 213 | const uint8_t *pTxAksv, /* [in] pointer HDCP Key Set Aksv Value */ |
|---|
| 214 | const BHDM_EncryptedHdcpKeyStruct *pTxKeyStruct, /* [in] pointer to HDCP Keys */ |
|---|
| 215 | const uint8_t *pRevokedKsvList, /* [in] pointer to Revoked KSV List */ |
|---|
| 216 | const uint16_t uiNumRevokedKsvs /* [in] number of KSVs in Revoked Ksv List */ |
|---|
| 217 | ) ; |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | /****************************************************************************** |
|---|
| 222 | Summary: |
|---|
| 223 | Authenticate the HDCP link between the Transmitter and an HDCP Repeater. |
|---|
| 224 | |
|---|
| 225 | Description: |
|---|
| 226 | This function does the HDCP Authentication with an HDCP Repeater as specified |
|---|
| 227 | in the HDCP specification. The return codes will indicate the source of |
|---|
| 228 | failure; if any. |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | Input: |
|---|
| 232 | hHDMI - The HDMI device handle that the application created earlier |
|---|
| 233 | during the system initialization sequence. |
|---|
| 234 | |
|---|
| 235 | AnSelection - HDCP An value to be generated by the HDCP core |
|---|
| 236 | |
|---|
| 237 | pTxAksv - pointer to the Transmitter Key Selection Vector (Aksv) shipped |
|---|
| 238 | with the HDCP key set from Digital-CP (www.digital-cp.com) |
|---|
| 239 | |
|---|
| 240 | pRekovedKsvList - pointer to list of revoked Ksvs retrieved from SRM message |
|---|
| 241 | |
|---|
| 242 | uiNumRevokedKsvs - number of Ksvs in the revoked list |
|---|
| 243 | |
|---|
| 244 | Output: |
|---|
| 245 | <none> |
|---|
| 246 | |
|---|
| 247 | Returns: |
|---|
| 248 | BERR_SUCCESS - HDCP protected link created. |
|---|
| 249 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 250 | BHDM_HDCP_RX_NO_DEVICE - No Rx Device is attached |
|---|
| 251 | BHDM_HDCP_RX_NO_HDCP_SUPPORT - Attached Rx Device has no HDCP support |
|---|
| 252 | BHDM_HDCP_RX_BKSV_ERROR - Attached Rx Device has invalid Bksv |
|---|
| 253 | BHDM_HDCP_TX_AKSV_ERROR - Transmtter Aksv value is invalid |
|---|
| 254 | BHDM_HDCP_AUTHENTICATE_ERROR - Link Authentication Value (R0) failed |
|---|
| 255 | |
|---|
| 256 | See Also: |
|---|
| 257 | o BHDM_Handle |
|---|
| 258 | o BHDM_HDCP_AnSelect |
|---|
| 259 | |
|---|
| 260 | *******************************************************************************/ |
|---|
| 261 | BERR_Code BHDMlib_HDCP_AuthenticateRepeater( |
|---|
| 262 | BHDM_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 263 | uint8_t *RepeaterAuthenticated, |
|---|
| 264 | const uint8_t *pRevokedKsvList, /* [in] pointer to Revoked KSV List */ |
|---|
| 265 | const uint16_t uiNumRevokedKsvs /* [in] number of KSVs in Revoked Ksv List */ |
|---|
| 266 | ) ; |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | /****************************************************************************** |
|---|
| 270 | Summary: |
|---|
| 271 | Set the timer handle |
|---|
| 272 | |
|---|
| 273 | Description: |
|---|
| 274 | Save timer handle into HDMI HDCP handle to use for calculating the HDCP keys loading time. |
|---|
| 275 | Base on the loading time, an appropriate waiting time will be calculated to ensure R0' is |
|---|
| 276 | read 100ms after writing Aksv |
|---|
| 277 | |
|---|
| 278 | Input: |
|---|
| 279 | hHDCP - HDMI HDCP Handle |
|---|
| 280 | hTMR - Timer handle to be saved |
|---|
| 281 | |
|---|
| 282 | Returns: |
|---|
| 283 | BERR_SUCCESS |
|---|
| 284 | |
|---|
| 285 | See Also: |
|---|
| 286 | |
|---|
| 287 | *******************************************************************************/ |
|---|
| 288 | BERR_Code BHDMlib_HDCP_SetTimerHandle( |
|---|
| 289 | BHDMlib_HDCP_Handle hHDCP, /* [in] HDMI HDCP Handle */ |
|---|
| 290 | BTMR_Handle hTMR /* [in] TMR handle */ |
|---|
| 291 | ); |
|---|
| 292 | |
|---|
| 293 | |
|---|
| 294 | |
|---|
| 295 | /****************************************************************************** |
|---|
| 296 | Summary: |
|---|
| 297 | Get the Aksv value and keys from storage |
|---|
| 298 | |
|---|
| 299 | Description: |
|---|
| 300 | Simple debug/development function to return a Aksv value and associated HDCP |
|---|
| 301 | keys. Under production code this call would be replaced with a call which |
|---|
| 302 | would read these values from non volitale memory. The private keys should |
|---|
| 303 | be encrypted in the non-volitale memory. |
|---|
| 304 | |
|---|
| 305 | |
|---|
| 306 | Output: |
|---|
| 307 | pTxAksv copy of the Aksv value |
|---|
| 308 | pTxKeys copy of the BHDM_HDCP_NUM_KEYS HDCP Keys |
|---|
| 309 | |
|---|
| 310 | Returns: |
|---|
| 311 | BERR_SUCCESS |
|---|
| 312 | |
|---|
| 313 | Notes: |
|---|
| 314 | The pointers must point to allocated memory to hold the data values. |
|---|
| 315 | |
|---|
| 316 | See Also: |
|---|
| 317 | |
|---|
| 318 | *******************************************************************************/ |
|---|
| 319 | BERR_Code BHDMlib_HDCP_GetKeySet(uint8_t *pTxAksv, BHDM_EncryptedHdcpKeyStruct *EncryptedHdcpTxKey) ; |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | #ifdef __cplusplus |
|---|
| 324 | } |
|---|
| 325 | #endif |
|---|
| 326 | |
|---|
| 327 | #endif /* BHDMLIB_HDCP_H__ */ |
|---|