Botan 3.13.0
Crypto and TLS for C&
curve_gfp.h
Go to the documentation of this file.
1/*
2* Elliptic curves over GF(p)
3*
4* (C) 2007 Martin Doering, Christoph Ludwig, Falko Strenzke
5* 2010-2011,2012,2014,2024 Jack Lloyd
6*
7* Botan is released under the Simplified BSD License (see license.txt)
8*/
9
10#ifndef BOTAN_GFP_CURVE_H_
11#define BOTAN_GFP_CURVE_H_
12
13// TODO(Botan4) delete this header
14
15#include <botan/bigint.h>
16
17// Currently exposed in EC_Point
18//BOTAN_FUTURE_INTERNAL_HEADER(curve_gfp.h)
19
20namespace Botan {
21
22class EC_Group_Data;
23
24/**
25* This is an internal type which is only exposed for accidental
26* historical reasons. Do not use it in any way.
27*
28* This class will be removed in Botan4.
29*/
31 public:
32 /**
33 * Get the a parameter of the elliptic curve equation
34 * @return curve coefficient a
35 */
36 const BigInt& get_a() const;
37
38 /**
39 * Get the b parameter of the elliptic curve equation
40 * @return curve coefficient b
41 */
42 const BigInt& get_b() const;
43
44 /**
45 * Get prime modulus of the field of the curve
46 * @return prime modulus of the field of the curve
47 */
48 const BigInt& get_p() const;
49
50 /**
51 * Get the size of the field prime in words
52 * @return number of words needed to represent the prime modulus
53 */
54 size_t get_p_words() const;
55
56 /**
57 * Copy constructor
58 */
59 CurveGFp(const CurveGFp&) = default;
60
61 /**
62 * Move constructor
63 */
64 CurveGFp(CurveGFp&&) = default;
65
66 ~CurveGFp() = default;
67
68 private:
69 friend class EC_Point;
70 friend class EC_Group_Data;
71
72 /**
73 * Create an uninitialized CurveGFp
74 */
75 CurveGFp() = default;
76
78
79 CurveGFp& operator=(const CurveGFp&) = default;
80 CurveGFp& operator=(CurveGFp&&) = default;
81
82 void swap(CurveGFp& other) noexcept { std::swap(m_group, other.m_group); }
83
84 bool operator==(const CurveGFp& other) const { return (m_group == other.m_group); }
85
86 private:
87 const EC_Group_Data& group() const;
88
89 /**
90 * Raw pointer
91 *
92 * This EC_Group_Data is not owned because instead the EC_Group_Data
93 * owns this CurveGFp, so we can always access it safely. If it was
94 * a shared_ptr this would cause a reference cycle.
95 */
96 const EC_Group_Data* m_group = nullptr;
97};
98
99} // namespace Botan
100
101#endif
#define BOTAN_UNSTABLE_API
Definition api.h:34
#define BOTAN_FUTURE_EXPLICIT
Definition api.h:52
CurveGFp(const CurveGFp &)=default
CurveGFp(CurveGFp &&)=default
~CurveGFp()=default
friend class EC_Group_Data
Definition curve_gfp.h:70
const BigInt & get_a() const
Definition ec_point.cpp:37
size_t get_p_words() const
Definition ec_point.cpp:49
friend class EC_Point
Definition curve_gfp.h:69
const BigInt & get_p() const
Definition ec_point.cpp:45
const BigInt & get_b() const
Definition ec_point.cpp:41
bool operator==(const AlgorithmIdentifier &x, const AlgorithmIdentifier &y)
Definition alg_id.cpp:54