summaryrefslogtreecommitdiff
path: root/des.h
diff options
context:
space:
mode:
Diffstat (limited to 'des.h')
-rw-r--r--des.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/des.h b/des.h
index a6c5672..e39b161 100644
--- a/des.h
+++ b/des.h
@@ -9,9 +9,22 @@
NAMESPACE_BEGIN(CryptoPP)
+class CRYPTOPP_DLL RawDES
+{
+public:
+ void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length = 8);
+ 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>
{
- CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "DES";}
+ // 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>
@@ -21,19 +34,10 @@ struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8>
check or correct the parity bits if you wish. */
class DES : public DES_Info, public BlockCipherDocumentation
{
- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_Info>
+ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_Info>, public RawDES
{
public:
- void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length = 8);
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
-
- // exposed for faster Triple-DES
- void RawProcessBlock(word32 &l, word32 &r) const;
-
- protected:
- static const word32 Spbox[8][64];
-
- FixedSizeSecBlock<word32, 32> k;
};
public:
@@ -61,7 +65,7 @@ class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
protected:
- DES::Encryption m_des1, m_des2;
+ RawDES m_des1, m_des2;
};
public:
@@ -84,7 +88,7 @@ class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
protected:
- DES::Encryption m_des1, m_des2, m_des3;
+ RawDES m_des1, m_des2, m_des3;
};
public: