aboutsummaryrefslogtreecommitdiff
path: root/src/common/Cryptography
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-03-19 17:18:01 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-24 00:37:21 +0100
commitea0aa63d96cac461dd0b473437f1143898d3c3b5 (patch)
tree036839443a9df03bdce5df5f55ecd449ba8daf94 /src/common/Cryptography
parent632609b897c7268bd18997633019dde98dd2e6d6 (diff)
Core/Misc: C++17 cleanups, commit 2, the advstd commit
(cherry picked from commit 857f8d9231d148d4f2def9c83548b40059923029)
Diffstat (limited to 'src/common/Cryptography')
-rw-r--r--src/common/Cryptography/ARC4.h5
-rw-r--r--src/common/Cryptography/BigNumber.h3
-rw-r--r--src/common/Cryptography/CryptoGenerics.h4
-rw-r--r--src/common/Cryptography/CryptoRandom.h3
-rw-r--r--src/common/Cryptography/SessionKeyGenerator.h5
5 files changed, 8 insertions, 12 deletions
diff --git a/src/common/Cryptography/ARC4.h b/src/common/Cryptography/ARC4.h
index 2adfba919ec..8d5b89787e9 100644
--- a/src/common/Cryptography/ARC4.h
+++ b/src/common/Cryptography/ARC4.h
@@ -21,7 +21,6 @@
#include "Define.h"
#include <array>
#include <openssl/evp.h>
-#include "advstd.h" // data/size
namespace Trinity
{
@@ -35,11 +34,11 @@ namespace Crypto
void Init(uint8 const* seed, size_t len);
template <typename Container>
- void Init(Container const& c) { Init(advstd::data(c), advstd::size(c)); }
+ void Init(Container const& c) { Init(std::data(c), std::size(c)); }
void UpdateData(uint8* data, size_t len);
template <typename Container>
- void UpdateData(Container& c) { UpdateData(advstd::data(c), advstd::size(c)); }
+ void UpdateData(Container& c) { UpdateData(std::data(c), std::size(c)); }
private:
EVP_CIPHER_CTX* _ctx;
};
diff --git a/src/common/Cryptography/BigNumber.h b/src/common/Cryptography/BigNumber.h
index 7f68ee76444..e61a8073c31 100644
--- a/src/common/Cryptography/BigNumber.h
+++ b/src/common/Cryptography/BigNumber.h
@@ -23,7 +23,6 @@
#include <memory>
#include <string>
#include <vector>
-#include "advstd.h" // data/size
struct bignum_st;
@@ -45,7 +44,7 @@ class TC_COMMON_API BigNumber
void SetQword(uint64);
void SetBinary(uint8 const* bytes, int32 len, bool littleEndian = true);
template <typename Container>
- auto SetBinary(Container const& c, bool littleEndian = true) -> std::enable_if_t<!advstd::is_pointer_v<std::decay_t<Container>>> { SetBinary(advstd::data(c), advstd::size(c), littleEndian); }
+ auto SetBinary(Container const& c, bool littleEndian = true) -> std::enable_if_t<!std::is_pointer_v<std::decay_t<Container>>> { SetBinary(std::data(c), std::size(c), littleEndian); }
bool SetHexStr(char const* str);
bool SetHexStr(std::string const& str) { return SetHexStr(str.c_str()); }
diff --git a/src/common/Cryptography/CryptoGenerics.h b/src/common/Cryptography/CryptoGenerics.h
index b845f3be974..affa11bf79d 100644
--- a/src/common/Cryptography/CryptoGenerics.h
+++ b/src/common/Cryptography/CryptoGenerics.h
@@ -48,8 +48,8 @@ namespace Impl
template <typename Container>
static void SplitFromBack(std::vector<uint8>& data, Container& tail)
{
- ASSERT(data.size() >= advstd::size(tail));
- for (size_t i = 1, N = advstd::size(tail); i <= N; ++i)
+ ASSERT(data.size() >= std::size(tail));
+ for (size_t i = 1, N = std::size(tail); i <= N; ++i)
{
tail[N - i] = data.back();
data.pop_back();
diff --git a/src/common/Cryptography/CryptoRandom.h b/src/common/Cryptography/CryptoRandom.h
index da8498a1fa4..67abf684788 100644
--- a/src/common/Cryptography/CryptoRandom.h
+++ b/src/common/Cryptography/CryptoRandom.h
@@ -20,7 +20,6 @@
#include "Define.h"
#include <array>
-#include "advstd.h"
namespace Trinity
{
@@ -31,7 +30,7 @@ namespace Crypto
template <typename Container>
void GetRandomBytes(Container& c)
{
- GetRandomBytes(advstd::data(c), advstd::size(c));
+ GetRandomBytes(std::data(c), std::size(c));
}
template <size_t S>
diff --git a/src/common/Cryptography/SessionKeyGenerator.h b/src/common/Cryptography/SessionKeyGenerator.h
index 5e9471b7746..1ff20d6312e 100644
--- a/src/common/Cryptography/SessionKeyGenerator.h
+++ b/src/common/Cryptography/SessionKeyGenerator.h
@@ -20,7 +20,6 @@
#include "CryptoHash.h"
#include <cstring>
-#include "advstd.h" // for data/size
template <typename Hash>
class SessionKeyGenerator
@@ -30,8 +29,8 @@ class SessionKeyGenerator
SessionKeyGenerator(C const& buf) :
o0it(o0.begin())
{
- uint8 const* data = advstd::data(buf);
- size_t const len = advstd::size(buf);
+ uint8 const* data = std::data(buf);
+ size_t const len = std::size(buf);
size_t const halflen = (len / 2);
o1 = Hash::GetDigestOf(data, halflen);