summaryrefslogtreecommitdiffstats
path: root/cryptopp562/eprecomp.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
committerMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
commit512aa4c77b3dc0d72db713a9215ff65a98a99ec3 (patch)
tree6db82e0109dc987b5b021f81d4e8a0926eb75ff7 /cryptopp562/eprecomp.h
parent428471d39fb8c205a9fad899c88c30a2cb7df685 (diff)
parent10affea371406c0ae4c080e5a19390a8e9bd154b (diff)
downloadcompass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.tar.gz
compass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.zip
Merge branch 'mbedtls'
Replace Crypto++ 5.6.2 with Mbed TLS 3.6.0 Newer compilers are starting to show the age of the crypto library we've been using, as it is sometimes a pain to recompile compass lately. So, the tracked version of Crypto++ was at least due for an upgrade. However, I plan to soon begin reimplementing compass in C. So, I'm taking this opportunity to first just migrate the cryptography library to a newer C alternative. This branch does so, and integrates its use into the current C++ version of compass. * mbedtls: Remove unnecessary exception handler catch block Refactor random password generation to use mbedtls entropy source Refactor SHA256 function to use mbedtls Refactor AES functions to use mbedtls Add Mbedtls library Remove Crypto++ library
Diffstat (limited to '')
-rw-r--r--cryptopp562/eprecomp.h75
1 files changed, 0 insertions, 75 deletions
diff --git a/cryptopp562/eprecomp.h b/cryptopp562/eprecomp.h
deleted file mode 100644
index 1f32567..0000000
--- a/cryptopp562/eprecomp.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef CRYPTOPP_EPRECOMP_H
-#define CRYPTOPP_EPRECOMP_H
-
-#include "integer.h"
-#include "algebra.h"
-#include <vector>
-
-NAMESPACE_BEGIN(CryptoPP)
-
-template <class T>
-class DL_GroupPrecomputation
-{
-public:
- typedef T Element;
-
- virtual bool NeedConversions() const {return false;}
- virtual Element ConvertIn(const Element &v) const {return v;}
- virtual Element ConvertOut(const Element &v) const {return v;}
- virtual const AbstractGroup<Element> & GetGroup() const =0;
- virtual Element BERDecodeElement(BufferedTransformation &bt) const =0;
- virtual void DEREncodeElement(BufferedTransformation &bt, const Element &P) const =0;
-};
-
-template <class T>
-class DL_FixedBasePrecomputation
-{
-public:
- typedef T Element;
-
- virtual bool IsInitialized() const =0;
- virtual void SetBase(const DL_GroupPrecomputation<Element> &group, const Element &base) =0;
- virtual const Element & GetBase(const DL_GroupPrecomputation<Element> &group) const =0;
- virtual void Precompute(const DL_GroupPrecomputation<Element> &group, unsigned int maxExpBits, unsigned int storage) =0;
- virtual void Load(const DL_GroupPrecomputation<Element> &group, BufferedTransformation &storedPrecomputation) =0;
- virtual void Save(const DL_GroupPrecomputation<Element> &group, BufferedTransformation &storedPrecomputation) const =0;
- virtual Element Exponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent) const =0;
- virtual Element CascadeExponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent, const DL_FixedBasePrecomputation<Element> &pc2, const Integer &exponent2) const =0;
-};
-
-template <class T>
-class DL_FixedBasePrecomputationImpl : public DL_FixedBasePrecomputation<T>
-{
-public:
- typedef T Element;
-
- DL_FixedBasePrecomputationImpl() : m_windowSize(0) {}
-
- // DL_FixedBasePrecomputation
- bool IsInitialized() const
- {return !m_bases.empty();}
- void SetBase(const DL_GroupPrecomputation<Element> &group, const Element &base);
- const Element & GetBase(const DL_GroupPrecomputation<Element> &group) const
- {return group.NeedConversions() ? m_base : m_bases[0];}
- void Precompute(const DL_GroupPrecomputation<Element> &group, unsigned int maxExpBits, unsigned int storage);
- void Load(const DL_GroupPrecomputation<Element> &group, BufferedTransformation &storedPrecomputation);
- void Save(const DL_GroupPrecomputation<Element> &group, BufferedTransformation &storedPrecomputation) const;
- Element Exponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent) const;
- Element CascadeExponentiate(const DL_GroupPrecomputation<Element> &group, const Integer &exponent, const DL_FixedBasePrecomputation<Element> &pc2, const Integer &exponent2) const;
-
-private:
- void PrepareCascade(const DL_GroupPrecomputation<Element> &group, std::vector<BaseAndExponent<Element> > &eb, const Integer &exponent) const;
-
- Element m_base;
- unsigned int m_windowSize;
- Integer m_exponentBase; // what base to represent the exponent in
- std::vector<Element> m_bases; // precalculated bases
-};
-
-NAMESPACE_END
-
-#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
-#include "eprecomp.cpp"
-#endif
-
-#endif