Regular update

Plugin:
1. Process ECM v3 and send fingerprinting/service_blocking events
2. Rmove unused function Ctr128Add
3. Add support for ECM v3

OEMCrypto:
1. Update API description of OEMCrypto_LoadCasECMKeys
2. Fix android build files for ODK
3. Load content keys to shared memory
4. Move KCB check to LoadCasKeys call
5. Support even/odd content keys to share entitlement key
This commit is contained in:
Lu Chen
2021-01-05 10:16:26 -08:00
parent 66d8498d2c
commit 00785b2ccd
38 changed files with 2234 additions and 747 deletions

View File

@@ -9,56 +9,42 @@
#include <vector>
#include "cas_types.h"
#include "media_cas.pb.h"
namespace wvcas {
enum class KeySlotId { kEvenKeySlot, kOddKeySlot };
struct EcmKeyData;
// EcmParser allows random access to the fields of an ECM.
// The only validation performed is to ensure that the ecm
// passed in is large enough to hold a single key entry.
class EcmParser {
protected:
EcmParser() {}
public:
EcmParser() = default;
virtual ~EcmParser() {}
// The EcmParser factory method.
// Validates the ecm. If validations is successful returns true and constructs
// an EcmParser in |parser| using |ecm|.
static bool create(const CasEcm& ecm,
std::unique_ptr<const EcmParser>* parser);
static std::unique_ptr<const EcmParser> Create(const CasEcm& ecm);
// Accessor methods.
virtual uint8_t version() const;
virtual uint8_t sequence_count() const;
virtual CryptoMode crypto_mode() const;
virtual bool rotation_enabled() const;
virtual size_t content_iv_size() const;
virtual uint8_t age_restriction() const;
virtual const std::vector<uint8_t> entitlement_key_id(KeySlotId id) const;
virtual const std::vector<uint8_t> content_key_id(KeySlotId id) const;
virtual const std::vector<uint8_t> wrapped_key_data(KeySlotId id) const;
virtual const std::vector<uint8_t> wrapped_key_iv(KeySlotId id) const;
virtual const std::vector<uint8_t> content_iv(KeySlotId id) const;
virtual uint8_t version() const = 0;
virtual CryptoMode crypto_mode() const = 0;
virtual bool rotation_enabled() const = 0;
virtual size_t content_iv_size() const = 0;
virtual uint8_t age_restriction() const = 0;
virtual std::vector<uint8_t> entitlement_key_id(KeySlotId id) const = 0;
virtual std::vector<uint8_t> content_key_id(KeySlotId id) const = 0;
virtual std::vector<uint8_t> wrapped_key_data(KeySlotId id) const = 0;
virtual std::vector<uint8_t> wrapped_key_iv(KeySlotId id) const = 0;
virtual std::vector<uint8_t> content_iv(KeySlotId id) const = 0;
EcmParser(const EcmParser&) = delete;
EcmParser& operator=(const EcmParser&) = delete;
private:
// Constructs an EcmParser using |ecm|.
explicit EcmParser(const CasEcm& ecm);
size_t key_data_size() const;
// Returns false if the ecm used to construct the object is not a valid size.
// TODO(jfore): Add validation using the version field.
bool is_valid_size() const;
const EcmKeyData* key_slot_data(KeySlotId id) const;
CasEcm ecm_;
virtual bool has_fingerprinting() const = 0;
virtual video_widevine::Fingerprinting fingerprinting() const = 0;
virtual bool has_service_blocking() const = 0;
virtual video_widevine::ServiceBlocking service_blocking() const = 0;
// The serialized payload that the signature is calculated on.
virtual std::string ecm_serialized_payload() const = 0;
virtual std::string signature() const = 0;
};
} // namespace wvcas