source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/hdcplib/7552/bhdcplib_keyloader_stub.c

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 6.0 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2002-2011, 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: bhdcplib_keyloader_stub.c $
11 * $brcm_Revision: Hydra_Software_Devel/8 $
12 * $brcm_Date: 12/12/11 2:30p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/syslib/hdcplib/7401/bhdcplib_keyloader_stub.c $
19 *
20 * Hydra_Software_Devel/8   12/12/11 2:30p rgreen
21 * SW7552-157: Remove  unused BHDM_CONFIG_40NM_REV2_SUPPORT macro
22 *
23 * Hydra_Software_Devel/7   10/11/11 5:21p vle
24 * SW7429-5: Add support for 7429
25 *
26 * Hydra_Software_Devel/6   1/27/11 6:35p vle
27 * SW7422-129: Fix build error when HDCP is not enabled.
28 *
29 * Hydra_Software_Devel/5   6/15/10 1:36p vle
30 * SW7550-458: Fix build warning
31 *
32 * Hydra_Software_Devel/4   3/15/10 5:30p vle
33 * SW7408-28: Fix build error for non-HDCP build.
34 *
35 * Hydra_Software_Devel/3   12/29/09 3:53p qcheng
36 * SW7550-102 : Add Security support for 7550
37 *
38 * Hydra_Software_Devel/2   3/18/08 7:18p vle
39 * PR 39991: Rename HDMIlib to HDCPlib. Remove unused implementation.
40 *
41 * Hydra_Software_Devel/1   2/26/08 5:43p jgarrett
42 * PR 39991: Renaming new HDMlib to HDCPlib
43 *
44 * Hydra_Software_Devel/2   8/7/06 6:04p rgreen
45 * PR22187: Fix stub to use standalone HSM PI
46 *
47 * Hydra_Software_Devel/1   6/15/06 1:24p rgreen
48 * PR17748: Create separate keyloader source for 740x vs 7038
49 *
50 * Hydra_Software_Devel/8   5/2/06 4:23p rgreen
51 * PR 20436: Sync up with Aegis 7_0 release
52 *
53 * Hydra_Software_Devel/7   3/10/06 1:13p rgreen
54 * PR19265: Add BCM97400 HDMI Support; No HDCP yet
55 *
56 * Hydra_Software_Devel/6   1/23/06 8:08p rgreen
57 * PR17748: Modify HDMI HDCP to use HSM for chips that support AEGIS
58 *
59 * Hydra_Software_Devel/5   10/20/05 5:31p erickson
60 * PR17108: added temp 7401 hacks
61 *
62 * Hydra_Software_Devel/4   8/31/05 6:54p rgreen
63 * PR9474: Fix big endian support bug
64 *
65 * Hydra_Software_Devel/3   4/26/05 8:55a rgreen
66 * PR12116: Fix bug in HDCP stub key loader to used passed argument vs
67 * global
68 *
69 * Hydra_Software_Devel/2   8/19/04 12:07p rgreen
70 * PR12116: Add HDCP Key Loader Support
71 * Fix Metrowerks compilation error
72 *
73 * Hydra_Software_Devel/1   8/18/04 4:34p rgreen
74 * PR 12116: Add HDCP Key Loading Support
75 *
76 ***************************************************************************/
77
78#include "bstd.h"
79
80#include "bhsm.h"
81#include "bhsm_keyladder.h"
82#include "bhdcplib_keyloader.h"
83#include "breg_endian.h"
84
85BDBG_MODULE(BHDCPLIB_KEYLOADER) ;
86
87
88BERR_Code BHDCPlib_FastLoadEncryptedHdcpKeys(
89        BHDCPlib_Handle hHDCPlib)
90{
91#if (BCHP_CHIP ==7550) || (BCHP_CHIP == 7408) || BHDM_CONFIG_40NM_SUPPORT
92       
93        BDBG_WRN(("*********************************************************")) ;
94        BDBG_WRN(("HDCP feature is disabled. HDCP authentication will")) ;
95        BDBG_WRN(("not succeed. Please rebuild the application with ")) ; 
96        BDBG_WRN(("NEXUS_HDCP_SUPPORT=y to enable HDCP")) ;
97        BDBG_WRN(("*********************************************************")) ;
98
99        BSTD_UNUSED(hHDCPlib);
100        return BERR_NOT_SUPPORTED;
101#else
102
103        uint8_t  i ;
104        uint32_t HdcpKey[4] ;
105               
106        BERR_Code rc = BERR_SUCCESS ;
107        BERR_Code errCode = BERR_SUCCESS;
108        BHSM_LoadRouteUserKeyIO_t loadRouteUserKeyIO;   
109        BHDCPlib_EncryptedHdcpKeyStruct * EncryptedHdcpKeys;
110       
111        BDBG_ASSERT(hHDCPlib) ;
112
113
114        /* Get HDCP Encrypted Keys */
115        EncryptedHdcpKeys = (BHDCPlib_EncryptedHdcpKeyStruct *) &hHDCPlib->stHdcpConfiguration.TxKeySet.TxKeyStructure;
116
117        BDBG_WRN(("*********************************************************")) ;
118        BDBG_WRN(("Loading HDCP Spec 1.1 A1 Transmitter Test Keys...")) ;
119        BDBG_WRN(("HDCP Test and Production Keys are not compatible")) ; 
120        BDBG_WRN(("Test Keys WILL NOT AUTHENTICATE with production TVs, RXs")) ;
121        BDBG_WRN(("Separate Agreement needed for use of Encrypted Key Loader")) ;
122        BDBG_WRN(("*********************************************************")) ;
123
124       
125        HdcpKey[1] = 0;
126        HdcpKey[0] = 0;
127       
128        BDBG_MSG(("Start HDCP Key Loading")) ;
129        for(i= 0; i < BHDM_HDCP_NUM_KEYS ; i++)
130        {
131                HdcpKey[3] = EncryptedHdcpKeys[i].HdcpKeyLo ;
132                HdcpKey[2] = EncryptedHdcpKeys[i].HdcpKeyHi ;
133               
134                BREG_LE32(HdcpKey[3]) ;
135                BREG_LE32(HdcpKey[2]) ;
136               
137#if 0
138                BDBG_MSG(("%08x%08x %08X %08X %08X %08X %d",
139                        EncryptedHdcpKeys[i].HdcpKeyHi, EncryptedHdcpKeys[i].HdcpKeyLo,
140                        HdcpKey[3], HdcpKey[2], HdcpKey[1], HdcpKey[0], i)) ;
141#endif                 
142
143                loadRouteUserKeyIO.keySource =  BCMD_KeyRamBuf_eSecondRam;      /* BCMD_KeyRamBuf_eFirstRam;*/
144                loadRouteUserKeyIO.keySize.eKeySize =  BCMD_KeySize_e64;
145                BKNI_Memset(loadRouteUserKeyIO.aucKeyData, 0, sizeof(loadRouteUserKeyIO.aucKeyData));
146
147                loadRouteUserKeyIO.aucKeyData[3] =      (HdcpKey[2] >> 24) & 0xff ;
148                loadRouteUserKeyIO.aucKeyData[2] =      (HdcpKey[2] >> 16) & 0xff ;
149                loadRouteUserKeyIO.aucKeyData[1] =      (HdcpKey[2] >>  8) & 0xff ;
150                loadRouteUserKeyIO.aucKeyData[0] =      (HdcpKey[2]) & 0xff ;
151               
152                loadRouteUserKeyIO.aucKeyData[7] =      (HdcpKey[3] >> 24) & 0xff ;
153                loadRouteUserKeyIO.aucKeyData[6] =      (HdcpKey[3] >> 16) & 0xff ;
154                loadRouteUserKeyIO.aucKeyData[5] =      (HdcpKey[3] >>  8) & 0xff ;
155                loadRouteUserKeyIO.aucKeyData[4] =      (HdcpKey[3]) & 0xff ;   
156
157               
158                loadRouteUserKeyIO.bIsRouteKeyRequired = true ;
159                loadRouteUserKeyIO.keyDestBlckType       =      BCMD_KeyDestBlockType_eHdmi ;
160                loadRouteUserKeyIO.keyDestEntryType = BCMD_KeyDestEntryType_eOddKey; /* Aegis does not care */ 
161                loadRouteUserKeyIO.caKeySlotType          = BCMD_XptSecKeySlot_eType0;     /* Aegis does not care */ 
162                loadRouteUserKeyIO.unKeySlotNum = i ;                                   
163
164                errCode= BHSM_LoadRouteUserKey (hHDCPlib->stDependencies.hHsm, &loadRouteUserKeyIO); 
165                if (errCode != 0) 
166                {
167                        BDBG_MSG(("loadRouteUserKeyIO unStatus = 0x%08X", loadRouteUserKeyIO.unStatus)) ;
168                        BDBG_ERR(("BHSM_LoadRouteUserKey errCode: %x", errCode )) ; 
169                        return errCode;
170                }       
171        }
172
173        BDBG_MSG(("END HDCP Key Loading")) ;
174
175        return rc ;
176#endif
177}
178
179
Note: See TracBrowser for help on using the repository browser.