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

Commit 4a3108a4 authored by Robert Shih's avatar Robert Shih
Browse files

HLS: left zero fill 128 bit AES IV

Bug: 28320768
Change-Id: I9195b87f742f83d3e4c4201642463881303ae3e6
parent 4178befd
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -368,11 +368,15 @@ status_t PlaylistFetcher::decryptBuffer(
        AString iv;
        if (itemMeta->findString("cipher-iv", &iv)) {
            if ((!iv.startsWith("0x") && !iv.startsWith("0X"))
                    || iv.size() != 16 * 2 + 2) {
                    || iv.size() > 16 * 2 + 2) {
                ALOGE("malformed cipher IV '%s'.", iv.c_str());
                return ERROR_MALFORMED;
            }

            while (iv.size() < 16 * 2 + 2) {
                iv.insert("0", 1, 2);
            }

            memset(mAESInitVec, 0, sizeof(mAESInitVec));
            for (size_t i = 0; i < 16; ++i) {
                char c1 = tolower(iv.c_str()[2 + 2 * i]);