Botan 3.7.1
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 * @return curve coefficient a
34 */
35 const BigInt& get_a() const;
36
37 /**
38 * @return curve coefficient b
39 */
40 const BigInt& get_b() const;
41
42 /**
43 * Get prime modulus of the field of the curve
44 * @return prime modulus of the field of the curve
45 */
46 const BigInt& get_p() const;
47
48 size_t get_p_words() const;
49
50 CurveGFp(const CurveGFp&) = default;
51
52 private:
53 friend class EC_Point;
54 friend class EC_Group_Data;
55
56 /**
57 * Create an uninitialized CurveGFp
58 */
59 CurveGFp() = default;
60
61 CurveGFp(const EC_Group_Data* group);
62
63 CurveGFp& operator=(const CurveGFp&) = default;
64
65 void swap(CurveGFp& other) { std::swap(m_group, other.m_group); }
66
67 bool operator==(const CurveGFp& other) const { return (m_group == other.m_group); }
68
69 private:
70 const EC_Group_Data& group() const {
71 BOTAN_ASSERT_NONNULL(m_group);
72 return *m_group;
73 }
74
75 /**
76 * Raw pointer
77 *
78 * This EC_Group_Data is not owned because instead the EC_Group_Data
79 * owns this CurveGFp, so we can always access it safely. If it was
80 * a shared_ptr this would cause a reference cycle.
81 */
82 const EC_Group_Data* m_group = nullptr;
83};
84
85} // namespace Botan
86
87#endif
#define BOTAN_UNSTABLE_API
Definition api.h:32
#define BOTAN_ASSERT_NONNULL(ptr)
Definition assert.h:86
CurveGFp(const CurveGFp &)=default
int(* final)(unsigned char *, CTX *)
bool operator==(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
Definition alg_id.cpp:54