Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
15f9189b
Commit
15f9189b
authored
Jun 12, 2016
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/redspark: deobfuscate header decrypt code
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
8fdad638
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
redspark.c
libavformat/redspark.c
+11
-6
No files found.
libavformat/redspark.c
View file @
15f9189b
...
...
@@ -26,6 +26,7 @@
#include "internal.h"
#define HEADER_SIZE 4096
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
typedef
struct
RedSparkContext
{
int
samples_count
;
...
...
@@ -38,11 +39,13 @@ static int redspark_probe(AVProbeData *p)
/* Decrypt first 8 bytes of the header */
data
=
AV_RB32
(
p
->
buf
);
data
=
data
^
(
key
=
data
^
0x52656453
);
key
=
data
^
0x52656453
;
data
^=
key
;
AV_WB32
(
header
,
data
);
key
=
(
key
<<
11
)
|
(
key
>>
2
1
);
key
=
rol
(
key
,
1
1
);
data
=
AV_RB32
(
p
->
buf
+
4
)
^
(((
key
<<
3
)
|
(
key
>>
29
))
+
key
);
key
+=
rol
(
key
,
3
);
data
=
AV_RB32
(
p
->
buf
+
4
)
^
key
;
AV_WB32
(
header
+
4
,
data
);
if
(
AV_RB64
(
header
)
==
AV_RB64
(
"RedSpark"
))
...
...
@@ -69,12 +72,14 @@ static int redspark_read_header(AVFormatContext *s)
/* Decrypt header */
data
=
avio_rb32
(
pb
);
data
=
data
^
(
key
=
data
^
0x52656453
);
key
=
data
^
0x52656453
;
data
^=
key
;
AV_WB32
(
header
,
data
);
key
=
(
key
<<
11
)
|
(
key
>>
2
1
);
key
=
rol
(
key
,
1
1
);
for
(
i
=
4
;
i
<
HEADER_SIZE
;
i
+=
4
)
{
data
=
avio_rb32
(
pb
)
^
(
key
=
((
key
<<
3
)
|
(
key
>>
29
))
+
key
);
key
+=
rol
(
key
,
3
);
data
=
avio_rb32
(
pb
)
^
key
;
AV_WB32
(
header
+
i
,
data
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment