Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
7f51fb10
Commit
7f51fb10
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Add support for decrypting blowfish
parent
1cedebe5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llmessage/llblowfishcipher.cpp
+40
-1
40 additions, 1 deletion
indra/llmessage/llblowfishcipher.cpp
with
40 additions
and
1 deletion
indra/llmessage/llblowfishcipher.cpp
+
40
−
1
View file @
7f51fb10
...
...
@@ -107,7 +107,46 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
// virtual
U32
LLBlowfishCipher
::
decrypt
(
const
U8
*
src
,
U32
src_len
,
U8
*
dst
,
U32
dst_len
)
{
LL_ERRS
()
<<
"LLBlowfishCipher decrypt unsupported"
<<
LL_ENDL
;
if
(
!
src
||
!
src_len
||
!
dst
||
!
dst_len
)
return
0
;
if
(
src_len
>
dst_len
)
return
0
;
EVP_CIPHER_CTX
context
;
EVP_CIPHER_CTX_init
(
&
context
);
EVP_DecryptInit_ex
(
&
context
,
EVP_bf_cbc
(),
NULL
,
NULL
,
NULL
);
EVP_CIPHER_CTX_set_key_length
(
&
context
,
(
int
)
mSecretSize
);
unsigned
char
initial_vector
[]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
EVP_DecryptInit_ex
(
&
context
,
NULL
,
NULL
,
mSecret
,
initial_vector
);
int
blocksize
=
EVP_CIPHER_CTX_block_size
(
&
context
);
int
keylen
=
EVP_CIPHER_CTX_key_length
(
&
context
);
int
iv_length
=
EVP_CIPHER_CTX_iv_length
(
&
context
);
LL_DEBUGS
()
<<
"LLBlowfishCipher blocksize "
<<
blocksize
<<
" keylen "
<<
keylen
<<
" iv_len "
<<
iv_length
<<
LL_ENDL
;
int
out_len
=
0
;
int
tmp_len
=
0
;
if
(
!
EVP_DecryptUpdate
(
&
context
,
dst
,
&
out_len
,
src
,
src_len
))
{
LL_WARNS
()
<<
"LLBlowfishCipher::decrypt EVP_DecryptUpdate failure"
<<
LL_ENDL
;
goto
ERROR
;
}
if
(
!
EVP_DecryptFinal_ex
(
&
context
,
dst
+
out_len
,
&
tmp_len
))
{
LL_WARNS
()
<<
"LLBlowfishCipher::decrypt EVP_DecryptFinal failure"
<<
LL_ENDL
;
goto
ERROR
;
}
out_len
+=
tmp_len
;
EVP_CIPHER_CTX_cleanup
(
&
context
);
return
out_len
;
ERROR
:
EVP_CIPHER_CTX_cleanup
(
&
context
);
return
0
;
}
...
...
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