17 #ifndef _TS2_IEC_62455_H_ 18 #define _TS2_IEC_62455_H_ 28 #define TS2_KSM_TABLE80_ID 0x80 29 #define TS2_KSM_TABLE81_ID 0x81 31 #define TS2_KSM_PROTOCOL_VERSION_1 0x01 33 #define TS2_KSM_ENCRYPTED_PEK_SIZE 16 34 #define TS2_KSM_MAC_SIZE 12 35 #define TS2_KSM_CID_EXTENSION_SIZE 4 37 #define TS2_KSM_ALGO_IPSEC 0 38 #define TS2_KSM_ALGO_SRTP 1 39 #define TS2_KSM_ALGO_ISMACRYPT 2 40 #define TS2_KSM_ALGO_MPEG2_TS_CRYPT 7 42 #define TS2_KSM_FLAG_EVEN 0 43 #define TS2_KSM_FLAG_ODD 1 45 #define TS2_KSM_CONTENT_KEY_INDEX_DVB_CSA_64 0x00 46 #define TS2_KSM_CONTENT_KEY_INDEX_DES_56 0x01 47 #define TS2_KSM_CONTENT_KEY_INDEX_3DES_168 0x02 48 #define TS2_KSM_CONTENT_KEY_INDEX_3DES_112 0x03 49 #define TS2_KSM_CONTENT_KEY_INDEX_3DES_56 0x04 50 #define TS2_KSM_CONTENT_KEY_INDEX_AES_128 0x05 51 #define TS2_KSM_CONTENT_KEY_INDEX_M2_64 0x06 52 #define TS2_KSM_CONTENT_KEY_INDEX_AES_128_KDF 0x0F 54 #define TS2_KSM_CIPHER_MODE_ECB 0x00 55 #define TS2_KSM_CIPHER_MODE_CBC 0x01 56 #define TS2_KSM_CIPHER_MODE_CSA 0x02 58 #define TS2_KSM_FLAG_EVEN 0 59 #define TS2_KSM_FLAG_ODD 1 138 const ATX_Byte* encrypted_pek,
139 const ATX_Byte* cid_extension);
150 const ATX_Byte* cid_extension);
178 ATX_UInt32 crypto_period,
179 ATX_UInt8 odd_even_flag,
183 const ATX_Byte* next_iv,
189 ATX_Size access_criteria_size,
203 ATX_DataBuffer** buffer);
207 ATX_Size buffer_size,
259 #define TS2_KSM_Flags_ProtocolVersion(flags) (((flags) & 0xF000) >> 12) 260 #define TS2_KSM_Flags_AccessCriteriaFlag(flags) (((flags) & 0x0100) >> 8) 261 #define TS2_KSM_Flags_TrafficProtectionProtocol(flags) (((flags) & 0x00E0) >> 5) 262 #define TS2_KSM_Flags_TrafficAuthenticationFlag(flags) (((flags) & 0x0010) >> 4) 263 #define TS2_KSM_Flags_NextTrafficKeyFlag(flags) (((flags) & 0x0008) >> 3) 264 #define TS2_KSM_Flags_TimestampFlag(flags) (((flags) & 0x0004) >> 2) 265 #define TS2_KSM_Flags_ProgrammeFlag(flags) (((flags) & 0x0002) >> 1) 266 #define TS2_KSM_Flags_ServiceFlag(flags) (((flags) & 0x0001) ) 268 #define TS2_Mpeg2TsCryptKSM_ContentKeyIndex(m2ksm) ((((m2ksm)->info) & 0xF0) >> 4) 269 #define TS2_Mpeg2TsCryptKSM_OddEvenFlag(m2ksm) ((((m2ksm)->info) & 0x08) >> 3) 270 #define TS2_Mpeg2TsCryptKSM_CipherMode(m2ksm) ((((m2ksm)->info) & 0x07) ) 272 #define TS2_GetKeyLifetimeInSecs(klf) (1 << (klf)) 277 #define TS2_KSM_Destroy(KSM) \ 279 TS2_KSM* __ksm = (KSM); \ 280 if (__ksm && __ksm->Destroy) { \ 281 __ksm->Destroy(__ksm); \ ATX_Result TS2_KSM_Service_Construct(TS2_KSM_Service *self, const ATX_Byte *cid_extension)
Initialize the KSM Service structure.
ATX_Result TS2_KSM_AccessCriteria_Parse(const ATX_Byte *ac_data, ATX_Size *ac_size, TS2_KSM_AccessCriteria **ac)
Parses the access_criteria block in the KSM.
ATX_Result TS2_Mpeg2TsCryptKSM_Create(ATX_UInt32 content_key_index, ATX_UInt32 crypto_period, ATX_UInt8 odd_even_flag, const ATX_Byte *enc_key_material, const ATX_Byte *next_enc_key_material, const ATX_Byte *iv, const ATX_Byte *next_iv, const TS2_KSM_Programme *programme, const TS2_KSM_Service *service, const ATX_Byte *mac_key, ATX_Size mac_key_size, const ATX_Byte *access_criteria, ATX_Size access_criteria_size, TS2_KSM **ksm)
Create a Marlin BBTS Key Stream Message (KSM) object.
#define TS2_KSM_MAC_SIZE
Definition: Ts2Iec62455.h:34
ATX_Byte reserved_byte
Definition: Ts2Iec62455.h:65
ATX_Size mac_key_size
Definition: Ts2Iec62455.h:99
ATX_UInt16 flags
Definition: Ts2Iec62455.h:86
ATX_Size signed_payload_size
Definition: Ts2Iec62455.h:80
void TS2_Mpeg2TsCryptKSM_SwitchOddEvenFlag(TS2_Mpeg2TsCryptKSM *self)
Definition: Ts2Iec62455.h:64
void TS2_KSM_AccessCriteria_Destroy(TS2_KSM_AccessCriteria *self)
Destroys the TS2_KSM_AccessCriteria object.
TS2_KSM_Service * service
Definition: Ts2Iec62455.h:95
ATX_Byte * next_enc_key_material
Definition: Ts2Iec62455.h:90
ATX_Size signed_payload_size
Definition: Ts2Iec62455.h:74
Definition: Ts2Iec62455.h:69
ATX_Result TS2_Mpeg2TsCryptKSM_Serialize(TS2_Mpeg2TsCryptKSM *m2ksm, ATX_DataBuffer **buffer)
Serialize a Marlin Key Stream Message.
Definition: Ts2Iec62455.h:111
ATX_Byte * enc_key_material
Definition: Ts2Iec62455.h:88
TS2_KSM_AccessCriteria * access_criteria
Definition: Ts2Iec62455.h:93
Definition: Ts2Iec62455.h:78
TS2_Table base
Definition: Ts2Iec62455.h:112
#define TS2_KSM_ENCRYPTED_PEK_SIZE
Definition: Ts2Iec62455.h:33
#define TS2_EXPORT
Definition: Ts2Config.h:67
ATX_UInt64 timestamp
Definition: Ts2Iec62455.h:92
ATX_UInt8 permissions
Definition: Ts2Iec62455.h:71
ATX_List * descriptors
Definition: Ts2Iec62455.h:66
TS2_KSM_Programme * programme
Definition: Ts2Iec62455.h:94
Definition: Ts2Tables.h:68
ATX_Byte * mac_key
Definition: Ts2Iec62455.h:98
#define TS2_KSM_CID_EXTENSION_SIZE
Definition: Ts2Iec62455.h:35
ATX_Result TS2_KSM_Programme_Construct(TS2_KSM_Programme *self, const ATX_Byte *encrypted_pek, const ATX_Byte *cid_extension)
Initialize the KSM Programme structure.
ATX_Result TS2_KSM_CreateFromBuffer(const ATX_Byte *buffer, ATX_Size buffer_size, TS2_KSM **ksm)
ATX_Byte * iv
Definition: Ts2Iec62455.h:107
TS2_KSM * ksm
Definition: Ts2Iec62455.h:113
ATX_UInt8 enc_key_material_size
Definition: Ts2Iec62455.h:89
ATX_UInt8 permission_flag
Definition: Ts2Iec62455.h:70
void(* Destroy)(TS2_KSM *self)
Definition: Ts2Iec62455.h:100
Definition: Ts2Iec62455.h:85
ATX_UInt8 info
Definition: Ts2Iec62455.h:105
ATX_UInt8 iv_size
Definition: Ts2Iec62455.h:106
ATX_Byte * signed_payload
Definition: Ts2Iec62455.h:87
ATX_Result TS2_KSM_AccessCriteria_Serialize(TS2_KSM_AccessCriteria *ac, ATX_Byte *buffer, ATX_Size *buffer_size)
Serializes the TS2_KSM_AccessCriteria object to a data-buffer.
TS2_KSM base
Definition: Ts2Iec62455.h:104
Definition: Ts2Iec62455.h:103
TS2_EXPORT ATX_Result TS2_KSMT_Construct(TS2_KSMT *self)
ATX_UInt8 key_lifetime
Definition: Ts2Iec62455.h:91
ATX_Byte * next_iv
Definition: Ts2Iec62455.h:108