00001
00002
00003
00004
00005
00006 #ifndef CRYPTOPP_SEAL_H
00007 #define CRYPTOPP_SEAL_H
00008
00009 #include "strciphr.h"
00010 #include "secblock.h"
00011
00012 NAMESPACE_BEGIN(CryptoPP)
00013
00014
00015 template <class B = BigEndian>
00016 struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
00017 {
00018 static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
00019 };
00020
00021 template <class B = BigEndian>
00022 class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
00023 {
00024 protected:
00025 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
00026 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
00027 void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
00028 bool CipherIsRandomAccess() const {return true;}
00029 void SeekToIteration(lword iterationCount);
00030
00031 private:
00032 FixedSizeSecBlock<word32, 512> m_T;
00033 FixedSizeSecBlock<word32, 256> m_S;
00034 SecBlock<word32> m_R;
00035
00036 word32 m_startCount, m_iterationsPerCount;
00037 word32 m_outsideCounter, m_insideCounter;
00038 };
00039
00040
00041 template <class B = BigEndian>
00042 struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation
00043 {
00044 typedef SymmetricCipherFinal<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> >, SEAL_Info<B> > Encryption;
00045 typedef Encryption Decryption;
00046 };
00047
00048 NAMESPACE_END
00049
00050 #endif