Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. #ifndef CRYPTOPP_MODEXPPC_H
  2. #define CRYPTOPP_MODEXPPC_H
  3. #include "cryptlib.h"
  4. #include "modarith.h"
  5. #include "integer.h"
  6. #include "eprecomp.h"
  7. #include "smartptr.h"
  8. #include "pubkey.h"
  9. NAMESPACE_BEGIN(CryptoPP)
  10. CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
  11. class ModExpPrecomputation : public DL_GroupPrecomputation<Integer>
  12. {
  13. public:
  14. // DL_GroupPrecomputation
  15. bool NeedConversions() const {return true;}
  16. Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);}
  17. virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);}
  18. const AbstractGroup<Element> & GetGroup() const {return m_mr->MultiplicativeGroup();}
  19. Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
  20. void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
  21. // non-inherited
  22. void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));}
  23. const Integer & GetModulus() const {return m_mr->GetModulus();}
  24. private:
  25. value_ptr<MontgomeryRepresentation> m_mr;
  26. };
  27. NAMESPACE_END
  28. #endif