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
a0321dad
Commit
a0321dad
authored
Sep 30, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xtea-test: factorize test code
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
3fa10024
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
xtea.c
libavutil/xtea.c
+9
-10
No files found.
libavutil/xtea.c
View file @
a0321dad
...
...
@@ -227,20 +227,19 @@ int main(void)
uint8_t
buf
[
8
];
int
i
;
#define CHECK(dst, src, ref, len, iv, dir, error) \
av_xtea_crypt(&ctx, dst, src, len, iv, dir);\
if (memcmp(dst, ref, 8*len)) {\
printf(error);\
return 1;\
}
for
(
i
=
0
;
i
<
XTEA_NUM_TESTS
;
i
++
)
{
av_xtea_init
(
&
ctx
,
xtea_test_key
[
i
]);
av_xtea_crypt
(
&
ctx
,
buf
,
xtea_test_pt
[
i
],
1
,
NULL
,
0
);
if
(
memcmp
(
buf
,
xtea_test_ct
[
i
],
8
))
{
printf
(
"Test encryption failed.
\n
"
);
return
1
;
}
CHECK
(
buf
,
xtea_test_pt
[
i
],
xtea_test_ct
[
i
],
1
,
NULL
,
0
,
"Test encryption failed.
\n
"
);
CHECK
(
buf
,
xtea_test_ct
[
i
],
xtea_test_pt
[
i
],
1
,
NULL
,
1
,
"Test decryption failed.
\n
"
);
av_xtea_crypt
(
&
ctx
,
buf
,
xtea_test_ct
[
i
],
1
,
NULL
,
1
);
if
(
memcmp
(
buf
,
xtea_test_pt
[
i
],
8
))
{
printf
(
"Test decryption failed.
\n
"
);
return
1
;
}
}
printf
(
"Test encryption/decryption success.
\n
"
);
...
...
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