summaryrefslogtreecommitdiffstats
path: root/cryptopp562/des.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
committerMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
commit512aa4c77b3dc0d72db713a9215ff65a98a99ec3 (patch)
tree6db82e0109dc987b5b021f81d4e8a0926eb75ff7 /cryptopp562/des.h
parent428471d39fb8c205a9fad899c88c30a2cb7df685 (diff)
parent10affea371406c0ae4c080e5a19390a8e9bd154b (diff)
downloadcompass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.tar.gz
compass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.zip
Merge branch 'mbedtls'
Replace Crypto++ 5.6.2 with Mbed TLS 3.6.0 Newer compilers are starting to show the age of the crypto library we've been using, as it is sometimes a pain to recompile compass lately. So, the tracked version of Crypto++ was at least due for an upgrade. However, I plan to soon begin reimplementing compass in C. So, I'm taking this opportunity to first just migrate the cryptography library to a newer C alternative. This branch does so, and integrates its use into the current C++ version of compass. * mbedtls: Remove unnecessary exception handler catch block Refactor random password generation to use mbedtls entropy source Refactor SHA256 function to use mbedtls Refactor AES functions to use mbedtls Add Mbedtls library Remove Crypto++ library
Diffstat (limited to 'cryptopp562/des.h')
-rw-r--r--cryptopp562/des.h144
1 files changed, 0 insertions, 144 deletions
diff --git a/cryptopp562/des.h b/cryptopp562/des.h
deleted file mode 100644
index 62f6288..0000000
--- a/cryptopp562/des.h
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef CRYPTOPP_DES_H
-#define CRYPTOPP_DES_H
-
-/** \file
-*/
-
-#include "seckey.h"
-#include "secblock.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-class CRYPTOPP_DLL RawDES
-{
-public:
- void RawSetKey(CipherDir direction, const byte *userKey);
- void RawProcessBlock(word32 &l, word32 &r) const;
-
-protected:
- static const word32 Spbox[8][64];
-
- FixedSizeSecBlock<word32, 32> k;
-};
-
-//! _
-struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8>
-{
- // disable DES in DLL version by not exporting this function
- static const char * StaticAlgorithmName() {return "DES";}
-};
-
-/// <a href="http://www.weidai.com/scan-mirror/cs.html#DES">DES</a>
-/*! The DES implementation in Crypto++ ignores the parity bits
- (the least significant bits of each byte) in the key. However
- you can use CheckKeyParityBits() and CorrectKeyParityBits() to
- check or correct the parity bits if you wish. */
-class DES : public DES_Info, public BlockCipherDocumentation
-{
- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_Info>, public RawDES
- {
- public:
- void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
- };
-
-public:
- //! check DES key parity bits
- static bool CheckKeyParityBits(const byte *key);
- //! correct DES key parity bits
- static void CorrectKeyParityBits(byte *key);
-
- typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
- typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
-};
-
-//! _
-struct DES_EDE2_Info : public FixedBlockSize<8>, public FixedKeyLength<16>
-{
- CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "DES-EDE2";}
-};
-
-/// <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE2</a>
-class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation
-{
- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_EDE2_Info>
- {
- public:
- void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-
- protected:
- RawDES m_des1, m_des2;
- };
-
-public:
- typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
- typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
-};
-
-//! _
-struct DES_EDE3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
-{
- CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "DES-EDE3";}
-};
-
-/// <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE3</a>
-class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation
-{
- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_EDE3_Info>
- {
- public:
- void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-
- protected:
- RawDES m_des1, m_des2, m_des3;
- };
-
-public:
- typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
- typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
-};
-
-//! _
-struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
-{
- static const char *StaticAlgorithmName() {return "DES-XEX3";}
-};
-
-/// <a href="http://www.weidai.com/scan-mirror/cs.html#DESX">DES-XEX3</a>, AKA DESX
-class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation
-{
- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_XEX3_Info>
- {
- public:
- void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
- void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-
- protected:
- FixedSizeSecBlock<byte, BLOCKSIZE> m_x1, m_x3;
- // VS2005 workaround: calling modules compiled with /clr gets unresolved external symbol DES::Base::ProcessAndXorBlock
- // if we use DES::Encryption here directly without value_ptr.
- value_ptr<DES::Encryption> m_des;
- };
-
-public:
- typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
- typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
-};
-
-typedef DES::Encryption DESEncryption;
-typedef DES::Decryption DESDecryption;
-
-typedef DES_EDE2::Encryption DES_EDE2_Encryption;
-typedef DES_EDE2::Decryption DES_EDE2_Decryption;
-
-typedef DES_EDE3::Encryption DES_EDE3_Encryption;
-typedef DES_EDE3::Decryption DES_EDE3_Decryption;
-
-typedef DES_XEX3::Encryption DES_XEX3_Encryption;
-typedef DES_XEX3::Decryption DES_XEX3_Decryption;
-
-NAMESPACE_END
-
-#endif