diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2020-07-26 01:53:34 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-26 01:53:34 +0200 | 
| commit | 210176fd915cf4ba16f428d3c1a249a71f4aa7a7 (patch) | |
| tree | 6998a19da1330be8679fe3e760f858915494400b /src/common/Cryptography/AES.h | |
| parent | cdaf890af4b5bb7ce256752b49bba2c0f3ed9264 (diff) | |
Core/Authserver: Authserver cleanup (PR#25093)
- Fix a handful of 1/256 bugs with most significant byte zero in BigNumber
- Get rid of (most of) the C-style arrays in authserver
- CryptoRandom as a unified source for cryptographic randomness
- Bring our other crypto APIs into 2020
- BigNumber usability improvements
- Authserver is now actually readable as a result of all of the above
Diffstat (limited to 'src/common/Cryptography/AES.h')
| -rw-r--r-- | src/common/Cryptography/AES.h | 39 | 
1 files changed, 18 insertions, 21 deletions
diff --git a/src/common/Cryptography/AES.h b/src/common/Cryptography/AES.h index d0ff2114b02..ca997030077 100644 --- a/src/common/Cryptography/AES.h +++ b/src/common/Cryptography/AES.h @@ -22,33 +22,30 @@  #include <array>  #include <openssl/evp.h> -namespace Trinity +namespace Trinity::Crypto  { -namespace Crypto -{ -class TC_COMMON_API AES -{ -public: -    static constexpr std::size_t IV_SIZE_BYTES = 12; -    static constexpr std::size_t KEY_SIZE_BYTES = 16; -    static constexpr std::size_t TAG_SIZE_BYTES = 12; +    class TC_COMMON_API AES +    { +    public: +        static constexpr size_t IV_SIZE_BYTES = 12; +        static constexpr size_t KEY_SIZE_BYTES = 16; +        static constexpr size_t TAG_SIZE_BYTES = 12; -    using IV = std::array<uint8, IV_SIZE_BYTES>; -    using Key = std::array<uint8, KEY_SIZE_BYTES>; -    using Tag = uint8[TAG_SIZE_BYTES]; +        using IV = std::array<uint8, IV_SIZE_BYTES>; +        using Key = std::array<uint8, KEY_SIZE_BYTES>; +        using Tag = uint8[TAG_SIZE_BYTES]; -    AES(bool encrypting); -    ~AES(); +        AES(bool encrypting); +        ~AES(); -    void Init(Key const& key); +        void Init(Key const& key); -    bool Process(IV const& iv, uint8* data, std::size_t length, Tag& tag); +        bool Process(IV const& iv, uint8* data, size_t length, Tag& tag); -private: -    EVP_CIPHER_CTX* _ctx; -    bool _encrypting; -}; -} +    private: +        EVP_CIPHER_CTX* _ctx; +        bool _encrypting; +    };  }  #endif // Trinity_AES_h__  | 
