source: svn/newcon3bcm2_21bu/nexus/lib/dtcp_ip/include/b_ecc_wrapper.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: 7.1 KB
Line 
1/******************************************************************************
2 *    (c)2009-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: b_ecc_wrapper.h $
39 * $brcm_Revision: 4 $
40 * $brcm_Date: 11/30/11 6:09p $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/lib/dtcp_ip/include/b_ecc_wrapper.h $
47 *
48 * 4   11/30/11 6:09p leisun
49 * SWSECURITY-89: CKC fix from panasonic
50 *
51 * 3   7/31/09 3:38p leisun
52 * PR 55693: removed bcrypt dependency
53 *
54 * 2   7/13/09 11:23a leisun
55 * PR 55693: Re-design interfaces, and other cleanups
56 *
57 * 1   6/5/09 4:06p leisun
58 * PR 55693: checking in DTCP-IP lib
59 *
60 *****************************************************************************/
61#ifndef B_ECC_WRAPPER_H
62#define B_ECC_WRAPPER_H   
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68extern unsigned char gBn160[SHA1_DIGEST_SIZE];
69
70/*! \brief initialize ECC parameters and key parameters, convert from binary to string.
71 *  \param[in] ghBcrypt bcrypt handle
72 *  \param[in,out] pEccParams pointer to ECC parameters.
73 *  \retval BCRYPT_STATUS_eOk or other error code.
74 */
75BCRYPT_STATUS_eCode B_DTCP_InitEccParams(BCRYPT_Handle ghBcrypt, BCRYPT_ECCParam_t * pEccParams);
76
77/*! \clean up ecc parameters , free resources
78 */
79void B_DTCP_CleanupEccParams(BCRYPT_ECCParam_t * pEccParams);
80
81/*! \brief big number modulo addition, compute a+b mod m and place result in r.
82 */
83BCRYPT_STATUS_eCode B_ModAdd(unsigned char * r, unsigned char * a, unsigned char * b, unsigned char * m, 
84                int size_a, int size_b, int size_m);
85
86/*! \brief compute MAC value for RTT procedure.
87 *  \param[in] AuthKey authentication key.
88 *  \param[in] RttN Rtt trial counter.
89 *  \param[out] MacValue computed MAC value
90 *  \retval BCRYPT_STATUS_eOK or other error code.
91 */
92BCRYPT_STATUS_eCode B_DTCP_IP_ComputeRttMac(BCRYPT_Handle ghBcrypt, unsigned char * AuthKey, unsigned char * RttN, unsigned char * MacValue);
93
94BCRYPT_STATUS_eCode B_DTCP_IP_ComputeRttMac_2(BCRYPT_Handle ghBcrypt, unsigned char * AuthKey,
95                unsigned char * RttN,
96                int     RttN_sz,
97                unsigned char * MacValue);
98
99/*! \brief generate RNG of length len.
100 */
101BCRYPT_STATUS_eCode B_RNG(BCRYPT_Handle ghBcrypt, unsigned char * r, int len);
102
103/*! \brief generate RNG of length len, less then max (exclude max).
104 */
105BCRYPT_STATUS_eCode B_RNG_max(BCRYPT_Handle ghBcrypt, unsigned char * r, unsigned char *max, int len);
106
107/*! \brief get DTCP EC-DH first phase value.
108 *  \param[out] pXv EC-DH first phase value.
109 *  \param[out] pXk Secret information, random number.
110 *  \param[in] EccParams ECC parameters.
111 *  \retval BCRYPT_STATUS_eOK or other error code.
112 */
113BCRYPT_STATUS_eCode B_DTCP_GetFirstPhaseValue(BCRYPT_Handle ghBcrypt, unsigned char * pXv, unsigned char * pXk, BCRYPT_ECCParam_t * EccParams) ;
114
115/*! \brief Get EC-DSA shared secret (Xk*Yv), where Yv is other device's EC-DH first phase value.
116 *  \param[out] pKauth shared secret (Authentication key)
117 *  \param[in]  pXk secret information.
118 *  \param[in]  pYv other device's EC-DH first phase value.
119 *  \param[in]  EccParams Ecc parameters.
120 */
121BCRYPT_STATUS_eCode B_DTCP_GetSharedSecret(BCRYPT_Handle ghBcrypt, unsigned char * pKauth, unsigned char * pXk, 
122                unsigned char *pYv, BCRYPT_ECCParam_t * EccParams);
123
124/*! \brief sign data using EC-DSA algorithm.
125 *  \param[out] pSignature computed signature,
126 *  \param[in]  pBuffer input data to be signed.
127 *  \param[in]  len input data length.
128 *  \param[in]  pKey input private key.
129 *  \param[in]  EccParams input ECC parameters.
130 */
131BCRYPT_STATUS_eCode B_DTCP_SignData(BCRYPT_Handle ghBcrypt, unsigned char * pSignature, unsigned char * pBuffer, 
132                int len, char * pKey, BCRYPT_ECCParam_t * EccParams);
133
134/* \brief same as above but sign data using a binary key.
135 */
136BCRYPT_STATUS_eCode B_DTCP_SignData_BinKey(BCRYPT_Handle ghBcrypt, unsigned char * pSignature, unsigned char * pBuffer, 
137                int len, unsigned char * BinKey, BCRYPT_ECCParam_t * EccParams);
138
139/*! \brief Verify data using EC-DSA algorithm.
140 *  \param[out] valid 1 , signature is valid, 0 signature is invalid.
141 *  \param[in] pSignature, input signature,
142 *  \param[in] pBuffer input data to be verified.
143 *  \param[in] len input data length.
144 *  \param[in] PublicKeyX public key x component.
145 *  \param[in] PublicKeyY public key y component
146 *  \param[in] EccParams ECC parameters.
147 */
148BCRYPT_STATUS_eCode B_DTCP_VerifyData(BCRYPT_Handle ghBcrypt, int *valid, unsigned char * pSignature, unsigned char * pBuffer, 
149                int len, char * PublicKeyX, char * PublicKeyY, BCRYPT_ECCParam_t * EccParams);
150
151
152/* Verify data, same as above, but using a binary public key(combined x and y components) .
153 */
154BCRYPT_STATUS_eCode B_DTCP_VerifyData_BinKey(BCRYPT_Handle ghBcrypt, int *valid, unsigned char * pSignature, unsigned char * pBuffer, 
155                int len, unsigned char * BinKey, BCRYPT_ECCParam_t * EccParams);
156
157#ifdef __cplusplus
158}
159#endif
160
161#endif /* B_ECC_WRAPPER_H */
Note: See TracBrowser for help on using the repository browser.