@@ -43,8 +43,6 @@ static std::uniform_int_distribution<int> rand_byte{ 0, std::numeric_limits<uint
43
43
static std::uniform_int_distribution<uint8_t > rand_byte;
44
44
#endif
45
45
46
- #define DHT_AES_LEGACY_DECRYPT 1
47
-
48
46
namespace dht {
49
47
namespace crypto {
50
48
@@ -130,21 +128,7 @@ Blob aesDecrypt(const uint8_t* data, size_t data_length, const Blob& key)
130
128
gcm_aes_digest (&aes, GCM_DIGEST_SIZE, digest.data ());
131
129
132
130
if (not std::equal (digest.begin (), digest.end (), data + data_length - GCM_DIGEST_SIZE)) {
133
- #if DHT_AES_LEGACY_DECRYPT
134
- // gcm_aes_decrypt(&aes, data_sz, ret.data(), data + GCM_IV_SIZE);
135
- Blob ret_tmp (data_sz);
136
- struct gcm_aes_ctx aes_d;
137
- gcm_aes_set_key (&aes_d, key.size (), key.data ());
138
- gcm_aes_set_iv (&aes_d, GCM_IV_SIZE, data);
139
- gcm_aes_update (&aes_d, ret.size (), ret.data ());
140
- gcm_aes_encrypt (&aes_d, ret.size (), ret_tmp.data (), ret.data ());
141
- gcm_aes_digest (&aes_d, GCM_DIGEST_SIZE, digest.data ());
142
-
143
- if (not std::equal (digest.begin (), digest.end (), data + data_length - GCM_DIGEST_SIZE))
144
- throw DecryptError (" Can't decrypt data" );
145
- #else
146
131
throw DecryptError (" Can't decrypt data" );
147
- #endif
148
132
}
149
133
150
134
return ret;
0 commit comments