File indexing completed on 2025-01-18 09:55:08
0001
0002
0003
0004
0005
0006
0007 #ifndef CRYPTOPP_SEAL_H
0008 #define CRYPTOPP_SEAL_H
0009
0010 #include "strciphr.h"
0011 #include "secblock.h"
0012
0013 NAMESPACE_BEGIN(CryptoPP)
0014
0015
0016
0017
0018 template <class B = BigEndian>
0019 struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
0020 {
0021 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
0022 };
0023
0024
0025
0026
0027 template <class B = BigEndian>
0028 class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
0029 {
0030 protected:
0031 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
0032 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
0033 void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
0034 bool CipherIsRandomAccess() const {return true;}
0035 void SeekToIteration(lword iterationCount);
0036
0037 private:
0038 FixedSizeSecBlock<word32, 512> m_T;
0039 FixedSizeSecBlock<word32, 256> m_S;
0040 SecBlock<word32> m_R;
0041
0042 word32 m_startCount, m_iterationsPerCount;
0043 word32 m_outsideCounter, m_insideCounter;
0044 };
0045
0046
0047
0048
0049
0050 template <class B = BigEndian>
0051 struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation
0052 {
0053 typedef SymmetricCipherFinal<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> >, SEAL_Info<B> > Encryption;
0054 typedef Encryption Decryption;
0055 };
0056
0057 NAMESPACE_END
0058
0059 #endif