📄 bluraycps.h
字号:
/* * * Copyright (c) Sigma Designs, Inc. 2006. All rights reserved. * */#ifndef __BLURAYCPS_H__#define __BLURAYCPS_H__#include "rmdef/rmdef.h"#include "rmaacsapi/include/aacs_def.h"#include "rmaacsapi/include/aacs_cci.h"#include "bluraycps_callbacks.h"/* TODO Add IbC data struct *//** Flags for the media initialize function */#define CPS_FLAGS_MEDIA_TYPE_MASK (0x3)#define CPS_FLAGS_MEDIA_TYPE_BD_ROM (0x0) /* aka - Pre-Recorded */#define CPS_FLAGS_MEDIA_TYPE_BD_RE (0x1) /* aka - ReWriteable */#define CPS_FLAGS_MEDIA_TYPE_BD_R (0x2) /* aka - Recordable */#define CPS_FLAGS_MEDIA_TYPE_SIGMA_MC (0x3) /* internal use only */#define CPS_FLAGS_MEDIA_TYPE_RESERVED (0x3)#define CPS_FLAGS_LAYER_MASK (0x4)#define CPS_FLAGS_SINGLE_LAYER (0x0)#define CPS_FLAGS_DUAL_LAYER (0x4)#define CPS_FLAGS_AACS_FS_TYPE_MASK (0x18)#define CPS_FLAGS_AACS_FS_TYPE_BDROM (0x0)#define CPS_FLAGS_AACS_FS_TYPE_BD_RE_20 (0x08)#define CPS_FLAGS_AACS_FS_TYPE_BD_RE_30 (0x10)#define CPS_FLAGS_AACS_FS_TYPE_INVALID (0x18) /* Flags returned from init_cps */#define CPS_AACS_DISABLED 1<<31#define CPS_BDPLUS_DISABLED 1<<30/** CPS user-side context, opaque */struct cps_context_s;/** DemuxCipher structure **/struct demux_cipher;/** * Return the amount of memory needed by the CPS module * * @return Size in bytes. */RMuint32 cps_get_memsize(void);/** * Initialize a new cps_context * * Create a new context, initialize internals * * @param **cps_context - will return a new AACS context on success * @param chip - SMP86xx device number. * @param cps_buffer_physaddr - Physical address of the CPS buffer * @param cps_buffer_virtaddr - Mapped address of the CPS buffer * @param callbacks - callback table. * @param callback_context - context passed to callbacks. * @return RM_OK - on success * RM_FATAL - BDSVM must be closed all AV must stop! * RM_NOT_FOUND - neither BD+ nor AACS were present on disc. * * Note: that the Return value should be masked. The top two bits tell if * BD+ or AACS is disabled. The bottom 30 bits are the rmstatus return value. * If either BD+ or AACS is not found then the top two bits will have the * following flags: * CPS_BDPLUS_DISABLED - BD+ not present on disc. * CPS_AACS_DISABLED - AACS not present on disc. * * The CPS buffer must be allocated in SMP86xx DRAM and mapped to * the process memory. The size of the CPS buffer must be the size * returned by cps_get_memsize(). * */RMstatus init_cps(struct cps_context_s **cps_context, RMuint32 chip, RMuint32 cps_buffer_physaddr, RMuint32 cps_buffer_virtaddr, struct cps_callbacks_s *callbacks, void *callback_context);/** * Initialize a new cps_context * * Create a new context, initialize internals * * @param **cps_context - will return a new AACS context on success * @param chip - SMP86xx device number. * @param cps_buffer_physaddr - Physical address of the CPS buffer * @param cps_buffer_virtaddr - Mapped address of the CPS buffer * @param callbacks - callback table. * @param callback_context - context passed to callbacks. * @return RM_OK - on success * RM_FATAL - BDSVM must be closed all AV must stop! * RM_NOT_FOUND - neither BD+ nor AACS were present on disc. * * Note: that the Return value should be masked. The top two bits tell if * BD+ or AACS is disabled. The bottom 30 bits are the rmstatus return value. * If either BD+ or AACS is not found then the top two bits will have the * following flags: * CPS_BDPLUS_DISABLED - BD+ not present on disc. * CPS_AACS_DISABLED - AACS not present on disc. * * The CPS buffer must be allocated in SMP86xx DRAM and mapped to * the process memory. The size of the CPS buffer must be the size * returned by cps_get_memsize(). * */RMstatus init_cps_preloaded(struct cps_context_s **cps_context, RMuint32 chip, RMuint32 cps_buffer_physaddr, RMuint32 cps_buffer_virtaddr, struct cps_callbacks_s *callbacks, void *callback_context, RMuint32 bdplus_xtask_slot, RMuint32 aacs_xtask_slot, struct demux_cipher *dmx_cphr);/** * Initialize media session * * This function authenticates the content and performs various other * operations, depending on the AACS flavor chosen. For BD-ROM, it verifies the * DRL, computes the Bus Key, the Media Key and processes the SKB(s). * * NOTE: This call invokes the VM. It must be synchronized with all * other calls that use the VM. * * @param cps_context - cps_context initialized with init_cps * @param flags - Media Type and Layers info - see CPS_FLAGS_xxx above * @return RM_OK - Success * RM_FATAL - BDSVM must be closed all AV must stop! */RMstatus cps_media_initialize(struct cps_context_s *cps_context, RMuint32 flags);/** * Finalize media session. * * NOTE: This call invokes the VM. It must be synchronized with all * other calls that use the VM. * * @param cps_context - cps_context initialized with init_cps * @return RM_OK - Success * RM_FATAL - BDSVM must be closed all AV must stop! */RMstatus cps_media_finalize(struct cps_context_s *cps_context);/** * Performs content revocation (content hashing) * * @param cps_context - cps_context initialized with init_cps * @return RM_OK on success */RMstatus cps_content_revocation(struct cps_context_s *cps_context);/** * Ready title for playback * * This function performs various operation to make a title ready. It outputs * the Copy Control Information (the returned pointer should not be freed). * * cps_media_initialize and cps_content_revocation should have been called at * least once before calling cps_title_ready. * * NOTE: This call invokes the VM. It must be synchronized with all other calls * that use the VM. * * @param cps_context - cps_context initialized with init_cps * @param title_id - Title number for BD-ROM/BD-RE 3.0, ... * @param aacs_cci - Copy Control Information * @return RM_OK - Success * RM_FATAL - BDSVM must be closed all AV must stop! */RMstatus cps_title_ready(struct cps_context_s *cps_context, RMuint32 title_id, struct aacs_cci_info **aacs_cci);/** * Ready clip for playback (for BD-RE 2.0) * * This function performs various operations to prepare the playback of a clip. * It returns the basic CCI for AACS as a struct rmcci. The returned pointer MUST * not be freed. * * cps_media_initialize must have been called at least once before calling cps_clip_ready. * * @param cps_context - cps_context initialized with init_cps * @param clip_id - Clip number for BD-RE 2.0 * @param aacs_cci - Copy Control Information * @return RM_OK - Success */RMstatus cps_clip_ready(struct cps_context_s *cps_context, RMuint16 clip_id, RMuint8 bd_directory, struct aacs_cci_info **aacs_cci);/** * BDAV-specific: ready clips for playback. * * This function performs various operations to prepare the playback of a clip. * It returns the basic CCI for AACS as a struct rmcci. The returned pointer MUST *not be freed. * * cps_media_initialize must have been called at least once before calling cps_clips_ready. * * @param aacs_context - aacs_context * @param clip_info - clip ID and BD_directory as defined in BD recordable 3.2.2 * @param no_clips - number of clips in the clip_info structure * @param cci - returned CCI information * @param no_cci - returned number of cci information * @return RM_OK on success, RM_ERROR on error and aacs_error is set */RMstatus cps_clips_ready(struct cps_context_s *cps_context, struct clip_info *clip_info, RMuint32 no_clips);RMstatus cps_decrypt_thumbnail(struct cps_context_s *cps_context, enum bdav_tn_type tn_type, RMuint8 bd_directory, RMuint8 *tn_sub_in, RMuint8 *tn_sub_out, RMuint32 n_tn_sub, struct aacs_cci_info **aacs_cci);/** * Prepare BD+ Media Transform for the next segment * * This function compute the SP value and stores it in slot_id slot. * This should be done before sending the inband command with the * slot_id and SPN. * * ** WARNING ** Currently this function imply synchronous operation, * and SP calculation might take a long time before it is completed. * * NOTE: This call invokes the VM. It must be synchronized with all * other calls that use the VM. * * @param cps_context - cps_context initialized with init_cps * @param sp_id - Secret Parameter ID * @param clip_id - ID of the clip * @param slot_id - ID of the slot where the SP value is cached. * @return RM_OK - Success * RM_FATAL - BDSVM must be closed all AV must stop! */RMstatus cps_bd_segment_ready(struct cps_context_s *cps_context, RMuint16 sp_id, RMuint32 clip_id, RMuint8 slot_id);/** * Read AACS PSR * * This function returns the value of a given AACS PSR (0 or 1) * * @param cps_context - cps_context initialized with init_cps * @param psr - number of the AACS PSR to get (0 or 1) * @param psr_value - returned value of the PSR * @return RM_OK - success */RMstatus cps_get_aacs_psr(struct cps_context_s *cps_context, RMuint32 psr, RMuint32 *psr_value);/** * Read BD-J Root Certificate Hash * * @param cps_context - cps_context initialized with init_cps * @param aid * @param csn * @param hash - 20 bytes long buffer to receive the SHA1 * @return RM_OK - success */RMstatus cps_get_bdj_hash(struct cps_context_s *cps_context, RMuint16 *aid, RMuint32 *csn, RMuint8 *hash);/** * Signal an updated application layer register to BD+ * * NOTE: This call invokes the VM. It must be synchronized with all * other calls that use the VM. * * @param cps_context - cps_context initialized with init_cps * @param resource - resource that has been updated * @return RM_OK - Success */RMstatus cps_bdp_psr_update(struct cps_context_s *cps_context, RMuint32 resource);/** * Run BD+ Security VM (spdc) * * NOTE: This call invokes the VM. It must be synchronized with all * other calls that use the VM. * * @param cps_context - cps_context initialized with init_cps * @param cycles - number of cycles to run the VM for * @return RM_PENDING - Always. */RMstatus cps_bdp_run_vm(struct cps_context_s *cps_context, RMint32 *cycles);/** * Terminate a AACS session * * Free resources allocated for the given AACS context * * @param cps_context - cps_context initialized with init_cps * @return RM_OK - Success */RMstatus term_cps(struct cps_context_s *cps_context);/** * Get decryption information * * @param cps_context - cps_context initialized with init_cps * @param xtask_pid - returned PID of the xtask * @param cookie - decryption cookie, returned * @return RM_OK on success, RM_ERROR on error and aacs_error is set */RMstatus cps_get_decrypt_info(struct cps_context_s *cps_context, RMuint32 *xtask_pid, void **cookie);/** * Enable Extended BD+ support * * @param cps_context - cps_context initialized with init_cps * @param enable - Boolean value where TRUE enables extended BD+ check. * (Enabled by default) * @return RM_OK on success, RM_ERROR on parameter error. */RMstatus cps_enable_extended_bdplus(struct cps_context_s *cps_context, RMbool enable);#endif /* __BLURAYCPS_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -