-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- speed up GCM key setup - wipe stack in AES assembly code - speed up CFB mode
- Loading branch information
Showing
29 changed files
with
1,560 additions
and
795 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
AlgorithmType: AuthenticatedSymmetricCipher | ||
Name: AES/EAX | ||
Source: http:https://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf | ||
Plaintext: | ||
Key: 233952DEE4D5ED5F9B9C6D6FF80FF478 | ||
IV: 62EC67F9C3A4A407FCB2A8C49031A8B3 | ||
Header: 6BFB914FD07EAE6B | ||
Ciphertext: E037830E8389F27B025A2D6527E79D01 | ||
Test: Encrypt | ||
Plaintext: F7FB | ||
Key: 91945D3F4DCBEE0BF45EF52255F095A4 | ||
IV: BECAF043B0A23D843194BA972C66DEBD | ||
Header: FA3BFD4806EB53FA | ||
Ciphertext: 19DD5C4C9331049D0BDAB0277408F67967E5 | ||
Test: Encrypt | ||
Plaintext: 1A47CB4933 | ||
Key: 01F74AD64077F2E704C0F60ADA3DD523 | ||
IV: 70C3DB4F0D26368400A10ED05D2BFF5E | ||
Header: 234A3463C1264AC6 | ||
Ciphertext: D851D5BAE03A59F238A23E39199DC9266626C40F80 | ||
Test: Encrypt | ||
Plaintext: 481C9E39B1 | ||
Key: D07CF6CBB7F313BDDE66B727AFD3C5E8 | ||
IV: 8408DFFF3C1A2B1292DC199E46B7D617 | ||
Header: 33CCE2EABFF5A79D | ||
Ciphertext: 632A9D131AD4C168A4225D8E1FF755939974A7BEDE | ||
Test: Encrypt | ||
Plaintext: 40D0C07DA5E4 | ||
Key: 35B6D0580005BBC12B0587124557D2C2 | ||
IV: FDB6B06676EEDC5C61D74276E1F8E816 | ||
Header: AEB96EAEBE2970E9 | ||
Ciphertext: 071DFE16C675CB0677E536F73AFE6A14B74EE49844DD | ||
Test: Encrypt | ||
Plaintext: 4DE3B35C3FC039245BD1FB7D | ||
Key: BD8E6E11475E60B268784C38C62FEB22 | ||
IV: 6EAC5C93072D8E8513F750935E46DA1B | ||
Header: D4482D1CA78DCE0F | ||
Ciphertext: 835BB4F15D743E350E728414ABB8644FD6CCB86947C5E10590210A4F | ||
Test: Encrypt | ||
Plaintext: 8B0A79306C9CE7ED99DAE4F87F8DD61636 | ||
Key: 7C77D6E813BED5AC98BAA417477A2E7D | ||
IV: 1A8C98DCD73D38393B2BF1569DEEFC19 | ||
Header: 65D2017990D62528 | ||
Ciphertext: 02083E3979DA014812F59F11D52630DA30137327D10649B0AA6E1C181DB617D7F2 | ||
Test: Encrypt | ||
Plaintext: 1BDA122BCE8A8DBAF1877D962B8592DD2D56 | ||
Key: 5FFF20CAFAB119CA2FC73549E20F5B0D | ||
IV: DDE59B97D722156D4D9AFF2BC7559826 | ||
Header: 54B9F04E6A09189A | ||
Ciphertext: 2EC47B2C4954A489AFC7BA4897EDCDAE8CC33B60450599BD02C96382902AEF7F832A | ||
Test: Encrypt | ||
Plaintext: 6CF36720872B8513F6EAB1A8A44438D5EF11 | ||
Key: A4A4782BCFFD3EC5E7EF6D8C34A56123 | ||
IV: B781FCF2F75FA5A8DE97A9CA48E522EC | ||
Header: 899A175897561D7E | ||
Ciphertext: 0DE18FD0FDD91E7AF19F1D8EE8733938B1E8E7F6D2231618102FDB7FE55FF1991700 | ||
Test: Encrypt | ||
Plaintext: CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7 | ||
Key: 8395FCF1E95BEBD697BD010BC766AAC3 | ||
IV: 22E7ADD93CFC6393C57EC0B3C17D6B44 | ||
Header: 126735FCC320D25A | ||
Ciphertext: CB8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E | ||
Test: Encrypt | ||
Plaintext: CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7 | ||
Key: 8395FCF1E95BEBD697BD010BC766AAC3 | ||
IV: 22E7ADD93CFC6393C57EC0B3C17D6B44 | ||
Header: 126735FCC320D25A | ||
Ciphertext: CB8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E | ||
Test: Encrypt | ||
Plaintext: CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7 | ||
Key: 8395FCF1E95BEBD697BD010BC766AAC3 | ||
IV: 22E7ADD93CFC6393C57EC0B3C17D6B44 | ||
Header: 126735FCC320D25A | ||
Ciphertext: 0B8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E | ||
Test: NotVerify |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,52 @@ | ||
#ifndef CRYPTOPP_CMAC_H | ||
#define CRYPTOPP_CMAC_H | ||
|
||
#include "seckey.h" | ||
#include "secblock.h" | ||
|
||
NAMESPACE_BEGIN(CryptoPP) | ||
|
||
//! _ | ||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CMAC_Base : public MessageAuthenticationCode | ||
{ | ||
public: | ||
CMAC_Base() {} | ||
|
||
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); | ||
void Update(const byte *input, size_t length); | ||
void TruncatedFinal(byte *mac, size_t size); | ||
unsigned int DigestSize() const {return const_cast<CMAC_Base*>(this)->AccessCipher().BlockSize();} | ||
|
||
protected: | ||
virtual BlockCipher & AccessCipher() =0; | ||
|
||
private: | ||
void ProcessBuf(); | ||
SecByteBlock m_reg; | ||
unsigned int m_counter; | ||
}; | ||
|
||
/// <a href="http:https://www.cryptolounge.org/wiki/CMAC">CMAC</a> | ||
/*! Template parameter T should be a class derived from BlockCipherDocumentation, for example AES, with a block size of 8, 16, or 32 */ | ||
template <class T> | ||
class CMAC : public MessageAuthenticationCodeImpl<CMAC_Base, CMAC<T> >, public SameKeyLengthAs<T> | ||
{ | ||
public: | ||
CMAC() {} | ||
CMAC(const byte *key, size_t length=SameKeyLengthAs<T>::DEFAULT_KEYLENGTH) | ||
{this->SetKey(key, length);} | ||
|
||
static std::string StaticAlgorithmName() {return std::string("CMAC(") + T::StaticAlgorithmName() + ")";} | ||
|
||
private: | ||
BlockCipher & AccessCipher() {return m_cipher;} | ||
typename T::Encryption m_cipher; | ||
}; | ||
|
||
NAMESPACE_END | ||
|
||
#endif | ||
#ifndef CRYPTOPP_CMAC_H | ||
#define CRYPTOPP_CMAC_H | ||
|
||
#include "seckey.h" | ||
#include "secblock.h" | ||
|
||
NAMESPACE_BEGIN(CryptoPP) | ||
|
||
//! _ | ||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CMAC_Base : public MessageAuthenticationCode | ||
{ | ||
public: | ||
CMAC_Base() {} | ||
|
||
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); | ||
void Update(const byte *input, size_t length); | ||
void TruncatedFinal(byte *mac, size_t size); | ||
unsigned int DigestSize() const {return GetCipher().BlockSize();} | ||
unsigned int OptimalBlockSize() const {return GetCipher().BlockSize();} | ||
unsigned int OptimalDataAlignment() const {return GetCipher().OptimalDataAlignment();} | ||
|
||
protected: | ||
friend class EAX_Base; | ||
|
||
const BlockCipher & GetCipher() const {return const_cast<CMAC_Base*>(this)->AccessCipher();} | ||
virtual BlockCipher & AccessCipher() =0; | ||
|
||
void ProcessBuf(); | ||
SecByteBlock m_reg; | ||
unsigned int m_counter; | ||
}; | ||
|
||
/// <a href="http:https://www.cryptolounge.org/wiki/CMAC">CMAC</a> | ||
/*! Template parameter T should be a class derived from BlockCipherDocumentation, for example AES, with a block size of 8, 16, or 32 */ | ||
template <class T> | ||
class CMAC : public MessageAuthenticationCodeImpl<CMAC_Base, CMAC<T> >, public SameKeyLengthAs<T> | ||
{ | ||
public: | ||
CMAC() {} | ||
CMAC(const byte *key, size_t length=SameKeyLengthAs<T>::DEFAULT_KEYLENGTH) | ||
{this->SetKey(key, length);} | ||
|
||
static std::string StaticAlgorithmName() {return std::string("CMAC(") + T::StaticAlgorithmName() + ")";} | ||
|
||
private: | ||
BlockCipher & AccessCipher() {return m_cipher;} | ||
typename T::Encryption m_cipher; | ||
}; | ||
|
||
NAMESPACE_END | ||
|
||
#endif |
Oops, something went wrong.