mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
LibCrypto: Implement GCM mode
This commit is contained in:
parent
2cc867bcba
commit
d3c52cef86
6 changed files with 657 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <LibCrypto/Cipher/Cipher.h>
|
||||
#include <LibCrypto/Cipher/Mode/CBC.h>
|
||||
#include <LibCrypto/Cipher/Mode/CTR.h>
|
||||
#include <LibCrypto/Cipher/Mode/GCM.h>
|
||||
|
||||
namespace Crypto {
|
||||
namespace Cipher {
|
||||
|
@ -53,6 +54,7 @@ public:
|
|||
|
||||
virtual ByteBuffer get() const override { return m_data; };
|
||||
virtual const ByteBuffer& data() const override { return m_data; };
|
||||
ReadonlyBytes bytes() const { return m_data; }
|
||||
|
||||
virtual void overwrite(ReadonlyBytes) override;
|
||||
virtual void overwrite(const ByteBuffer& buffer) override { overwrite(buffer.bytes()); }
|
||||
|
@ -113,6 +115,7 @@ class AESCipher final : public Cipher<AESCipherKey, AESCipherBlock> {
|
|||
public:
|
||||
using CBCMode = CBC<AESCipher>;
|
||||
using CTRMode = CTR<AESCipher>;
|
||||
using GCMMode = GCM<AESCipher>;
|
||||
|
||||
constexpr static size_t BlockSizeInBits = BlockType::BlockSizeInBits;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue