diff --git a/serpent.cpp b/serpent.cpp index 88a7d19b..3f8b2751 100644 --- a/serpent.cpp +++ b/serpent.cpp @@ -52,7 +52,7 @@ typedef BlockGetAndPut Block; void Serpent::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { word32 a, b, c, d, e; - + Block::Get(inBlock)(a)(b)(c)(d); const word32 *k = m_key; @@ -84,14 +84,14 @@ void Serpent::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, while (true); afterS7(KX); - + Block::Put(xorBlock, outBlock)(d)(e)(b)(a); } void Serpent::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { word32 a, b, c, d, e; - + Block::Get(inBlock)(a)(b)(c)(d); const word32 *k = m_key + 96; @@ -108,17 +108,17 @@ void Serpent::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, k -= 32; beforeI7(ILT); start: - beforeI7(I7); afterI7(KX); - afterI7(ILT); afterI7(I6); afterI6(KX); - afterI6(ILT); afterI6(I5); afterI5(KX); - afterI5(ILT); afterI5(I4); afterI4(KX); - afterI4(ILT); afterI4(I3); afterI3(KX); - afterI3(ILT); afterI3(I2); afterI2(KX); - afterI2(ILT); afterI2(I1); afterI1(KX); + beforeI7(I7); afterI7(KX); + afterI7(ILT); afterI7(I6); afterI6(KX); + afterI6(ILT); afterI6(I5); afterI5(KX); + afterI5(ILT); afterI5(I4); afterI4(KX); + afterI4(ILT); afterI4(I3); afterI3(KX); + afterI3(ILT); afterI3(I2); afterI2(KX); + afterI2(ILT); afterI2(I1); afterI1(KX); afterI1(ILT); afterI1(I0); afterI0(KX); } while (--i != 0); - + Block::Put(xorBlock, outBlock)(a)(d)(b)(e); } diff --git a/serpent.h b/serpent.h index 64fd0e5c..888d70af 100644 --- a/serpent.h +++ b/serpent.h @@ -13,7 +13,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \class Serpent_Info //! \brief Serpent block cipher information -struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, public FixedRounds<32> +struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public FixedRounds<32> { static const char *StaticAlgorithmName() {return "Serpent";} };