Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-11-11 22:42:02 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-18 21:33:32 +0300
commitcf115791daf4c0c9ed3d028ec0c7ed76c51ecd41 (patch)
tree84349391a8d82f127327d86489dd5077b7aa1749
parentbc3d86cddb804c326ac33d96938abc0d26929d8c (diff)
rtmpcrypt: Do the xtea decryption in little endian mode
The XTEA algorithm operates on 32 bit numbers, not on byte sequences. The XTEA implementation in libavutil is written assuming big endian numbers, while the rtmpe signature encryption assumes little endian. This fixes rtmpe communication with rtmpe servers that use signature type 8 (XTEA), e.g. crunchyroll. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit e7728319b92dbb4fb949155e33de7ff5358ddff3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/rtmpcrypt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/rtmpcrypt.c b/libavformat/rtmpcrypt.c
index 2065ec6602..3771909857 100644
--- a/libavformat/rtmpcrypt.c
+++ b/libavformat/rtmpcrypt.c
@@ -184,9 +184,14 @@ int ff_rtmpe_compute_secret_key(URLContext *h, const uint8_t *serverdata,
static void rtmpe8_sig(const uint8_t *in, uint8_t *out, int key_id)
{
struct AVXTEA ctx;
+ uint8_t tmpbuf[8];
av_xtea_init(&ctx, rtmpe8_keys[key_id]);
- av_xtea_crypt(&ctx, out, in, 1, NULL, 0);
+ AV_WB32(tmpbuf, AV_RL32(in));
+ AV_WB32(tmpbuf + 4, AV_RL32(in + 4));
+ av_xtea_crypt(&ctx, tmpbuf, tmpbuf, 1, NULL, 0);
+ AV_WL32(out, AV_RB32(tmpbuf));
+ AV_WL32(out + 4, AV_RB32(tmpbuf + 4));
}
static void rtmpe9_sig(const uint8_t *in, uint8_t *out, int key_id)