12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifndef __BIPOINT_HPP
- #define __BIPOINT_HPP
- #include "PublicKey.hpp"
- #include "PrivateKey.hpp"
- #include "mydouble.h"
- extern "C" {
- #include "fpe.h"
- }
- #include "curvepoint_fp.h"
- extern "C" {
- #include "fp2e.h"
- }
- #include "twistpoint_fp2.h"
- /* It doesn't actually make sense to instantiate this generally;
- * we'll specify for each real type directly.
- * We still have to make something here, though, so it's empty. */
- template <typename T>
- class Bipoint
- {};
- template <>
- class Bipoint<curvepoint_fp_t>
- {
- public:
- Bipoint();
- Bipoint(curvepoint_fp_t p1, curvepoint_fp_t p2);
- void receive_encryption(const scalar_t& cleartext, const PublicKey& public_key);
- curvepoint_fp_t& operator[](int n);
- const curvepoint_fp_t& operator[](int n) const;
- Bipoint<curvepoint_fp_t> operator+(const Bipoint<curvepoint_fp_t>& b) const;
- Bipoint<curvepoint_fp_t> operator*(const scalar_t& mult) const;
- bool operator==(const Bipoint<curvepoint_fp_t>& b) const;
- Bipoint<curvepoint_fp_t> multBy2() const;
-
- private:
- curvepoint_fp_t point[2];
- };
- template <>
- class Bipoint<twistpoint_fp2_t>
- {
- public:
- Bipoint();
- Bipoint(twistpoint_fp2_t p1, twistpoint_fp2_t p2);
- receive_encryption(const scalar_t& cleartext, const PublicKey& public_key);
- twistpoint_fp2_t& operator[](int n);
- const twistpoint_fp2_t& operator[](int n) const;
- Bipoint<twistpoint_fp2_t> operator+(const Bipoint<twistpoint_fp2_t>& b) const;
- Bipoint<twistpoint_fp2_t> operator*(const scalar_t& mult) const;
- bool operator==(const Bipoint<twistpoint_fp2_t>& b) const;
- Bipoint<twistpoint_fp2_t> multBy2() const;
-
- private:
- twistpoint_fp2_t point[2];
- };
- #endif
|