source: svn/newcon3bcm2_21bu/nexus/extensions/security/nsk2avk/7552/include/nexus_nsk2avk.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 13.7 KB
Line 
1/***************************************************************************
2 *     (c)2007-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 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_nsk2avk.h $
39 * $brcm_Revision: 1 $
40 * $brcm_Date: 9/21/11 1:33p $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/extensions/security/nsk2avk/7422/include/nexus_nsk2avk.h $
47 *
48 * 1   9/21/11 1:33p atruong
49 * SW7346-495: Add NSK2AVK support
50 *
51 *
52 ******************************************************************************/
53
54#ifndef NEXUS_NSK2AVK_H__
55#define NEXUS_NSK2AVK_H__
56
57#include "nexus_security_datatypes.h"
58#include "nexus_security.h"
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
64#define NEXUS_AVKEYLADDER_KEY_DATA_LEN     16
65#define NEXUS_AVKEYLADDER_SCD_DATA_LEN           8
66#define NEXUS_AVKEYLADDER_CMD_CHAIN_LEN          4
67
68#ifndef NEXUS_KEYLADDER_H__
69/**
70Summary:
71This enum defines the supported root key sources.
72**/
73typedef enum NEXUS_SecurityRootKeySrc
74{
75    NEXUS_SecurityRootKeySrc_eCuskey,
76    NEXUS_SecurityRootKeySrc_eOtpKeyA,
77    NEXUS_SecurityRootKeySrc_eOtpKeyB,
78    NEXUS_SecurityRootKeySrc_eOtpKeyC,
79                NEXUS_SecurityRootKeySrc_eOtpKeyD,
80                NEXUS_SecurityRootKeySrc_eOtpKeyE,
81                NEXUS_SecurityRootKeySrc_eOtpKeyF,
82    NEXUS_SecurityRootKeySrc_eReserved0,
83    NEXUS_SecurityRootKeySrc_eReserved1,
84    NEXUS_SecurityRootKeySrc_eReserved2,
85
86    /* Add new key entry type definition before this line */
87    NEXUS_SecurityRootKeySrc_eMax
88}   NEXUS_SecurityRootKeySrc;
89
90/**
91Summary:
92This enum defines the supported swizzle types.
93**/
94typedef enum NEXUS_SecuritySwizzleType
95{
96    NEXUS_SecuritySwizzleType_eNone,
97    NEXUS_SecuritySwizzleType_eSwizzle1,
98    NEXUS_SecuritySwizzleType_eSwizzle0,
99
100    /* Add new swizzle type definition before this line */
101    NEXUS_SecuritySwizzleType_eMax
102}   NEXUS_SecuritySwizzleType;
103
104/**
105Summary:
106This enum defines the supported swizzle types.
107**/
108typedef enum NEXUS_SecurityKeyMode
109{
110    NEXUS_SecurityKeyMode_eRegular,
111    NEXUS_SecurityKeyMode_eDes56,
112    NEXUS_SecurityKeyMode_eReserved2,
113    NEXUS_SecurityKeyMode_eReserved3,
114    NEXUS_SecurityKeyMode_eDvbConformance,
115
116    /* Add new swizzle type definition before this line */
117    NEXUS_SecurityKeyMode_eMax
118}   NEXUS_SecurityKeyMode;
119#endif  /* NEXUS_KEYLADDER_H__ */       
120
121typedef enum NEXUS_NSK2AVK_SPROFILE
122{
123        NEXUS_NSK2AVK_SPROFILE_eA3                                                      =       100,
124        NEXUS_NSK2AVK_SPROFILE_eDes                                                     = 101,
125
126        NEXUS_NSK2AVK_SPROFILE_MAX
127} NEXUS_NSK2AVK_SPROFILE;
128
129typedef enum NEXUS_NSK2AVK_M2M_SPROFILE
130{                               
131        NEXUS_NSK2AVK_M2M_SPROFILE_eDES_ECB_CLR_CLR     =0x13, 
132        NEXUS_NSK2AVK_M2M_SPROFILE_eDES_CBC_SCTE52_IV2  =0x14, 
133        NEXUS_NSK2AVK_M2M_SPROFILE_eDES_CBC_SCTE52_IV1  =0x15, 
134        NEXUS_NSK2AVK_M2M_SPROFILE_eDES_CBC_CLR_CLR     =0x19, 
135        NEXUS_NSK2AVK_M2M_SPROFILE_eTDES_ECB_CLR_CLR    =0x25, 
136        NEXUS_NSK2AVK_M2M_SPROFILE_eTDES_CBC_SCTE52_IV2 =0x26, 
137        NEXUS_NSK2AVK_M2M_SPROFILE_eTDES_CBC_SCTE52_IV1 =0x27, 
138        NEXUS_NSK2AVK_M2M_SPROFILE_eTDES_CBC_CLR_CLR    =0x2B, 
139        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_ECB_CLR_CLR     =0x36, 
140        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_CTR             =0x40, 
141        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_CBC_CTS_IV2     =0x37, 
142        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_CBC_CTS_CLR     =0x39, 
143        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_CBC_SCTE52_IV2  =0x3A, 
144        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_CBC_SCTE52_CLR  =0x3C, 
145        NEXUS_NSK2AVK_M2M_SPROFILE_eAES_CBC_CLR_CLR     =0x3F, 
146        NEXUS_NSK2AVK_M2M_SPROFILE_eRC4                 =0x50, 
147        NEXUS_NSK2AVK_M2M_SPROFILE_eMax
148} NEXUS_NSK2AVK_M2M_SPROFILE;         
149
150typedef enum NEXUS_NSK2AVK_EsaCode
151{
152    NEXUS_NSK2AVK_EsaCode_eAes                                                  = 0,
153    NEXUS_NSK2AVK_EsaCode_eDvbCsa2                                      = 1,
154    NEXUS_NSK2AVK_EsaCode_eDes                                                  = 2,
155    NEXUS_NSK2AVK_EsaCode_e3Des                                                 = 3,
156    NEXUS_NSK2AVK_EsaCode_eMulti2                                               = 4,
157    NEXUS_NSK2AVK_EsaCode_eDvbCsa2Conformance     = 5,
158    NEXUS_NSK2AVK_EsaCode_eDvbCsa3                                      = 6
159
160} NEXUS_NSK2AVK_EsaCode;
161
162typedef enum NEXUS_NSK2AVK_EsaSubSelectCode
163{
164    NEXUS_NSK2AVK_EsaSubSelectCode_eLSACBCMDI                                   = 0,
165    NEXUS_NSK2AVK_EsaSubSelectCode_eSYNAMEDIAAES        = 1,
166    NEXUS_NSK2AVK_EsaSubSelectCode_eA3                                                  = 2,
167    NEXUS_NSK2AVK_EsaSubSelectCode_eAESECBClearTail             = 3,
168    NEXUS_NSK2AVK_EsaSubSelectCode_eAESCBCCIPlus                = 4,
169    NEXUS_NSK2AVK_EsaSubSelectCode_eReserved5                                   = 5,
170    NEXUS_NSK2AVK_EsaSubSelectCode_eOther                                                       = 6,
171    NEXUS_NSK2AVK_EsaSubSelectCode_eAny                                                         = 7
172} NEXUS_NSK2AVK_EsaSubSelectCode;
173
174typedef enum NEXUS_NSK2AVK_InlineCode_e
175{
176    NEXUS_NSK2AVK_InlineCode_eLSACBCMDI_MSC4            = 0,
177    NEXUS_NSK2AVK_InlineCode_eLSACBCMDI_MSC18           = 1,
178    NEXUS_NSK2AVK_InlineCode_eLSACBCMDD_MSC4            = 2,
179    NEXUS_NSK2AVK_InlineCode_eLSACBCMDD_MSC18           = 3,
180    NEXUS_NSK2AVK_InlineCode_eLSARCBCMDI                                = 4,
181    NEXUS_NSK2AVK_InlineCode_eLSARCBCMDD                                = 6,
182    NEXUS_NSK2AVK_InlineCode_eAESECB_MSC12_18           = 8,
183    NEXUS_NSK2AVK_InlineCode_eAESECB_MSC28_2            = 9,
184    NEXUS_NSK2AVK_InlineCode_eAESECBClearTail           = 0xC
185
186} NEXUS_NSK2AVK_InlineCode;
187
188typedef enum NEXUS_NSK2AVK_CMCHANNEL_PARITY
189{
190        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eCLEAR            = 0x01U,                       /*!< @brief the key can be set for the clear parity */                   
191        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eEVEN             = 0x02U,                       /*!< @brief the key can be set for the even parity */                     
192        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eEVEN_CLEAR       = 0x04U,                       /*!< @brief the same key can be set for the clear  and even parity */     
193        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eODD              = 0x08U,                       /*!< @brief the key can be set for the odd parity */                     
194        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eODD_CLEAR        = 0x10U,                       /*!< @brief the same key can be set for the clear and odd parity */       
195        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eODD_EVEN         = 0x20U,                       /*!< @brief the same key can be set for the odd and even parity */       
196        NEXUS_NSK2AVK_CMCHANNEL_PARITY_eODD_EVEN_CLEAR   = 0x40U                        /*!< @brief the same key can be set for the clear, odd and even  parity */
197} NEXUS_NSK2AVK_CMCHANNEL_PARITY;
198
199
200typedef enum NEXUS_NSK2AVK_SC_VALUE
201{
202        NEXUS_NSK2AVK_SC_VALUE_eCLEAR           = 0x00,
203        NEXUS_NSK2AVK_SC_VALUE_eEVEN            = 0x02,
204        NEXUS_NSK2AVK_SC_VALUE_eODD             = 0x03
205} NEXUS_NSK2AVK_SC_VALUE;
206
207typedef enum NEXUS_NSK2AVK_CmChannel_Destination
208{
209    NEXUS_NSK2AVK_CmChannel_Destination_eCPD  = 0,
210                NEXUS_NSK2AVK_CmChannel_Destination_eCA,                       
211    NEXUS_NSK2AVK_CmChannel_Destination_eCPS,               
212    NEXUS_NSK2AVK_CmChannel_Destination_eMax
213} NEXUS_NSK2AVK_CmChannel_Destination;
214
215/**
216Summary:
217This enum defines the sub commands for AVCMD
218**/
219typedef enum NEXUS_AvKeyLadderSubCmdType
220{
221        NEXUS_AvKeyLadderSubCmdType_eNoOp       = 0,
222  NEXUS_AvKeyLadderSubCmdType_eDecryptEFK = 1,
223        NEXUS_AvKeyLadderSubCmdType_eDecryptEPK = 2,
224        NEXUS_AvKeyLadderSubCmdType_eDecryptECW = 3,
225        NEXUS_AvKeyLadderSubCmdType_eDecryptCID = 4,
226        NEXUS_AvKeyLadderSubCmdType_eReadSCN    = 5,
227        NEXUS_AvKeyLadderSubCmdType_eLoadCW     = 6,
228
229  NEXUS_AvKeyLadderSubCmdType_eMax
230
231}       NEXUS_AvKeyLadderSubCmdType;
232
233/**
234Summary:
235This structure provides the parameters for an AV Reset command
236
237Description:
238See Also:
239NEXUS_AvKeyLadder_AvResetCmd
240
241**/
242typedef struct NEXUS_AvKeyLadderAvResetCmdParm
243{
244    NEXUS_SecurityOtpId          otpIdSelect;
245    uint32_t                     caVendorId;
246    NEXUS_SecurityKey2Select     key2Select;
247    NEXUS_SecurityRootKeySrc     rootKeySrc;
248    bool                         bASKMMode;
249
250} NEXUS_AvKeyLadderAvResetCmdParm;
251
252
253
254/**
255Summary:
256This function initializes the AV states and logics.
257
258Description:
259This function is normally called once after bootup to reset the AV states and logics.
260The chip will not function if this function is called too frequently.
261
262**/
263
264NEXUS_Error NEXUS_AvKeyLadder_AvResetCmd(
265    const NEXUS_AvKeyLadderAvResetCmdParm        *pResetCmdParm                 
266    );
267
268/**
269Summary:
270This structure provides the parameters for an AV regular command
271
272Description:
273See Also:
274NEXUS_AvKeyLadder_AvCmd
275
276**/
277typedef struct NEXUS_AvKeyLadderAvCmdParm
278{
279        NEXUS_AvKeyLadderSubCmdType                     avSubCmd;
280        NEXUS_SecurityEngine            cryptoEngine;
281        NEXUS_SecurityKeyType           cryptoKeyType;
282        NEXUS_SecurityKeyIVType         destIV;
283
284        NEXUS_SecuritySwizzleType       swizzleType;
285        unsigned char                   swizzle1Index;
286        NEXUS_SecurityKeyMode           keyMode;
287
288        /* AES key ladder - 128-bit CW key is used */
289        /* DES-ECB CA - 64-bit key is used bit[64-127] */
290        unsigned char                   encryptedKeyData[NEXUS_AVKEYLADDER_KEY_DATA_LEN];
291        unsigned int                    keyDataLen;
292}       NEXUS_AvKeyLadderAvCmdParm;
293
294
295/**
296Summary:
297This structure defines the output for the AV subcommand NEXUS_AvKeyLadderSubCmdType_eReadSCN
298
299Description:
300See Also:
301NEXUS_AvKeyLadder_AvCmd
302
303**/
304
305typedef struct NEXUS_AvKeyLadderAvCmdOutput
306{
307        unsigned char                   scnData[NEXUS_AVKEYLADDER_SCD_DATA_LEN];
308        unsigned int                    scnDataLen;
309}       NEXUS_AvKeyLadderAvCmdOutput;
310
311
312
313/**
314Summary:
315This function is used to communicate with the BSP AV module, as defined by DirecTV.
316
317Description:
318This function is used to generate a key based on the DIRECTV AV module.  The keys
319generated by the AV module are used by both CA and M2M descramblers. 
320  -   CA commands :  NEXUS_AvKeyLadderSubCmdType_eDecryptEPK.
321                             NEXUS_AvKeyLadderSubCmdType_eDecryptECW. 
322  - M2M commands : NEXUS_AvKeyLadderSubCmdType_eDecryptEFK.
323                             NEXUS_AvKeyLadderSubCmdType_eDecryptCID.
324The following command sequences should be used:
325*** Generating CPCW (M2M) ***
326NEXUS_AvKeyLadderSubCmdType_eReadSCN,
327NEXUS_AvKeyLadderSubCmdType_eDecryptEFK,
328NEXUS_AvKeyLadderSubCmdType_eDecryptCID.
329
330*** Generating CW (CA) ***
331NEXUS_AvKeyLadderSubCmdType_eReadSCN,
332NEXUS_AvKeyLadderSubCmdType_eDecryptEPK,
333NEXUS_AvKeyLadderSubCmdType_eDecryptECW.
334
335*** Loading Clear Key ***
336NEXUS_AvKeyLadderSubCmdType_eReadSCN,
337NEXUS_AvKeyLadderSubCmdType_eLoadCW.
338
339
340The following parameter settings are currently supported:
341
342NEXUS_SecurityEngine            cryptoEngine
343    NEXUS_SecurityEngine_eCA or
344    NEXUS_SecurityEngine_eM2m
345
346NEXUS_SecurityKeyType           cryptoKeyType
347    NEXUS_SecurityKeyType_eEven or
348    NEXUS_SecurityKeyType_eOdd or
349    NEXUS_SecurityKeyType_eClear
350
351NEXUS_SecuritySwizzleType       swizzleType
352    NEXUS_SecuritySwizzleType_eNone
353
354unsigned char                          swizzle1Index
355    Not used
356
357NEXUS_SecurityKeySlotType       caKeySlotType
358    Any type except NEXUS_SecurityKeySlotType_eType6
359
360NEXUS_SecurityKeyMode           keyMode
361    NEXUS_SecurityKeyMode_eRegular or
362    NEXUS_SecurityKeyMode_eDes56  or
363    NEXUS_SecurityKeyMode_eDvbConformance
364
365SCN Identifier (OTP A ID) is returned only for AVCMD subcommand
366NEXUS_AvKeyLadderSubCmdType_eReadSCN
367as pAvCmdDataOutput->scnData[].
368
369**/
370NEXUS_Error NEXUS_AvKeyLadder_AvCmd(
371        NEXUS_KeySlotHandle                                                                     keyHandle,
372    const NEXUS_AvKeyLadderAvCmdParm    *pAvCmd,
373    NEXUS_AvKeyLadderAvCmdOutput                        *pAvCmdDataOutput   /* [out] */
374    );
375
376
377typedef struct NEXUS_AvKeyLadderAvCmdChain
378{
379    int                             cmdCount;
380    NEXUS_KeySlotHandle             keyHandle[NEXUS_AVKEYLADDER_CMD_CHAIN_LEN];
381    NEXUS_AvKeyLadderAvCmdParm      avCmdParm[NEXUS_AVKEYLADDER_CMD_CHAIN_LEN];
382
383}       NEXUS_AvKeyLadderAvCmdChain;
384
385
386typedef struct NEXUS_AvKeyLadderAvCmdChainOutput
387{
388    int                                 respCount;
389    NEXUS_AvKeyLadderAvCmdOutput        avCmdOutput[NEXUS_AVKEYLADDER_CMD_CHAIN_LEN];
390
391}       NEXUS_AvKeyLadderAvCmdChainOutput;
392
393
394
395NEXUS_Error NEXUS_AvKeyLadder_AvCmdChain(
396    const NEXUS_AvKeyLadderAvCmdChain       *pAvCmdChain,
397    NEXUS_AvKeyLadderAvCmdChainOutput       *pAvCmdChainOutput   /* [out] */
398    );
399
400#ifdef __cplusplus
401}
402#endif
403
404#endif
Note: See TracBrowser for help on using the repository browser.