Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
bc17cc01
Commit
bc17cc01
authored
16 years ago
by
Reimar Döffinger
Browse files
Options
Downloads
Patches
Plain Diff
Add support for 3DES to DES module
Originally committed as revision 16971 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
1a534c7f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavutil/des.c
+14
-2
14 additions, 2 deletions
libavutil/des.c
libavutil/des.h
+1
-1
1 addition, 1 deletion
libavutil/des.h
with
15 additions
and
3 deletions
libavutil/des.c
+
14
−
2
View file @
bc17cc01
...
@@ -293,10 +293,14 @@ uint64_t ff_des_encdec(uint64_t in, uint64_t key, int decrypt) {
...
@@ -293,10 +293,14 @@ uint64_t ff_des_encdec(uint64_t in, uint64_t key, int decrypt) {
#endif
#endif
int
av_des_init
(
AVDES
*
d
,
const
uint8_t
*
key
,
int
key_bits
,
int
decrypt
)
{
int
av_des_init
(
AVDES
*
d
,
const
uint8_t
*
key
,
int
key_bits
,
int
decrypt
)
{
if
(
key_bits
!=
64
)
if
(
key_bits
!=
64
&&
key_bits
!=
192
)
return
-
1
;
return
-
1
;
d
->
triple_des
=
0
;
d
->
triple_des
=
key_bits
>
64
;
gen_roundkeys
(
d
->
round_keys
[
0
],
AV_RB64
(
key
));
gen_roundkeys
(
d
->
round_keys
[
0
],
AV_RB64
(
key
));
if
(
d
->
triple_des
)
{
gen_roundkeys
(
d
->
round_keys
[
1
],
AV_RB64
(
key
+
8
));
gen_roundkeys
(
d
->
round_keys
[
2
],
AV_RB64
(
key
+
16
));
}
return
0
;
return
0
;
}
}
...
@@ -306,10 +310,18 @@ void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t
...
@@ -306,10 +310,18 @@ void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t
uint64_t
dst_val
;
uint64_t
dst_val
;
uint64_t
src_val
=
src
?
be2me_64
(
*
(
const
uint64_t
*
)
src
)
:
0
;
uint64_t
src_val
=
src
?
be2me_64
(
*
(
const
uint64_t
*
)
src
)
:
0
;
if
(
decrypt
)
{
if
(
decrypt
)
{
if
(
d
->
triple_des
)
{
src_val
=
des_encdec
(
src_val
,
d
->
round_keys
[
2
],
1
);
src_val
=
des_encdec
(
src_val
,
d
->
round_keys
[
1
],
0
);
}
dst_val
=
des_encdec
(
src_val
,
d
->
round_keys
[
0
],
1
)
^
iv_val
;
dst_val
=
des_encdec
(
src_val
,
d
->
round_keys
[
0
],
1
)
^
iv_val
;
iv_val
=
iv
?
src_val
:
0
;
iv_val
=
iv
?
src_val
:
0
;
}
else
{
}
else
{
dst_val
=
des_encdec
(
src_val
^
iv_val
,
d
->
round_keys
[
0
],
0
);
dst_val
=
des_encdec
(
src_val
^
iv_val
,
d
->
round_keys
[
0
],
0
);
if
(
d
->
triple_des
)
{
dst_val
=
des_encdec
(
dst_val
,
d
->
round_keys
[
1
],
1
);
dst_val
=
des_encdec
(
dst_val
,
d
->
round_keys
[
2
],
0
);
}
iv_val
=
iv
?
dst_val
:
0
;
iv_val
=
iv
?
dst_val
:
0
;
}
}
*
(
uint64_t
*
)
dst
=
be2me_64
(
dst_val
);
*
(
uint64_t
*
)
dst
=
be2me_64
(
dst_val
);
...
...
This diff is collapsed.
Click to expand it.
libavutil/des.h
+
1
−
1
View file @
bc17cc01
...
@@ -32,7 +32,7 @@ struct AVDES {
...
@@ -32,7 +32,7 @@ struct AVDES {
/**
/**
* \brief Initializes an AVDES context.
* \brief Initializes an AVDES context.
*
*
* \param key_bits must be 64
* \param key_bits must be 64
or 192
* \param decrypt 0 for encryption, 1 for decryption
* \param decrypt 0 for encryption, 1 for decryption
*/
*/
int
av_des_init
(
struct
AVDES
*
d
,
const
uint8_t
*
key
,
int
key_bits
,
int
decrypt
);
int
av_des_init
(
struct
AVDES
*
d
,
const
uint8_t
*
key
,
int
key_bits
,
int
decrypt
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment