summaryrefslogtreecommitdiff
path: root/des.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-07-10 04:34:23 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-07-10 04:34:23 +0000
commit5fa8124f5156963e798f5cffa812cb9910e4e8de (patch)
treece43a3a2973d29a78e6b401f7a4a367e914f5490 /des.h
parent3edbf2eff4cb3bc989ba1c442358de0bedbdf90c (diff)
downloadcryptopp-5fa8124f5156963e798f5cffa812cb9910e4e8de.tar.gz
merge in 5.0.4 changes (exclude DES and SHA-2 from DLL),
attempt (failed) to build DLL with GCC git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@90 57ff6487-cd31-0410-9ec3-f628ee90f5f0
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: