Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e47077fe authored by Jeff Tinker's avatar Jeff Tinker
Browse files

Support AES-CBC sample encryption in MediaDrm

bug:23719082
Change-Id: I8f892657d8be888056165b98c7c810339e7a8b41
parent 8c5ac0a9
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -46,10 +46,8 @@ struct CryptoPlugin {
    enum Mode {
        kMode_Unencrypted = 0,
        kMode_AES_CTR     = 1,

        // Neither key nor iv are being used in this mode.
        // Each subsample is encrypted w/ an iv of all zeroes.
        kMode_AES_WV      = 2,  // FIX constant
        kMode_AES_WV      = 2,
        kMode_AES_CBC     = 3,
    };

    struct SubSample {
@@ -57,6 +55,16 @@ struct CryptoPlugin {
        uint32_t mNumBytesOfEncryptedData;
    };

    struct Pattern {
        // Number of blocks to be encrypted in the pattern. If zero, pattern
        // encryption is inoperative.
        uint32_t mEncryptBlocks;

        // Number of blocks to be skipped (left clear) in the pattern. If zero,
        // pattern encryption is inoperative.
        uint32_t mSkipBlocks;
    };

    CryptoPlugin() {}
    virtual ~CryptoPlugin() {}

@@ -96,6 +104,7 @@ struct CryptoPlugin {
            const uint8_t key[16],
            const uint8_t iv[16],
            Mode mode,
            const Pattern &pattern,
            const void *srcPtr,
            const SubSample *subSamples, size_t numSubSamples,
            void *dstPtr,