diff options
author | Jeffrey Walton <noloader@gmail.com> | 2019-01-16 00:02:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-16 00:02:04 -0500 |
commit | df9fa62205f2d341e2b1b26595a3a1b6377c60c5 (patch) | |
tree | d4b2b34861e76a9c7c7ec1d0b0e6fe4faf25c3d6 /gf2n.h | |
parent | 982655845a784a9a4cfbc92221359a25a74184a3 (diff) | |
download | cryptopp-git-df9fa62205f2d341e2b1b26595a3a1b6377c60c5.tar.gz |
Use carryless multiplies for NIST b233 and k233 curves (GH #783, PR #784)
Use carryless multiplies for NIST b233 and k233 curves.
Diffstat (limited to 'gf2n.h')
-rw-r--r-- | gf2n.h | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -246,6 +246,7 @@ public: private:
friend class GF2NT;
+ friend class GF2NT233;
SecWordBlock reg;
};
@@ -344,13 +345,29 @@ public: const Element& MultiplicativeInverse(const Element &a) const;
-private:
+protected:
const Element& Reduced(const Element &a) const;
unsigned int t0, t1;
mutable PolynomialMod2 result;
};
+/// \brief GF(2^n) for b233 and k233
+/// \details GF2NT233 is a specialization of GF2NT that provides Multiply()
+/// and Square() operations when carryless multiplies is available.
+class CRYPTOPP_DLL GF2NT233 : public GF2NT
+{
+public:
+ // polynomial modulus = x^t0 + x^t1 + x^t2, t0 > t1 > t2
+ GF2NT233(unsigned int t0, unsigned int t1, unsigned int t2);
+
+ GF2NP * Clone() const {return new GF2NT233(*this);}
+
+ const Element& Multiply(const Element &a, const Element &b) const;
+
+ const Element& Square(const Element &a) const;
+};
+
/// \brief GF(2^n) with Pentanomial Basis
class CRYPTOPP_DLL GF2NPP : public GF2NP
{
|