mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 04:07:49 +02:00
invert expanded key schedule for decryption
This commit is contained in:
parent
0408371a84
commit
4ef971f63c
2 changed files with 54 additions and 12 deletions
24
aes.h
24
aes.h
|
@ -18,16 +18,30 @@ namespace crypto
|
|||
#ifdef __x86_64__
|
||||
// AES-NI assumed
|
||||
class ECBCryptoAESNI
|
||||
{
|
||||
protected:
|
||||
|
||||
void ExpandKey (const uint8_t * key);
|
||||
|
||||
protected:
|
||||
|
||||
uint32_t m_KeySchedule[4*(14+1)]; // 14 rounds for AES-256
|
||||
};
|
||||
|
||||
class ECBEncryptionAESNI: public ECBCryptoAESNI
|
||||
{
|
||||
public:
|
||||
|
||||
void SetKey (const uint8_t * key) { ExpandKey (key); };
|
||||
void Encrypt (const ChipherBlock * in, ChipherBlock * out);
|
||||
};
|
||||
|
||||
class ECBDecryptionAESNI: public ECBCryptoAESNI
|
||||
{
|
||||
public:
|
||||
|
||||
void SetKey (const uint8_t * key);
|
||||
void Encrypt (const ChipherBlock * in, ChipherBlock * out);
|
||||
void Decrypt (const ChipherBlock * in, ChipherBlock * out);
|
||||
|
||||
private:
|
||||
|
||||
uint32_t m_KeySchedule[4*(14+1)]; // 14 rounds for AES-256
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue