aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/serpent/serpent.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/block/serpent/serpent.h')
-rw-r--r--src/lib/block/serpent/serpent.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/block/serpent/serpent.h b/src/lib/block/serpent/serpent.h
index b9864cf89..8f854678a 100644
--- a/src/lib/block/serpent/serpent.h
+++ b/src/lib/block/serpent/serpent.h
@@ -13,9 +13,10 @@
namespace Botan {
/**
-* Serpent, an AES finalist
+* Serpent is the most conservative of the AES finalists
+* http://www.cl.cam.ac.uk/~rja14/serpent.html
*/
-class BOTAN_DLL Serpent : public Block_Cipher_Fixed_Params<16, 16, 32, 8>
+class BOTAN_DLL Serpent final : public Block_Cipher_Fixed_Params<16, 16, 32, 8>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const override;
@@ -24,7 +25,22 @@ class BOTAN_DLL Serpent : public Block_Cipher_Fixed_Params<16, 16, 32, 8>
void clear() override;
std::string name() const override { return "Serpent"; }
BlockCipher* clone() const override { return new Serpent; }
+
+ size_t parallelism() const override { return 4; }
+
protected:
+#if defined(BOTAN_HAS_SERPENT_SIMD)
+ /**
+ * Encrypt 4 blocks in parallel using SSE2 or AltiVec
+ */
+ void simd_encrypt_4(const byte in[64], byte out[64]) const;
+
+ /**
+ * Decrypt 4 blocks in parallel using SSE2 or AltiVec
+ */
+ void simd_decrypt_4(const byte in[64], byte out[64]) const;
+#endif
+
/**
* For use by subclasses using SIMD, asm, etc
* @return const reference to the key schedule