source: svn/newcon3bcm2_21bu/nexus/extensions/security/keyladder/7552/include/nexus_keyladder.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: 16.1 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_keyladder.h $
39 * $brcm_Revision: 4 $
40 * $brcm_Date: 10/13/11 9:14a $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/extensions/security/keyladder/7422/include/nexus_keyladder.h $
47 *
48 * 4   10/13/11 9:14a atruong
49 * SWSECURITY-69: BSP Zeus 2.0 FW Support
50 *
51 * 2   5/25/11 11:24a atruong
52 * SW7346-168: Adding IV setting for key ladder setup
53 *
54 * 1   1/28/11 7:07p atruong
55 * SW7422-235: Enable Nexus Security extension modules for 97422
56 *
57 ******************************************************************************/
58#ifndef NEXUS_KEYLADDER_H__
59#define NEXUS_KEYLADDER_H__
60
61#include "nexus_security_datatypes.h"
62#include "nexus_security.h"
63
64/*=**************************
65The KeyLadder is an alternate method of deriving cryptographic and conditional access keys.
66This extension provides support for the mechanism.
67****************************/
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
73#define NEXUS_SECURITY_KEYLADDER_KEY_SIZE 32
74#define NEXUS_SECURITY_KL_ACTCODE_SIZE    16
75
76/**
77Summary:
78This enum defines the supported root key sources.
79**/
80typedef enum NEXUS_SecurityRootKeySrc
81{
82    NEXUS_SecurityRootKeySrc_eCuskey,
83    NEXUS_SecurityRootKeySrc_eOtpKeyA,
84    NEXUS_SecurityRootKeySrc_eOtpKeyB,
85    NEXUS_SecurityRootKeySrc_eOtpKeyC,
86        NEXUS_SecurityRootKeySrc_eOtpKeyD,
87        NEXUS_SecurityRootKeySrc_eOtpKeyE,
88        NEXUS_SecurityRootKeySrc_eOtpKeyF,
89    NEXUS_SecurityRootKeySrc_eReserved0,
90    NEXUS_SecurityRootKeySrc_eReserved1,
91    NEXUS_SecurityRootKeySrc_eReserved2,
92
93    /* Add new key entry type definition before this line */
94    NEXUS_SecurityRootKeySrc_eMax
95}   NEXUS_SecurityRootKeySrc;
96
97/**
98Summary:
99This enum defines the supported key generation subcommands.
100**/
101typedef enum NEXUS_SecurityKeyGenCmdID
102{
103    NEXUS_SecurityKeyGenCmdID_eKeyGen,
104    NEXUS_SecurityKeyGenCmdID_eVKLAssocQuery,
105
106    /* Add new key entry type definition before this line */
107    NEXUS_SecurityKeyGenCmdID_eMax
108}   NEXUS_SecurityKeyGenCmdID;
109
110
111/**
112Summary:
113This enum defines the supported KeyGen Key3 operations.
114**/
115typedef enum NEXUS_SecuritySessionKeyOp
116{
117    NEXUS_SecuritySessionKeyOp_eNoProcess,
118    NEXUS_SecuritySessionKeyOp_eExport,
119
120    /* Add new key entry type definition before this line */
121    NEXUS_SecuritySessionKeyOp_eMax
122}   NEXUS_SecuritySessionKeyOp;
123
124
125
126/**
127Summary:
128This enum defines the supported keyladder types.
129**/
130typedef enum NEXUS_SecurityKeyladderType
131{
132    NEXUS_SecurityKeyladderType_e1Des,
133    NEXUS_SecurityKeyladderType_e3Des,
134    NEXUS_SecurityKeyladderType_eAes128,
135        NEXUS_SecurityKeyladderType_ePKSM,       /* HD DTA */
136
137    /* Add new key entry type definition before this line */
138    NEXUS_SecurityKeyladderType_eMax
139}   NEXUS_SecurityKeyladderType;
140
141/**
142Summary:
143This enum defines the supported Key Ladder selection.
144**/
145typedef enum NEXUS_SecurityKeyLadderSelect
146{
147    NEXUS_SecurityKeyLadderSelect_eFWKL,
148        NEXUS_SecurityKeyLadderSelect_eHWKL,
149        NEXUS_SecurityKeyLadderSelect_ePKL,
150
151    /* Add new swizzle type definition before this line */
152    NEXUS_SecurityKeyLadderSelect_eMax
153}   NEXUS_SecurityKeyLadderSelect;
154
155
156/**
157Summary:
158This enum defines the supported keyladder IDs.
159**/
160typedef enum NEXUS_SecurityKeyladderID
161{
162    NEXUS_SecurityKeyladderID_eA,
163    NEXUS_SecurityKeyladderID_eB,
164    NEXUS_SecurityKeyladderID_eC,
165
166    /* Add new key entry type definition before this line */
167    NEXUS_SecurityKeyladderID_eMax
168}   NEXUS_SecurityKeyladderID;
169
170
171/**
172Summary:
173This enum defines the supported Customer SubMode.
174**/
175typedef enum NEXUS_SecurityCustomerSubMode
176{
177    NEXUS_SecurityCustomerSubMode_eGeneric_CA_64_4  = 0x0,  /* Key Ladder for Generic CA with 64 bit keys using Key4 */
178    NEXUS_SecurityCustomerSubMode_eGeneric_CP_64_4  = 0x1,  /* Key Ladder for Generic CP with 64 bit keys using Key4 */
179    NEXUS_SecurityCustomerSubMode_eGeneric_CA_64_5  = 0x2,  /* Key Ladder for Generic CA with 64 bit keys using Key5 */
180    NEXUS_SecurityCustomerSubMode_eGeneric_CP_64_5  = 0x3,  /* Key Ladder for Generic CP with 64 bit keys using Key5 */
181    NEXUS_SecurityCustomerSubMode_eGeneric_CA_128_4 = 0x4,  /* Key Ladder for Generic CA with 128 bit keys using Key4 */
182    NEXUS_SecurityCustomerSubMode_eGeneric_CP_128_4 = 0x5,  /* Key Ladder for Generic CP with 128 bit keys using Key4 */
183    NEXUS_SecurityCustomerSubMode_eGeneric_CA_128_5 = 0x6,  /* Key Ladder for Generic CA with 128 bit keys using Key5 */
184    NEXUS_SecurityCustomerSubMode_eGeneric_CP_128_5 = 0x7,  /* Key Ladder for Generic CP with 128 bit keys using Key5 */
185    NEXUS_SecurityCustomerSubMode_eReserved8        = 0x8,
186    NEXUS_SecurityCustomerSubMode_eReserved9        = 0x9,
187    NEXUS_SecurityCustomerSubMode_eReserved10       = 0xA,
188    NEXUS_SecurityCustomerSubMode_eReserved11       = 0xB,
189    NEXUS_SecurityCustomerSubMode_eReserved12       = 0xC,
190    NEXUS_SecurityCustomerSubMode_eReserved13       = 0xD,
191    NEXUS_SecurityCustomerSubMode_eGeneralPurpose1  = 0xE,  /* Key Ladder for HDMI, IV and Signed Commands */
192    NEXUS_SecurityCustomerSubMode_eGeneralPurpose2  = 0xF,  /* Key Ladder for User Hmac */
193    NEXUS_SecurityCustomerSubMode_eReserved16       = 0x10,
194    NEXUS_SecurityCustomerSubMode_eReserved17       = 0x11,
195    NEXUS_SecurityCustomerSubMode_eGeneric_CA_64_45 = 0x12, /* Key Ladder for Generic CA with 64 bit keys using Key4 and Key5 */
196    NEXUS_SecurityCustomerSubMode_eGeneric_CP_64_45 = 0x13, /* Key Ladder for Generic CP with 64 bit keys using Key4 and Key5 */
197        NEXUS_SecurityCustomerSubMode_eReserved20               = 0x14,
198        NEXUS_SecurityCustomerSubMode_eReserved21               = 0x15,
199        NEXUS_SecurityCustomerSubMode_eSecureRSA2       = 0x16,
200        NEXUS_SecurityCustomerSubMode_eETSI_5           = 0x17,
201        NEXUS_SecurityCustomerSubMode_eDTA_M_CA         = 0x18,
202        NEXUS_SecurityCustomerSubMode_eDTA_M_CP         = 0x19,
203        NEXUS_SecurityCustomerSubMode_eDTA_C_CA         = 0x1A,
204        NEXUS_SecurityCustomerSubMode_eDTA_C_CP         = 0x1B,
205
206
207    /* Add new Customer SubMode definition before this line */
208    NEXUS_SecurityCustomerSubMode_eMax
209}   NEXUS_SecurityCustomerSubMode;
210
211
212
213/**
214Summary:
215This enum defines the supported swizzle types.
216**/
217typedef enum NEXUS_SecuritySwizzleType
218{
219    NEXUS_SecuritySwizzleType_eNone,
220    NEXUS_SecuritySwizzleType_eSwizzle1,
221    NEXUS_SecuritySwizzleType_eSwizzle0,
222
223    /* Add new swizzle type definition before this line */
224    NEXUS_SecuritySwizzleType_eMax
225}   NEXUS_SecuritySwizzleType;
226
227/**
228Summary:
229This enum defines the supported key modes.
230**/
231typedef enum NEXUS_SecurityKeyMode
232{
233    NEXUS_SecurityKeyMode_eRegular,
234    NEXUS_SecurityKeyMode_eDes56,
235    NEXUS_SecurityKeyMode_eReserved2,
236    NEXUS_SecurityKeyMode_eReserved3,
237    NEXUS_SecurityKeyMode_eDvbConformance,
238
239    /* Add new swizzle type definition before this line */
240    NEXUS_SecurityKeyMode_eMax
241}   NEXUS_SecurityKeyMode;
242
243
244/**
245Summary:
246This enum defines the supported key modes.
247**/
248typedef enum NEXUS_SecurityHWKLLenSelect
249{
250        NEXUS_SecurityHWKLLenSelect_eLen0,
251        NEXUS_SecurityHWKLLenSelect_eLen1,
252        NEXUS_SecurityHWKLLenSelect_eLen2,
253        NEXUS_SecurityHWKLLenSelect_eLen3,
254
255    /* Add new swizzle type definition before this line */
256    NEXUS_SecurityHWKLLenSelect_eMax
257}   NEXUS_SecurityHWKLLenSelect;
258
259
260
261/**
262Summary:
263This struct defines the encrypted session structure.
264
265Description:
266This structure contains the information necessary to generate the
267Session Key which is Key3 in BRCM terminology.
268**/
269typedef struct NEXUS_SecurityEncryptedKey3
270{
271    NEXUS_SecurityKeyladderID           keyladderID;    /* not used for 40-nm;  for compatibility */
272        NEXUS_SecurityKeyGenCmdID           keyGenCmdID;    /* Key Generation or VKL Association query */
273    NEXUS_SecurityKeyladderType         keyladderType;
274        NEXUS_SecurityKeyLadderSelect           keyLadderSelect; /*FW key ladder | HW key ladder | Poway key ladder */
275        bool                                                            rootKeySwap;
276    NEXUS_SecurityRootKeySrc            rootKeySrc;       
277    NEXUS_SecuritySwizzleType           swizzleType;
278    NEXUS_SecurityKeyType               keyEntryType;
279    NEXUS_SecurityKeyIVType             keyDestIVType;
280    NEXUS_SecurityAlgorithmConfigDestination dest;/* This member is required only for CACP keyslot configuration */
281    NEXUS_SecurityOperation             operation;      /* key ladder operation, encrypt or decrypt */
282    NEXUS_SecurityOperation             operationKey2;  /* cusKeyL and cusKeyH encrypt or decrypt */
283    bool                                bASKMMode;
284        bool                                                            bkeyGenBlocked; /* set to true to instruct FW not to generate key */
285    NEXUS_SecurityCustomerSubMode       custSubMode;
286    NEXUS_SecurityVirtualKeyladderID    virtualKeyLadderID;
287    NEXUS_SecurityKeyMode               keyMode;
288    NEXUS_SecuritySessionKeyOp          sessionKeyOp;
289    unsigned char                       cusKeyL;        /* also used as SwizzleIndex for Swizzle1 */                                     
290    unsigned char                       cusKeyH;                                     
291    unsigned char                       cusKeyVarL;                                   
292    unsigned char                       cusKeyVarH;                                   
293    unsigned char                       keyData[NEXUS_SECURITY_KEYLADDER_KEY_SIZE]; 
294    bool                                bSwapAESKey; 
295    bool                                bRouteKey;
296        NEXUS_SecurityHWKLLenSelect                     hwklLen;
297        NEXUS_SecurityAlgorithm                         hwklDestAlg;
298    unsigned char                       actCode[NEXUS_SECURITY_KL_ACTCODE_SIZE]; 
299} NEXUS_SecurityEncryptedSessionKey;
300
301/**
302Summary:
303This struct defines the encrypted control word (CW) structure.
304
305Description:
306This structure contains the information necessary to generate the
307control word which is Key4 in BRCM terminology.
308**/
309typedef struct NEXUS_SecurityEncryptedKey4
310{
311    NEXUS_SecurityKeyladderID           keyladderID;    /* not used for 40-nm;  for compatibility */
312        NEXUS_SecurityKeyGenCmdID           keyGenCmdID;    /* Key Generation or VKL Association query */
313    NEXUS_SecurityKeyladderType         keyladderType;
314        NEXUS_SecurityKeyLadderSelect           keyLadderSelect; /*FW key ladder | HW key ladder | Poway key ladder */
315        bool                                                            rootKeySwap;
316    NEXUS_SecurityRootKeySrc            rootKeySrc;
317    NEXUS_SecurityKeyType               keyEntryType;
318    NEXUS_SecurityKeyIVType             keyDestIVType;
319    NEXUS_SecurityAlgorithmConfigDestination dest;/* This member is required only for CACP keyslot configuration */
320    NEXUS_SecuritySwizzleType           swizzleType;
321    bool                                bASKMMode;
322        bool                                                            bkeyGenBlocked; /* set to true to instruct FW not to generate key */
323    NEXUS_SecurityCustomerSubMode       custSubMode;
324    NEXUS_SecurityVirtualKeyladderID    virtualKeyLadderID;
325    NEXUS_SecurityKeyMode               keyMode;
326    NEXUS_SecurityAlgorithmScPolarity   sc01Polarity[NEXUS_SecurityPacketType_eMax]; /* Packets with SC bits 0x01 will be treated as this polarity */
327    unsigned int                        keySize;
328    unsigned char                       keyData[NEXUS_SECURITY_KEYLADDER_KEY_SIZE]; 
329    NEXUS_SecurityOperation             operation;          /* operation mode. This member is NOT required for CA */
330    bool                                bSwapAESKey; 
331    bool                                bRouteKey;
332        NEXUS_SecurityHWKLLenSelect                     hwklLen;
333        NEXUS_SecurityAlgorithm                         hwklDestAlg;
334    unsigned char                       actCode[NEXUS_SECURITY_KL_ACTCODE_SIZE]; 
335} NEXUS_SecurityEncryptedControlWord;
336
337/**
338Summary:
339This function retrieves default settings for encrypted session key generation.
340
341Description:
342This function shall retrieve default settings for encrypted session key generation.
343
344See Also:
345NEXUS_Security_GenerateSessionKey
346
347**/
348void NEXUS_Security_GetDefaultSessionKeySettings(
349    NEXUS_SecurityEncryptedSessionKey  *pSettings    /* [out] */
350    );
351
352
353/**
354Summary:
355This function generates session key for a keyslot.
356
357Description:
358This function shall generate session key for a keyslot.  This function
359must be called BEFORE the NEXUS_Security_GenerateControlWord
360function can be called.
361
362Performance and Timing:
363This is a synchronous function that will return when it is done.
364
365See Also:
366NEXUS_Security_GenerateControlWord
367**/
368NEXUS_Error NEXUS_Security_GenerateSessionKey(
369    NEXUS_KeySlotHandle               keyHandle,
370    const NEXUS_SecurityEncryptedSessionKey *pSessionKey
371    );
372
373
374/**
375Summary:
376This function retrieves default settings for control word generation.
377
378Description:
379This function shall retrieve default settings for control word generation.
380
381See Also:
382NEXUS_Security_GenerateControlWord
383
384
385**/
386void NEXUS_Security_GetDefaultControlWordSettings(
387    NEXUS_SecurityEncryptedControlWord  *pSettings    /* [out] */
388    );
389
390
391/**
392Summary:
393This function generates the CW for a keyslot.
394
395Description:
396This function shall generate the CW for a keyslot.  This function
397must be called after the NEXUS_Security_GenerateSessionKey has been
398called to generate the session key.
399
400Performance and Timing:
401This is a synchronous function that will return when it is done.
402
403See Also:
404NEXUS_Security_GenerateSessionKey
405**/
406NEXUS_Error NEXUS_Security_GenerateControlWord(
407    NEXUS_KeySlotHandle                      keyHandle,
408    const NEXUS_SecurityEncryptedControlWord *pCW
409    );
410
411
412/**
413Summary:
414This function generates the key5 for a keyslot.
415
416Description:
417This function shall generate the key5 for a keyslot.  This function
418must be called after the NEXUS_Security_GenerateSessionKey and
419NEXUS_Security_GenerateControlWord have been called.
420
421Note that this function takes the same structure as
422NEXUS_Security_GenerateControlWord.
423
424Performance and Timing:
425This is a synchronous function that will return when it is done.
426
427See Also:
428NEXUS_Security_GenerateSessionKey, NEXUS_Security_GenerateControlWord
429**/
430NEXUS_Error NEXUS_Security_GenerateKey5(
431    NEXUS_KeySlotHandle                      keyHandle,
432    const NEXUS_SecurityEncryptedControlWord *pCW
433    );
434
435
436#ifdef __cplusplus
437}
438#endif
439
440#endif
Note: See TracBrowser for help on using the repository browser.