| 1 | /******************************************************************************************** |
|---|
| 2 | * (c)2004-2009 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_constants.h $ |
|---|
| 40 | * $brcm_Revision: 3 $ |
|---|
| 41 | * $brcm_Date: 7/1/09 2:57p $ |
|---|
| 42 | * |
|---|
| 43 | * Module Description: |
|---|
| 44 | * |
|---|
| 45 | * Revision History: |
|---|
| 46 | * |
|---|
| 47 | * $brcm_Log: /nexus/lib/dtcp_ip/include/b_dtcp_constants.h $ |
|---|
| 48 | * |
|---|
| 49 | * 3 7/1/09 2:57p leisun |
|---|
| 50 | * PR 55693: change exchange key timer to 2 hours |
|---|
| 51 | * |
|---|
| 52 | * 2 6/30/09 10:37p leisun |
|---|
| 53 | * PR 55693: Added exchange key expiration timer |
|---|
| 54 | * |
|---|
| 55 | * 1 6/5/09 4:07p leisun |
|---|
| 56 | * PR 55693: checking in DTCP-IP lib |
|---|
| 57 | * |
|---|
| 58 | * $Source:$ |
|---|
| 59 | * $Revision:$ |
|---|
| 60 | * $Date:$ |
|---|
| 61 | * $Author:$ |
|---|
| 62 | * |
|---|
| 63 | * Description: |
|---|
| 64 | * Top-level DTCP constants |
|---|
| 65 | * |
|---|
| 66 | * Revision History: |
|---|
| 67 | * $Revision:$ $Date:$ $Author:$ Initial creation. |
|---|
| 68 | * |
|---|
| 69 | *********************************************************************************************/ |
|---|
| 70 | |
|---|
| 71 | #ifndef __DTCP_CONSTANTS_H__ |
|---|
| 72 | #define __DTCP_CONSTANTS_H__ |
|---|
| 73 | |
|---|
| 74 | /*! \file |
|---|
| 75 | * \brief Defines constant values used throughout the DTCP baseline functions. |
|---|
| 76 | */ |
|---|
| 77 | |
|---|
| 78 | #define DTCP_DEVICE_KEY_SIZE 8 /*!< Size of device key in bytes */ |
|---|
| 79 | #define DTCP_BASELINE_FULL_CERT_SIZE 88 /*!< Size of baseline full-auth device certificate */ |
|---|
| 80 | #define DTCP_EXTENDED_FULL_CERT_SIZE 132 /*!< size of extended full-auth device certificate */ |
|---|
| 81 | #define DTCP_RESTRICTED_CERT_SIZE 48 /*!< size of restricted auth device certificate */ |
|---|
| 82 | |
|---|
| 83 | #define DTCP_DEVICE_ID_SIZE 5 /*!< size of device id */ |
|---|
| 84 | #define DTCP_PUBLIC_KEY_SIZE 40 /*!< size of public key */ |
|---|
| 85 | #define DTCP_PRIVATE_KEY_SIZE 20 /*!< private key size */ |
|---|
| 86 | #define DTCP_SIGNATURE_SIZE 40 /*!< EC-DSA signature size */ |
|---|
| 87 | |
|---|
| 88 | /* AKE data sizes */ |
|---|
| 89 | |
|---|
| 90 | #define DTCP_FULL_AUTH_NONCE_SIZE 16 /*!< Size of the random nonce for full auth */ |
|---|
| 91 | #define DTCP_RESTRICTED_AUTH_NONCE_SIZE 8 /*!< Size of the random nonce for restricted auth */ |
|---|
| 92 | #define DTCP_RESTRICTED_AUTH_RESPONSE_SIZE 8 /*!< Size of the response for restricted auth */ |
|---|
| 93 | #define DTCP_EC_DH_FIRST_PHASE_VALUE_SIZE 40 /*!< Size of the Diffie-Hellman first phase value */ |
|---|
| 94 | #define DTCP_DH_FIRST_PHASE_SECRET_SIZE 20 /*!< Size of the Diffie-Hellman first phase secret */ |
|---|
| 95 | #define DTCP_AUTH_KEY_SIZE 12 /*!< Size of the authentication key */ |
|---|
| 96 | #define DTCP_RESTRICTED_AUTH_KEY_SIZE 8 /*!< Size of the restrcited auth authentication key */ |
|---|
| 97 | #define DTCP_EXCHANGE_KEY_SIZE 12 /*!< Size of the exchange key */ |
|---|
| 98 | #define DTCP_CONTENT_KEY_NONCE_SIZE 8 /*!< Size of the nonce for computing the content key */ |
|---|
| 99 | |
|---|
| 100 | #define DTCP_SRM_VERSION_NUMBER_SIZE 2 /*!< Size of the SRM version number */ |
|---|
| 101 | #define DTCP_SRM_GENERATION_SIZE 1 /*!< size of SRM generation in challenge response */ |
|---|
| 102 | #define DTCP_SRM_HEADER_SIZE 4 /*!< size of SRM header.*/ |
|---|
| 103 | #define DTCP_SRM_FIRST_GEN_MAX_SIZE 128 /*!< first generation SRM max size */ |
|---|
| 104 | #define DTCP_SRM_SECOND_GEN_MAX_SIZE 1024 /*!< Second generation SRM max size */ |
|---|
| 105 | #define DTCP_EXCHANGE_KEY_LABEL_SIZE 1 /*!< Size of the exchange key label */ |
|---|
| 106 | #define DTCP_CONTENT_KEY_CONSTANT_SIZE 12 /*!< Size of the content key constant */ |
|---|
| 107 | #define DTCP_IP_CONTENT_KEY_SIZE 16 /*!< Size of the content key for IP */ |
|---|
| 108 | |
|---|
| 109 | /* Sink capbilities for RESP2 */ |
|---|
| 110 | #define DTCP_DEVICE_CAPABILITY_SIZE 4 /*!< Size of the device capability for IP */ |
|---|
| 111 | |
|---|
| 112 | #define DTCP_FULL_AUTH_CHALLENGE_SIZE (DTCP_FULL_AUTH_NONCE_SIZE + DTCP_BASELINE_FULL_CERT_SIZE) /*!< Size of a full auth challenge */ |
|---|
| 113 | |
|---|
| 114 | #define DTCP_FULL_AUTH_RESPONSE_SIZE (DTCP_EC_DH_FIRST_PHASE_VALUE_SIZE + \ |
|---|
| 115 | DTCP_SRM_VERSION_NUMBER_SIZE + \ |
|---|
| 116 | DTCP_SRM_GENERATION_SIZE + \ |
|---|
| 117 | DTCP_SIGNATURE_SIZE) /*!< Size of a full auth response */ |
|---|
| 118 | #define DTCP_RESTRICTED_AUTH_CHALLENGE_SIZE (DTCP_RESTRICTED_AUTH_NONCE_SIZE + 2 ) /*!< Size of a restricted auth challenge ( nonce + 12 bits SRM version + 4 bits padding) */ |
|---|
| 119 | #define DTCP_RESTRICTED_AUTH_RESPONSE_SIZE 8 |
|---|
| 120 | #define DTCP_ENH_RESTRICTED_AUTH_CHALLENGE_SINK_SIZE (DTCP_RESTRICTED_CERT_SIZE + DTCP_RESTRICTED_AUTH_NONCE_SIZE) |
|---|
| 121 | |
|---|
| 122 | #define DTCP_FULL_AUTH_RESPONSE2_SIZE (DTCP_EC_DH_FIRST_PHASE_VALUE_SIZE + \ |
|---|
| 123 | DTCP_SRM_VERSION_NUMBER_SIZE + 1 + \ |
|---|
| 124 | DTCP_DEVICE_CAPABILITY_SIZE + \ |
|---|
| 125 | DTCP_DEVICE_ID_SIZE + \ |
|---|
| 126 | DTCP_SIGNATURE_SIZE) /*!< Size of a enhanced restricted auth challenge>*/ |
|---|
| 127 | #define DTCP_EXTENDED_FULL_AUTH_CHALLENGE_SIZE (DTCP_FULL_AUTH_NONCE_SIZE + DTCP_EXTENDED_FULL_CERT_SIZE) /*!<size of extended full-auth challenge*/ |
|---|
| 128 | |
|---|
| 129 | #define DTCP_CAPABILITY_REQ_SIZE (4) /*!< capability request command */ |
|---|
| 130 | |
|---|
| 131 | #define DTCP_EXCHANGE_KEY_CMD_DATA_SIZE (DTCP_EXCHANGE_KEY_SIZE + 2) /*!< Size of a exchange key command( lable + cipher_algorithm + key ) */ |
|---|
| 132 | #define DTCP_CONTENT_KEY_REQUEST_SIZE (DTCP_EXCHANGE_KEY_LABEL_SIZE + 3 + DTCP_CONTENT_KEY_NONCE_SIZE) /*!< Size of a content key request */ |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | #define DTCP_SRM_FIRST_GEN_MAX_SIZE 128 /*!< Maximum size of a first generation SRM */ |
|---|
| 136 | #define DTCP_SRM_SECOND_GEN_MAX_SIZE 1024 /*!< Maximum size of a second generation SRM */ |
|---|
| 137 | #define DTCP_SRM_MAX_SIZE DTCP_SRM_SECOND_GEN_MAX_SIZE /*!< Maximum SRM size*/ |
|---|
| 138 | #define DTCP_SRM_CRL_MIN_SIZE (DTCP_SRM_CRL_LENGTH_SIZE + DTCP_SIGNATURE_SIZE) /*!< Minimum SRM CRL size*/ |
|---|
| 139 | /*!< Size of the full auth response buffer that is signed */ |
|---|
| 140 | #define DTCP_FULL_AUTH_RESPONSE_SIGN_BUFFER_SIZE (DTCP_FULL_AUTH_NONCE_SIZE + \ |
|---|
| 141 | DTCP_EC_DH_FIRST_PHASE_VALUE_SIZE + \ |
|---|
| 142 | DTCP_SRM_VERSION_NUMBER_SIZE + \ |
|---|
| 143 | 1) |
|---|
| 144 | /*!< Size of the full auth response buffer that is signed */ |
|---|
| 145 | #define DTCP_FULL_AUTH_RESPONSE2_SIGN_BUFFER_SIZE (DTCP_FULL_AUTH_RESPONSE_SIGN_BUFFER_SIZE + \ |
|---|
| 146 | DTCP_DEVICE_CAPABILITY_SIZE + \ |
|---|
| 147 | DTCP_DEVICE_ID_SIZE) |
|---|
| 148 | |
|---|
| 149 | #define DTCP_CONTENT_PACKET_HEADER_SIZE 14 /*!< Size of a protected content packet header */ |
|---|
| 150 | #define DTCP_AES_KEY_SIZE 16 /*!< Size of an AES key */ |
|---|
| 151 | #define DTCP_AES_IV_SIZE 16 /*!< Size of an AES IV */ |
|---|
| 152 | #define DTCP_AES_BLOCK_SIZE 16 /*!< Size of an AES block */ |
|---|
| 153 | #define DTCP_MAXIMUM_PROTECTED_PACKET_SIZE 134217728 /*!< Maximum payload size of a protected content packet */ |
|---|
| 154 | #define DTCP_SINK_COUNT_LIMIT 32 /*!< Sink count limit*/ |
|---|
| 155 | |
|---|
| 156 | /* These should be in ECC.h */ |
|---|
| 157 | |
|---|
| 158 | #define ECC_PRIME_NUMBER_SIZE 20 /*!< Size of the ECC prime number */ |
|---|
| 159 | #define ECC_COEFFICIENT_SIZE 20 /*!< Size of the ECC coefficient*/ |
|---|
| 160 | #define ECC_BASEPOINT_SIZE 40 /*!< Size of the ECC basepoint */ |
|---|
| 161 | #define ECC_BASEPOINT_ORDER_SIZE 20 /*!< Size of the ECC basepoint order */ |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | #define KX_EXPIRE 7200/*!< 2*60*60 = 7200 seconds = 2 hours */ |
|---|
| 165 | |
|---|
| 166 | /* Include protocol specific constsnts */ |
|---|
| 167 | #include "b_dtcp_ip_constants.h" |
|---|
| 168 | |
|---|
| 169 | #endif /* __DTCP_CONSTANTS_H__ */ |
|---|