| 1 | /******************************************************************************************** |
|---|
| 2 | * (c)2004-2011 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 * |
|---|
| 17 | * the valuable trade secrets of Broadcom, and you shall use all reasonable efforts to * |
|---|
| 18 | * protect the confidentiality thereof,and to use this information only in connection * |
|---|
| 19 | * with your use of Broadcom integrated circuit products. * |
|---|
| 20 | * * |
|---|
| 21 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * |
|---|
| 22 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR * |
|---|
| 23 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO * |
|---|
| 24 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES * |
|---|
| 25 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, * |
|---|
| 26 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION * |
|---|
| 27 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF * |
|---|
| 28 | * USE OR PERFORMANCE OF THE SOFTWARE. * |
|---|
| 29 | * * |
|---|
| 30 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS * |
|---|
| 31 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR * |
|---|
| 32 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR * |
|---|
| 33 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF * |
|---|
| 34 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT * |
|---|
| 35 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE * |
|---|
| 36 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF * |
|---|
| 37 | * ANY LIMITED REMEDY. |
|---|
| 38 | * |
|---|
| 39 | * $brcm_Workfile: b_dtcp_ake.h $ |
|---|
| 40 | * $brcm_Revision: 7 $ |
|---|
| 41 | * $brcm_Date: 2/11/11 5:37p $ |
|---|
| 42 | * |
|---|
| 43 | * Module Description: |
|---|
| 44 | * DTCP AKE core data |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/lib/dtcp_ip/include/b_dtcp_ake.h $ |
|---|
| 49 | * |
|---|
| 50 | * 7 2/11/11 5:37p leisun |
|---|
| 51 | * SWSECURITY-32: Updated lib to V1SE1.3 conformance. |
|---|
| 52 | * |
|---|
| 53 | * 6 1/12/11 1:20p leisun |
|---|
| 54 | * SWSECURITY-29: Add RESPONSE2 to DTCP-IP lib |
|---|
| 55 | * |
|---|
| 56 | * 5 12/1/10 4:45p leisun |
|---|
| 57 | * SW7408-187: DTCP-IP for BE platform fix |
|---|
| 58 | * |
|---|
| 59 | * 4 7/13/09 11:23a leisun |
|---|
| 60 | * PR 55693: Re-design interfaces, and other cleanups |
|---|
| 61 | * |
|---|
| 62 | * 3 6/30/09 10:37p leisun |
|---|
| 63 | * PR 55693: Added exchange key expiration timer |
|---|
| 64 | * |
|---|
| 65 | * 2 6/25/09 4:30p leisun |
|---|
| 66 | * PR 55693: Fix memory leak for DTCP |
|---|
| 67 | * |
|---|
| 68 | * 1 6/5/09 4:06p leisun |
|---|
| 69 | * PR 55693: checking in DTCP-IP lib |
|---|
| 70 | *********************************************************************************************/ |
|---|
| 71 | /*! \file b_dtcp_ake.h |
|---|
| 72 | * \brief define AKE core session data structure. |
|---|
| 73 | */ |
|---|
| 74 | #ifndef B_DTCP_AKE_H |
|---|
| 75 | #define B_DTCP_AKE_H |
|---|
| 76 | |
|---|
| 77 | #ifdef __cplusplus |
|---|
| 78 | extern "C" { |
|---|
| 79 | #endif |
|---|
| 80 | |
|---|
| 81 | #include "b_os_lib.h" |
|---|
| 82 | #include "blst_slist.h" |
|---|
| 83 | #include "b_dtcp_constants.h" |
|---|
| 84 | #include "b_dtcp_types.h" |
|---|
| 85 | #include "b_dtcp_exch_key.h" |
|---|
| 86 | |
|---|
| 87 | #define DTCP_CAPABILITY_NB_MASK 0x1 |
|---|
| 88 | #define DTCP_CAPABILITY_CIH_MASK 0x1 |
|---|
| 89 | #define DTCP_AKE_CMD_TIMEOUT 40000 |
|---|
| 90 | |
|---|
| 91 | /* \skipline struct B_DTCP_AkeCoreSessionData |
|---|
| 92 | */ |
|---|
| 93 | struct B_DTCP_AkeCoreSessionData; |
|---|
| 94 | |
|---|
| 95 | /*! \enum B_CType |
|---|
| 96 | * |
|---|
| 97 | */ |
|---|
| 98 | typedef enum B_CType |
|---|
| 99 | { |
|---|
| 100 | B_CType_eControl = 0, |
|---|
| 101 | B_CType_eStatus = 1, |
|---|
| 102 | B_CType_eSpecificInquiry = 2, |
|---|
| 103 | B_CType_eNotify = 3, |
|---|
| 104 | B_CType_eGeneralInquiry = 4 |
|---|
| 105 | }B_CType_T; |
|---|
| 106 | /*! \enum B_AkeResponse |
|---|
| 107 | */ |
|---|
| 108 | typedef enum B_AkeResponse |
|---|
| 109 | { |
|---|
| 110 | B_Response_eNotImplemented = 0x8, |
|---|
| 111 | B_Response_eAccepted = 0x9, |
|---|
| 112 | B_Response_eRejected = 0xA, |
|---|
| 113 | B_Response_eInTransition = 0xB, |
|---|
| 114 | B_Response_eStable = 0xC, |
|---|
| 115 | B_Response_eChanged = 0xD, |
|---|
| 116 | B_Response_eInterim = 0xF |
|---|
| 117 | }B_AkeResponse_T; |
|---|
| 118 | |
|---|
| 119 | /*! \enum B_AkeCommands |
|---|
| 120 | */ |
|---|
| 121 | typedef enum B_AkeCommands |
|---|
| 122 | { |
|---|
| 123 | B_AkeCmd_eChallenge = 1, |
|---|
| 124 | B_AkeCmd_eResponse = 2, |
|---|
| 125 | B_AkeCmd_eExchangeKey = 3, |
|---|
| 126 | B_AkeCmd_eSRM = 4, |
|---|
| 127 | B_AkeCmd_eResponse2 = 5, |
|---|
| 128 | B_AkeCmd_eCapabilityExchange = 0x20, |
|---|
| 129 | B_AkeCmd_eAkeCancel = 0xC0, |
|---|
| 130 | B_AkeCmd_eContentKeyReq = 0x80, |
|---|
| 131 | B_AkeCmd_eSetDtcpMode = 0x81, |
|---|
| 132 | B_AkeCmd_eCapabilityReq = 0x82, |
|---|
| 133 | B_AkeCmd_eStatus = 0xFF |
|---|
| 134 | }B_AkeCommands_T; |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | /*! \enum B_AkeStatus |
|---|
| 138 | */ |
|---|
| 139 | typedef enum B_AkeStatus |
|---|
| 140 | { |
|---|
| 141 | B_AkeStatus_eOK = 0, |
|---|
| 142 | B_AkeStatus_eNoMoreAuth, |
|---|
| 143 | B_AkeStatus_eNoIso, |
|---|
| 144 | B_AkeStatus_eNoP2P, |
|---|
| 145 | B_AkeStatus_eNoAC, |
|---|
| 146 | B_AkeStatus_eOther = 0x7, |
|---|
| 147 | B_AkeStatus_eIncorrectCmdOrder = 0x8, |
|---|
| 148 | B_AkeStatus_eAuthFailed = 0x9, |
|---|
| 149 | B_AkeStatus_eSyntexError = 0xA, |
|---|
| 150 | B_AkeStatus_eNoInfo = 0xF |
|---|
| 151 | }B_AkeStatus_T; |
|---|
| 152 | |
|---|
| 153 | /*! \enum B_AkeState |
|---|
| 154 | */ |
|---|
| 155 | typedef enum B_AkeState |
|---|
| 156 | { |
|---|
| 157 | B_AkeState_eIdle, |
|---|
| 158 | B_AkeState_eChallenge, |
|---|
| 159 | B_AkeState_eResponse, |
|---|
| 160 | B_AkeState_eResponse2, |
|---|
| 161 | B_AkeState_eExchangeKey, |
|---|
| 162 | B_AkeState_eSrm, |
|---|
| 163 | B_AkeState_eAuthenticated, |
|---|
| 164 | B_AkeState_eCanceled, |
|---|
| 165 | B_AkeState_eError, |
|---|
| 166 | B_AkeState_eCompleted, |
|---|
| 167 | B_AkeState_eMax |
|---|
| 168 | }B_AkeState_T; |
|---|
| 169 | |
|---|
| 170 | /*! \struct B_DTCP_AuthDeviceId |
|---|
| 171 | * \brief Authenticated device id struct wrapper, for linked list operation |
|---|
| 172 | */ |
|---|
| 173 | typedef struct B_DTCP_AuthDeviceId |
|---|
| 174 | { |
|---|
| 175 | BLST_S_ENTRY(B_DTCP_AuthDeviceId) node; /*!< list node. */ |
|---|
| 176 | unsigned char DeviceId[DTCP_DEVICE_ID_SIZE]; /*!< Authenticated device id */ |
|---|
| 177 | }B_DTCP_AuthDeviceId_T; |
|---|
| 178 | |
|---|
| 179 | /*! \struct B_DTCP_AkeCoreData |
|---|
| 180 | * \brief core data structure for source device to maintain AKE session for sink devices. |
|---|
| 181 | */ |
|---|
| 182 | typedef struct B_DTCP_AkeCoreData |
|---|
| 183 | { |
|---|
| 184 | BLST_S_HEAD(DtcpAkeSessions, B_DTCP_AkeCoreSessionData) AkeSession_list;/*!< active AKE sessions */ |
|---|
| 185 | BLST_S_HEAD(AuthDeviceIds, B_DTCP_AuthDeviceId) AuthDevice_list; /*!< dev's id list of authenticated sink device*/ |
|---|
| 186 | B_DTCP_ExchKeyData_T ExchKeyData; /*!< Source device's exchange key data. */ |
|---|
| 187 | int AuthDeviceCount; /*!< count of authenticated sink device */ |
|---|
| 188 | unsigned char RealTimeNonce[DTCP_CONTENT_KEY_NONCE_SIZE]; /*!< source device's content key nonce */ |
|---|
| 189 | B_ThreadHandle hRtNonceThread; /*!< realtime nonce timer thread handle */ |
|---|
| 190 | B_ThreadFunc RtNonceThreadFunc; /*!< realtime nonce timer thread function.*/ |
|---|
| 191 | |
|---|
| 192 | B_SchedulerHandle hExchKeyScheduler; /*!< scheduler for exchange key timer */ |
|---|
| 193 | B_SchedulerTimerId ExchKeyTimer; /*!< source device's exchange key timer id */ |
|---|
| 194 | B_ThreadHandle hExchKeyThread; /*!< exchange key timer scheduler thread handle */ |
|---|
| 195 | B_ThreadFunc ExchKeyThreadFunc; /*!< exchange key timer scheduler thread function */ |
|---|
| 196 | B_MutexHandle hMutex; /*!< mutex to protect shared data */ |
|---|
| 197 | BCRYPT_Handle hBcrypt; |
|---|
| 198 | unsigned char AkeLabelCounter; /*!< source device's AKE label counter.*/ |
|---|
| 199 | void * pProtocolData; /*!< Protocol specific data pointer */ |
|---|
| 200 | |
|---|
| 201 | }B_AkeCoreData_T; |
|---|
| 202 | |
|---|
| 203 | /* \skipline struct __b_dtcp_stream_data |
|---|
| 204 | */ |
|---|
| 205 | struct __b_dtcp_stream_data; |
|---|
| 206 | |
|---|
| 207 | #define PCP_UR_SINK (1 << 31) |
|---|
| 208 | #define PCP_UR_FLAG 1 |
|---|
| 209 | /*! \struct B_DTCP_AkeCoreSessionData |
|---|
| 210 | * \brief Ake Core session data structure(per session data). |
|---|
| 211 | */ |
|---|
| 212 | typedef struct B_DTCP_AkeCoreSessionData |
|---|
| 213 | { |
|---|
| 214 | BLST_S_ENTRY(B_DTCP_AkeCoreSessionData) node; |
|---|
| 215 | int SessionId; /*!< session id */ |
|---|
| 216 | B_AkeCoreData_T * pAkeCoreData; /*!< Ake Core data, shared among all sessions */ |
|---|
| 217 | B_DeviceMode_T DeviceMode; /*!< sink or source device*/ |
|---|
| 218 | B_AkeType_T AkeType; /*!< the type of AKE being performed */ |
|---|
| 219 | B_ExchangeKeyType_T ExchKeyType; /*!< the type of exchange key */ |
|---|
| 220 | B_DTCP_ExchKeyData_T ExchKeyData; /*!< exchange key for this AKE */ |
|---|
| 221 | unsigned char AkeLabel; /*!< Ake label for this session */ |
|---|
| 222 | B_SchedulerTimerId ExchKeyTimer; /*!< sink device exchange key timer id */ |
|---|
| 223 | unsigned char SourceExchKeyLabel; /*!< source device's most recent exchange key label */ |
|---|
| 224 | unsigned char SourceRTNonce[DTCP_CONTENT_KEY_NONCE_SIZE]; /*!< Source device's most recent realtime nonce */ |
|---|
| 225 | |
|---|
| 226 | unsigned char OtherDeviceId[DTCP_DEVICE_ID_SIZE]; /*!< device id of the other device */ |
|---|
| 227 | unsigned char Nonce[DTCP_FULL_AUTH_NONCE_SIZE]; /*!< our nonce */ |
|---|
| 228 | int NonceSize; /*!< our nonce size */ |
|---|
| 229 | unsigned char OtherNonce[DTCP_FULL_AUTH_NONCE_SIZE]; /*!< Other device's nonce */ |
|---|
| 230 | int OtherNonceSize; /*!< other device's nonce size */ |
|---|
| 231 | unsigned char OtherPublicKey[DTCP_PUBLIC_KEY_SIZE]; /*!< other device's public key*/ |
|---|
| 232 | int OtherKsv; /*!< other device's key selction vector */ |
|---|
| 233 | unsigned short OtherSrmG; /*!< other device's Supported SRM generation*/ |
|---|
| 234 | unsigned short OtherSrmV; /*!< other device's SRM version */ |
|---|
| 235 | unsigned short OtherSrmC; /*!< other device's SRM Current Generation */ |
|---|
| 236 | int OtherAP; /*!< other device's AP flag */ |
|---|
| 237 | int OtherAL; /*!< other device's AL flag */ |
|---|
| 238 | bool OtherSrmReplaceRequired; /*!< replace other device's SRM with our SRM. */ |
|---|
| 239 | bool OtherSrmUpdateRequired; /*!< update other device's SRM upto its max supported geneeration. */ |
|---|
| 240 | bool OtherDeviceRevoked; /*!< The sink device is revoked. */ |
|---|
| 241 | unsigned char FirstPhaseValue[DTCP_EC_DH_FIRST_PHASE_VALUE_SIZE]; /*!< our ec-dh first phase value */ |
|---|
| 242 | unsigned char FirstPhaseSecret[DTCP_DH_FIRST_PHASE_SECRET_SIZE]; /*!< our ec-dh first phase secret*/ |
|---|
| 243 | unsigned char OtherFirstPhaseValue[DTCP_EC_DH_FIRST_PHASE_VALUE_SIZE]; |
|---|
| 244 | unsigned char OtherFirstPhaseSecret[DTCP_DH_FIRST_PHASE_SECRET_SIZE]; |
|---|
| 245 | unsigned char AuthKey[DTCP_AUTH_KEY_SIZE]; /*!< derived Authentication key */ |
|---|
| 246 | unsigned char RealTimeNonce[DTCP_CONTENT_KEY_NONCE_SIZE]; /* sink device received content key nonce */ |
|---|
| 247 | unsigned int sink_cap; /*!< sink capability */ |
|---|
| 248 | unsigned int pcp_ur_cap; /*!< source device support pcp_ur or not */ |
|---|
| 249 | unsigned char CapabilityExchSignature[DTCP_SIGNATURE_SIZE]; /* Capability exchange message signature */ |
|---|
| 250 | bool Authenticated; /*!< flag to indicated if the AKE succeedded or not*/ |
|---|
| 251 | unsigned char * CmdBuffer; /*!< Ake command buffer */ |
|---|
| 252 | int CmdBufferSize; /*!< command buffer size */ |
|---|
| 253 | int CurrentState; /*!< current AKE state */ |
|---|
| 254 | B_MutexHandle hMutex; /*!< Mutex to protect shared data.*/ |
|---|
| 255 | |
|---|
| 256 | /* Time out checking variables */ |
|---|
| 257 | B_Time ChallengeSentTime; |
|---|
| 258 | B_Time ChallengeReceivedTime; |
|---|
| 259 | B_Time ResponseSentTime; |
|---|
| 260 | B_Time ResponseReceivedTime; |
|---|
| 261 | B_Time ExchKeySentTime; |
|---|
| 262 | B_Time ExchKeyReceivedTime; |
|---|
| 263 | B_Time SrmReceivedTime; |
|---|
| 264 | |
|---|
| 265 | BLST_S_HEAD(streams, __b_dtcp_stream_data) Stream_list; /*!< active streams */ |
|---|
| 266 | |
|---|
| 267 | void * pProtocolData; /*!< protocol specific data pointer */ |
|---|
| 268 | |
|---|
| 269 | }B_AkeCoreSessionData_T; |
|---|
| 270 | |
|---|
| 271 | /* \brief For interface with streaming interface |
|---|
| 272 | */ |
|---|
| 273 | typedef void * B_AkeHandle_T; |
|---|
| 274 | |
|---|
| 275 | /* --------------------------------------Function prototypes ----------------------------------------*/ |
|---|
| 276 | |
|---|
| 277 | /*! \brief utility to get Ake Type based on device's parameter. |
|---|
| 278 | * \param[out] pAkeType AKE type. |
|---|
| 279 | * \param[in] pDeviceParams device parameter pointer. |
|---|
| 280 | * \retval BERR_SUCCESS or other error code. |
|---|
| 281 | */ |
|---|
| 282 | BERR_Code B_DTCP_GetAkeTypeFromCertificate(B_AkeType_T * pAkeType, B_DeviceParams_T * pDeviceParams); |
|---|
| 283 | |
|---|
| 284 | /*! \brief allocate and initialize AKE core data. |
|---|
| 285 | * \param[in] Mode the device mode, source or sink. |
|---|
| 286 | * \retval pointer to the core data if success or NULL if failed. |
|---|
| 287 | */ |
|---|
| 288 | B_AkeCoreData_T * B_DTCP_AkeCoreInit( B_DeviceMode_T Mode); |
|---|
| 289 | |
|---|
| 290 | /*! \brief clean up Ake core data. |
|---|
| 291 | * \param[in] CoreData pointer to AKE core data. |
|---|
| 292 | * \retval BERR_SUCCESS or other error code. |
|---|
| 293 | * There must be no active AKE sessions before calling this function, e.g. CoreData->AkeSession_list is empty. |
|---|
| 294 | */ |
|---|
| 295 | void B_DTCP_AkeCore_UnInit(B_AkeCoreData_T * CoreData); |
|---|
| 296 | |
|---|
| 297 | /*! \brief open an AKE session, initialize session data. |
|---|
| 298 | * \param[in] CoreData AKE core data poiner. |
|---|
| 299 | * \param[in] AkeType type of the AKE , restricted, full, etc. |
|---|
| 300 | * \param[in] DeviceMode source or sink device. |
|---|
| 301 | * \param[in,out] akeHandle returned AKE session handle, if success. |
|---|
| 302 | * \retval BERR_SUCCESS or other error code. |
|---|
| 303 | */ |
|---|
| 304 | BERR_Code B_DTCP_CreateAkeSession(B_AkeCoreData_T * CoreData, int AkeType, B_DeviceMode_T DeviceMode, |
|---|
| 305 | B_AkeCoreSessionData_T ** akeHandle); |
|---|
| 306 | |
|---|
| 307 | /*! \brief destroy an AKe session, free allocted resources. |
|---|
| 308 | * \param[in] pSession AKE session data to be destroyed. |
|---|
| 309 | * \retval none. |
|---|
| 310 | */ |
|---|
| 311 | void B_DTCP_DestroyAkeSession(B_AkeCoreSessionData_T * pSession); |
|---|
| 312 | |
|---|
| 313 | /*! \brief increase a 64 bits nonce(Number used once) by 1, called by content management and conteng key confirmation functions. |
|---|
| 314 | * \param[in] hMutex session's mutex handle. |
|---|
| 315 | * \param[in,out] nonce , nonce value to operate on. |
|---|
| 316 | * This function assume for 8 bytes nonce (content key nonce). |
|---|
| 317 | */ |
|---|
| 318 | void B_DTCP_IncrementNonce(B_MutexHandle hMutex, unsigned char nonce[8]); |
|---|
| 319 | |
|---|
| 320 | /*! \brief compare two 64 bits nonce(Number used once ) value |
|---|
| 321 | * \param[in] anonce first value to compare. |
|---|
| 322 | * \param[in] bnonce second value to compare. |
|---|
| 323 | * \retval the difference between two nonce, in 32 bits number. |
|---|
| 324 | * |
|---|
| 325 | * This implementation assume the diff is within 32 bits long. |
|---|
| 326 | */ |
|---|
| 327 | long B_DTCP_GetNonceDiff(unsigned char anonce[8], unsigned char bnonce[8]); |
|---|
| 328 | |
|---|
| 329 | /*! \brief utility function to get or set realtime nonce value from core data. |
|---|
| 330 | * \param[in] hMutex mutex to protect shared data. |
|---|
| 331 | * \param[in] RtNonceIn pointer contain the Nonce to be copied. |
|---|
| 332 | * \param[out] RtNonceOut pointer contain output buffer. |
|---|
| 333 | * \retval none. |
|---|
| 334 | * |
|---|
| 335 | * If hMutex is not NULL, it will be locked during the operation. |
|---|
| 336 | */ |
|---|
| 337 | void B_DTCP_GetSetRealTimeNonce(B_MutexHandle hMutex, const unsigned char RtNonceIn[DTCP_CONTENT_KEY_NONCE_SIZE], |
|---|
| 338 | unsigned char RtNonceOut[DTCP_CONTENT_KEY_NONCE_SIZE]); |
|---|
| 339 | |
|---|
| 340 | /*! \brief Add a session to authenticated Session list |
|---|
| 341 | * \param[in] pSession session pointer. |
|---|
| 342 | * \retval none |
|---|
| 343 | */ |
|---|
| 344 | void B_DTCP_AddSessionToList( B_AkeCoreSessionData_T * pSession ); |
|---|
| 345 | |
|---|
| 346 | /*! \brief Remove AKE session from authenticated session list. |
|---|
| 347 | * \param[in] pSession Authenticated AKE session pointer. |
|---|
| 348 | * \retval BERR_SUCCESS or other error code. |
|---|
| 349 | */ |
|---|
| 350 | void B_DTCP_RemoveSessionFromList( B_AkeCoreSessionData_T * pSession ); |
|---|
| 351 | /*! \brief remove and clean all active AKE sessions, for source device. |
|---|
| 352 | * \param[in] pAkeCoreData core AKE data. |
|---|
| 353 | * \retval none |
|---|
| 354 | */ |
|---|
| 355 | void B_DTCP_CleanAkeSessionList(B_AkeCoreData_T * pAkeCoreData, bool destroy); |
|---|
| 356 | |
|---|
| 357 | /*! \brief check if given device is authenticated, called by source device only. |
|---|
| 358 | * \param[in] DeviceId device id to be checked. |
|---|
| 359 | * \retval true if it's in authenticated device list, false otherwise. |
|---|
| 360 | */ |
|---|
| 361 | bool B_DTCP_IsDeviceAuthenticated(B_AkeCoreData_T * CoreData, unsigned char DeviceId[DTCP_DEVICE_ID_SIZE]); |
|---|
| 362 | |
|---|
| 363 | /*! \brief check if Addional Localization is required. |
|---|
| 364 | * \param[in] DeviceParams device parameter. |
|---|
| 365 | * \param[in] Session Ake session pointer. |
|---|
| 366 | * \retval true if AL required, false otherwise. |
|---|
| 367 | */ |
|---|
| 368 | bool B_DTCP_IsALRequired(B_DeviceParams_T * DeviceParams, B_AkeCoreSessionData_T * Session); |
|---|
| 369 | |
|---|
| 370 | /*! \brief start exchange key update/invalidate timer |
|---|
| 371 | * |
|---|
| 372 | * For source device, this function is called after AKE core data is initialized, and will be |
|---|
| 373 | * called everytime exiting from PacketizeData function to reschedule the timer. |
|---|
| 374 | * |
|---|
| 375 | * For sink device, this function will be called after AKE is done, and will be called everytime |
|---|
| 376 | * exiting from DepacketizeData function to reschedule timer. |
|---|
| 377 | * |
|---|
| 378 | * \param[in] AkeCore AKE core Data pointer. |
|---|
| 379 | * \param[in] hAkeHandle AKE session data handle, if called by source device, it can be NULL. |
|---|
| 380 | * \param[in] Mode source or sink device? |
|---|
| 381 | * \retval BERR_SUCCESS or other error code. |
|---|
| 382 | */ |
|---|
| 383 | BERR_Code B_DTCP_StartExchKeyTimer(B_AkeCoreSessionData_T * Session, B_AkeCoreData_T * CoreData, B_DeviceMode_T Mode); |
|---|
| 384 | |
|---|
| 385 | #ifdef BDBG_DEBUG_BUILD |
|---|
| 386 | void B_DTCP_DebugBuff(unsigned char * buffer, int size); |
|---|
| 387 | #define BDBG_BUFF(buff, size) B_DTCP_DebugBuff(buff, size) |
|---|
| 388 | #else |
|---|
| 389 | #define BDBG_BUFF(buff, size) |
|---|
| 390 | #endif |
|---|
| 391 | |
|---|
| 392 | #ifdef __cplusplus |
|---|
| 393 | } |
|---|
| 394 | #endif /* __cplusplus */ |
|---|
| 395 | |
|---|
| 396 | #endif /* B_DTCP_AKE_H */ |
|---|