Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
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
savoirfairelinux
opendht
Commits
acde8fa6
Commit
acde8fa6
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
crypto: remove legacy decrypt
parent
c8b56113
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crypto.cpp
+0
-16
0 additions, 16 deletions
src/crypto.cpp
with
0 additions
and
16 deletions
src/crypto.cpp
+
0
−
16
View file @
acde8fa6
...
@@ -43,8 +43,6 @@ static std::uniform_int_distribution<int> rand_byte{ 0, std::numeric_limits<uint
...
@@ -43,8 +43,6 @@ static std::uniform_int_distribution<int> rand_byte{ 0, std::numeric_limits<uint
static
std
::
uniform_int_distribution
<
uint8_t
>
rand_byte
;
static
std
::
uniform_int_distribution
<
uint8_t
>
rand_byte
;
#endif
#endif
#define DHT_AES_LEGACY_DECRYPT 1
namespace
dht
{
namespace
dht
{
namespace
crypto
{
namespace
crypto
{
...
@@ -130,21 +128,7 @@ Blob aesDecrypt(const uint8_t* data, size_t data_length, const Blob& key)
...
@@ -130,21 +128,7 @@ Blob aesDecrypt(const uint8_t* data, size_t data_length, const Blob& key)
gcm_aes_digest
(
&
aes
,
GCM_DIGEST_SIZE
,
digest
.
data
());
gcm_aes_digest
(
&
aes
,
GCM_DIGEST_SIZE
,
digest
.
data
());
if
(
not
std
::
equal
(
digest
.
begin
(),
digest
.
end
(),
data
+
data_length
-
GCM_DIGEST_SIZE
))
{
if
(
not
std
::
equal
(
digest
.
begin
(),
digest
.
end
(),
data
+
data_length
-
GCM_DIGEST_SIZE
))
{
#if DHT_AES_LEGACY_DECRYPT
//gcm_aes_decrypt(&aes, data_sz, ret.data(), data + GCM_IV_SIZE);
Blob
ret_tmp
(
data_sz
);
struct
gcm_aes_ctx
aes_d
;
gcm_aes_set_key
(
&
aes_d
,
key
.
size
(),
key
.
data
());
gcm_aes_set_iv
(
&
aes_d
,
GCM_IV_SIZE
,
data
);
gcm_aes_update
(
&
aes_d
,
ret
.
size
(),
ret
.
data
());
gcm_aes_encrypt
(
&
aes_d
,
ret
.
size
(),
ret_tmp
.
data
(),
ret
.
data
());
gcm_aes_digest
(
&
aes_d
,
GCM_DIGEST_SIZE
,
digest
.
data
());
if
(
not
std
::
equal
(
digest
.
begin
(),
digest
.
end
(),
data
+
data_length
-
GCM_DIGEST_SIZE
))
throw
DecryptError
(
"Can't decrypt data"
);
#else
throw
DecryptError
(
"Can't decrypt data"
);
throw
DecryptError
(
"Can't decrypt data"
);
#endif
}
}
return
ret
;
return
ret
;
...
...
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