Counter Strike : Global Offensive Source Code
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.

34 lines
1.0 KiB

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