Botan 3.6.0
Crypto and TLS for C&
Botan::EC_Group_Data Class Referencefinal

#include <ec_inner_data.h>

Inheritance diagram for Botan::EC_Group_Data:

Public Member Functions

const BigInta () const
 
bool a_is_minus_3 () const
 
bool a_is_zero () const
 
const BigIntb () const
 
const EC_Pointbase_point () const
 
const BigIntcofactor () const
 
const CurveGFpcurve () const
 
const std::vector< uint8_t > & der_named_curve () const
 
 EC_Group_Data (const BigInt &p, const BigInt &a, const BigInt &b, const BigInt &g_x, const BigInt &g_y, const BigInt &order, const BigInt &cofactor, const OID &oid, EC_Group_Source source)
 
const BigIntg_x () const
 
const BigIntg_y () const
 
std::unique_ptr< EC_Scalar_Datagk_x_mod_order (const EC_Scalar_Data &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const
 
bool has_cofactor () const
 
BigInt inverse_mod_order (const BigInt &x) const
 
std::unique_ptr< EC_Mul2Table_Datamake_mul2_table (const EC_AffinePoint_Data &pt) const
 
BigInt mod_order (const BigInt &x) const
 
BigInt multiply_mod_order (const BigInt &x, const BigInt &y) const
 
BigInt multiply_mod_order (const BigInt &x, const BigInt &y, const BigInt &z) const
 
const OIDoid () const
 
const BigIntorder () const
 
size_t order_bits () const
 
size_t order_bytes () const
 
bool order_is_less_than_p () const
 
const BigIntp () const
 
size_t p_bits () const
 
size_t p_bytes () const
 
bool params_match (const BigInt &p, const BigInt &a, const BigInt &b, const BigInt &g_x, const BigInt &g_y, const BigInt &order, const BigInt &cofactor) const
 
bool params_match (const EC_Group_Data &other) const
 
const PCurve::PrimeOrderCurvepcurve () const
 
std::unique_ptr< EC_AffinePoint_Datapoint_deserialize (std::span< const uint8_t > bytes) const
 
std::unique_ptr< EC_AffinePoint_Datapoint_g_mul (const EC_Scalar_Data &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const
 
std::unique_ptr< EC_AffinePoint_Datapoint_hash_to_curve_nu (std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep) const
 
std::unique_ptr< EC_AffinePoint_Datapoint_hash_to_curve_ro (std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep) const
 
std::unique_ptr< EC_Scalar_Datascalar_deserialize (std::span< const uint8_t > bytes) const
 
std::unique_ptr< EC_Scalar_Datascalar_from_bigint (const BigInt &bn) const
 
std::unique_ptr< EC_Scalar_Datascalar_from_bytes_mod_order (std::span< const uint8_t > bytes) const
 
std::unique_ptr< EC_Scalar_Datascalar_from_bytes_with_trunc (std::span< const uint8_t > bytes) const
 
std::unique_ptr< EC_Scalar_Datascalar_one () const
 
std::unique_ptr< EC_Scalar_Datascalar_random (RandomNumberGenerator &rng) const
 
std::unique_ptr< EC_Scalar_Datascalar_zero () const
 
void set_oid (const OID &oid)
 
EC_Group_Source source () const
 
BigInt square_mod_order (const BigInt &x) const
 
 ~EC_Group_Data ()
 

Detailed Description

Definition at line 114 of file ec_inner_data.h.

Constructor & Destructor Documentation

◆ EC_Group_Data()

Botan::EC_Group_Data::EC_Group_Data ( const BigInt & p,
const BigInt & a,
const BigInt & b,
const BigInt & g_x,
const BigInt & g_y,
const BigInt & order,
const BigInt & cofactor,
const OID & oid,
EC_Group_Source source )

Definition at line 19 of file ec_inner_data.cpp.

27 :
28 m_curve(p, a, b),
29 m_base_point(m_curve, g_x, g_y),
30 m_g_x(g_x),
31 m_g_y(g_y),
32 m_order(order),
33 m_cofactor(cofactor),
34 m_mod_order(order),
35 m_oid(oid),
36 m_p_bits(p.bits()),
37 m_order_bits(order.bits()),
38 m_order_bytes((m_order_bits + 7) / 8),
39 m_a_is_minus_3(a == p - 3),
40 m_a_is_zero(a.is_zero()),
41 m_has_cofactor(m_cofactor != 1),
42 m_order_is_less_than_p(m_order < p),
43 m_source(source) {
44 if(!m_oid.empty()) {
45 DER_Encoder der(m_der_named_curve);
46 der.encode(m_oid);
47
48 if(const auto id = PCurve::PrimeOrderCurveId::from_oid(m_oid)) {
50 // still possibly null, if the curve is supported in general but not
51 // available in the build
52 }
53 }
54
55 if(!m_pcurve) {
56 m_base_mult = std::make_unique<EC_Point_Base_Point_Precompute>(m_base_point, m_mod_order);
57 }
58}
size_t bits() const
Definition bigint.cpp:295
bool is_zero() const
Definition bigint.h:458
const BigInt & p() const
const BigInt & g_x() const
const BigInt & a() const
const OID & oid() const
const BigInt & cofactor() const
EC_Group_Source source() const
const BigInt & g_y() const
const BigInt & b() const
const BigInt & order() const
bool empty() const
Definition asn1_obj.h:266
static std::shared_ptr< const PrimeOrderCurve > from_id(PrimeOrderCurveId id)
Definition pcurves.cpp:101

References Botan::OID::empty().

◆ ~EC_Group_Data()

Botan::EC_Group_Data::~EC_Group_Data ( )
default

Member Function Documentation

◆ a()

const BigInt & Botan::EC_Group_Data::a ( ) const
inline

Definition at line 146 of file ec_inner_data.h.

146{ return m_curve.get_a(); }
const BigInt & get_a() const
Definition curve_gfp.h:98

References Botan::CurveGFp::get_a().

Referenced by params_match().

◆ a_is_minus_3()

bool Botan::EC_Group_Data::a_is_minus_3 ( ) const
inline

Definition at line 174 of file ec_inner_data.h.

174{ return m_a_is_minus_3; }

◆ a_is_zero()

bool Botan::EC_Group_Data::a_is_zero ( ) const
inline

Definition at line 176 of file ec_inner_data.h.

176{ return m_a_is_zero; }

◆ b()

const BigInt & Botan::EC_Group_Data::b ( ) const
inline

Definition at line 148 of file ec_inner_data.h.

148{ return m_curve.get_b(); }
const BigInt & get_b() const
Definition curve_gfp.h:103

References Botan::CurveGFp::get_b().

Referenced by params_match().

◆ base_point()

const EC_Point & Botan::EC_Group_Data::base_point ( ) const
inline

Definition at line 172 of file ec_inner_data.h.

172{ return m_base_point; }

◆ cofactor()

const BigInt & Botan::EC_Group_Data::cofactor ( ) const
inline

Definition at line 152 of file ec_inner_data.h.

152{ return m_cofactor; }

Referenced by params_match().

◆ curve()

const CurveGFp & Botan::EC_Group_Data::curve ( ) const
inline

Definition at line 170 of file ec_inner_data.h.

170{ return m_curve; }

◆ der_named_curve()

const std::vector< uint8_t > & Botan::EC_Group_Data::der_named_curve ( ) const
inline

Definition at line 142 of file ec_inner_data.h.

142{ return m_der_named_curve; }

◆ g_x()

const BigInt & Botan::EC_Group_Data::g_x ( ) const
inline

Definition at line 158 of file ec_inner_data.h.

158{ return m_g_x; }

Referenced by params_match().

◆ g_y()

const BigInt & Botan::EC_Group_Data::g_y ( ) const
inline

Definition at line 160 of file ec_inner_data.h.

160{ return m_g_y; }

Referenced by params_match().

◆ gk_x_mod_order()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::gk_x_mod_order ( const EC_Scalar_Data & scalar,
RandomNumberGenerator & rng,
std::vector< BigInt > & ws ) const

Definition at line 167 of file ec_inner_data.cpp.

169 {
170 if(m_pcurve) {
171 const auto& k = EC_Scalar_Data_PC::checked_ref(scalar);
172 auto gk_x_mod_order = m_pcurve->base_point_mul_x_mod_order(k.value(), rng);
173 return std::make_unique<EC_Scalar_Data_PC>(shared_from_this(), gk_x_mod_order);
174 } else {
175 const auto& k = EC_Scalar_Data_BN::checked_ref(scalar);
176 BOTAN_STATE_CHECK(m_base_mult != nullptr);
177 const auto pt = m_base_mult->mul(k.value(), rng, m_order, ws);
178
179 if(pt.is_zero()) {
180 return scalar_zero();
181 } else {
182 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(), mod_order(pt.get_affine_x()));
183 }
184 }
185}
#define BOTAN_STATE_CHECK(expr)
Definition assert.h:41
std::unique_ptr< EC_Scalar_Data > gk_x_mod_order(const EC_Scalar_Data &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const
std::unique_ptr< EC_Scalar_Data > scalar_zero() const
BigInt mod_order(const BigInt &x) const
static const EC_Scalar_Data_BN & checked_ref(const EC_Scalar_Data &data)
static const EC_Scalar_Data_PC & checked_ref(const EC_Scalar_Data &data)

References BOTAN_STATE_CHECK.

◆ has_cofactor()

bool Botan::EC_Group_Data::has_cofactor ( ) const
inline

Definition at line 156 of file ec_inner_data.h.

156{ return m_has_cofactor; }

◆ inverse_mod_order()

BigInt Botan::EC_Group_Data::inverse_mod_order ( const BigInt & x) const
inline

Definition at line 188 of file ec_inner_data.h.

188{ return inverse_mod(x, m_order); }
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
Definition mod_inv.cpp:179

References Botan::inverse_mod().

◆ make_mul2_table()

std::unique_ptr< EC_Mul2Table_Data > Botan::EC_Group_Data::make_mul2_table ( const EC_AffinePoint_Data & pt) const

Definition at line 265 of file ec_inner_data.cpp.

265 {
266 if(m_pcurve) {
267 EC_AffinePoint_Data_PC g(shared_from_this(), m_pcurve->generator());
268 return std::make_unique<EC_Mul2Table_Data_PC>(g, h);
269 } else {
270 EC_AffinePoint_Data_BN g(shared_from_this(), this->base_point());
271 return std::make_unique<EC_Mul2Table_Data_BN>(g, h);
272 }
273}
const EC_Point & base_point() const

◆ mod_order()

BigInt Botan::EC_Group_Data::mod_order ( const BigInt & x) const
inline

Definition at line 178 of file ec_inner_data.h.

178{ return m_mod_order.reduce(x); }
BigInt reduce(const BigInt &x) const
Definition reducer.cpp:37

References Botan::Modular_Reducer::reduce().

◆ multiply_mod_order() [1/2]

BigInt Botan::EC_Group_Data::multiply_mod_order ( const BigInt & x,
const BigInt & y ) const
inline

Definition at line 182 of file ec_inner_data.h.

182{ return m_mod_order.multiply(x, y); }
BigInt multiply(const BigInt &x, const BigInt &y) const
Definition reducer.h:32

References Botan::Modular_Reducer::multiply().

◆ multiply_mod_order() [2/2]

BigInt Botan::EC_Group_Data::multiply_mod_order ( const BigInt & x,
const BigInt & y,
const BigInt & z ) const
inline

Definition at line 184 of file ec_inner_data.h.

184 {
185 return m_mod_order.multiply(m_mod_order.multiply(x, y), z);
186 }

References Botan::Modular_Reducer::multiply().

◆ oid()

const OID & Botan::EC_Group_Data::oid ( ) const
inline

Definition at line 140 of file ec_inner_data.h.

140{ return m_oid; }

◆ order()

const BigInt & Botan::EC_Group_Data::order ( ) const
inline

Definition at line 150 of file ec_inner_data.h.

150{ return m_order; }

Referenced by params_match().

◆ order_bits()

size_t Botan::EC_Group_Data::order_bits ( ) const
inline

Definition at line 166 of file ec_inner_data.h.

166{ return m_order_bits; }

◆ order_bytes()

size_t Botan::EC_Group_Data::order_bytes ( ) const
inline

Definition at line 168 of file ec_inner_data.h.

168{ return m_order_bytes; }

◆ order_is_less_than_p()

bool Botan::EC_Group_Data::order_is_less_than_p ( ) const
inline

Definition at line 154 of file ec_inner_data.h.

154{ return m_order_is_less_than_p; }

◆ p()

const BigInt & Botan::EC_Group_Data::p ( ) const
inline

Definition at line 144 of file ec_inner_data.h.

144{ return m_curve.get_p(); }
const BigInt & get_p() const
Definition curve_gfp.h:109

References Botan::CurveGFp::get_p().

Referenced by params_match().

◆ p_bits()

size_t Botan::EC_Group_Data::p_bits ( ) const
inline

Definition at line 162 of file ec_inner_data.h.

162{ return m_p_bits; }

◆ p_bytes()

size_t Botan::EC_Group_Data::p_bytes ( ) const
inline

Definition at line 164 of file ec_inner_data.h.

164{ return (m_p_bits + 7) / 8; }

◆ params_match() [1/2]

bool Botan::EC_Group_Data::params_match ( const BigInt & p,
const BigInt & a,
const BigInt & b,
const BigInt & g_x,
const BigInt & g_y,
const BigInt & order,
const BigInt & cofactor ) const

Definition at line 60 of file ec_inner_data.cpp.

66 {
67 return (this->p() == p && this->a() == a && this->b() == b && this->order() == order &&
68 this->cofactor() == cofactor && this->g_x() == g_x && this->g_y() == g_y);
69}

References Botan::b.

◆ params_match() [2/2]

bool Botan::EC_Group_Data::params_match ( const EC_Group_Data & other) const

Definition at line 71 of file ec_inner_data.cpp.

71 {
72 return params_match(other.p(), other.a(), other.b(), other.g_x(), other.g_y(), other.order(), other.cofactor());
73}
bool params_match(const BigInt &p, const BigInt &a, const BigInt &b, const BigInt &g_x, const BigInt &g_y, const BigInt &order, const BigInt &cofactor) const

References a(), b(), cofactor(), g_x(), g_y(), order(), and p().

◆ pcurve()

const PCurve::PrimeOrderCurve & Botan::EC_Group_Data::pcurve ( ) const
inline

Definition at line 251 of file ec_inner_data.h.

251 {
252 BOTAN_ASSERT_NONNULL(m_pcurve);
253 return *m_pcurve;
254 }
#define BOTAN_ASSERT_NONNULL(ptr)
Definition assert.h:86

References BOTAN_ASSERT_NONNULL.

◆ point_deserialize()

std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_deserialize ( std::span< const uint8_t > bytes) const

Deserialize a point

Returns nullptr if the point encoding was invalid or not on the curve

Definition at line 209 of file ec_inner_data.cpp.

209 {
210 try {
211 if(m_pcurve) {
212 if(auto pt = m_pcurve->deserialize_point(bytes)) {
213 return std::make_unique<EC_AffinePoint_Data_PC>(shared_from_this(), std::move(*pt));
214 } else {
215 return nullptr;
216 }
217 } else {
218 auto pt = Botan::OS2ECP(bytes.data(), bytes.size(), curve());
219 return std::make_unique<EC_AffinePoint_Data_BN>(shared_from_this(), std::move(pt));
220 }
221 } catch(...) {
222 return nullptr;
223 }
224}
const CurveGFp & curve() const
EC_Point OS2ECP(const uint8_t data[], size_t data_len, const CurveGFp &curve)
Definition ec_point.cpp:648

References Botan::OS2ECP().

◆ point_g_mul()

std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_g_mul ( const EC_Scalar_Data & scalar,
RandomNumberGenerator & rng,
std::vector< BigInt > & ws ) const

Definition at line 248 of file ec_inner_data.cpp.

250 {
251 if(m_pcurve) {
252 const auto& k = EC_Scalar_Data_PC::checked_ref(scalar);
253 auto pt = m_pcurve->mul_by_g(k.value(), rng).to_affine();
254 return std::make_unique<EC_AffinePoint_Data_PC>(shared_from_this(), std::move(pt));
255 } else {
256 const auto& group = scalar.group();
257 const auto& bn = EC_Scalar_Data_BN::checked_ref(scalar);
258
259 BOTAN_STATE_CHECK(group->m_base_mult != nullptr);
260 auto pt = group->m_base_mult->mul(bn.value(), rng, m_order, ws);
261 return std::make_unique<EC_AffinePoint_Data_BN>(shared_from_this(), std::move(pt));
262 }
263}

References BOTAN_STATE_CHECK, and Botan::EC_Scalar_Data::group().

◆ point_hash_to_curve_nu()

std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_hash_to_curve_nu ( std::string_view hash_fn,
std::span< const uint8_t > input,
std::span< const uint8_t > domain_sep ) const

Definition at line 237 of file ec_inner_data.cpp.

239 {
240 if(m_pcurve) {
241 auto pt = m_pcurve->hash_to_curve_nu(hash_fn, input, domain_sep);
242 return std::make_unique<EC_AffinePoint_Data_PC>(shared_from_this(), std::move(pt));
243 } else {
244 throw Not_Implemented("Hash to curve is not implemented for this curve");
245 }
246}

◆ point_hash_to_curve_ro()

std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_hash_to_curve_ro ( std::string_view hash_fn,
std::span< const uint8_t > input,
std::span< const uint8_t > domain_sep ) const

Definition at line 226 of file ec_inner_data.cpp.

228 {
229 if(m_pcurve) {
230 auto pt = m_pcurve->hash_to_curve_ro(hash_fn, input, domain_sep);
231 return std::make_unique<EC_AffinePoint_Data_PC>(shared_from_this(), pt.to_affine());
232 } else {
233 throw Not_Implemented("Hash to curve is not implemented for this curve");
234 }
235}

◆ scalar_deserialize()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_deserialize ( std::span< const uint8_t > bytes) const

Scalar from bytes

This returns a value only if the bytes represent (in big-endian encoding) an integer that is less than n, where n is the group order. It requires that the fixed length encoding (with zero prefix) be used. It also rejects inputs that encode zero. Thus the accepted range is [1,n)

If the input is rejected then nullptr is returned

Definition at line 187 of file ec_inner_data.cpp.

187 {
188 if(bytes.size() != m_order_bytes) {
189 return nullptr;
190 }
191
192 if(m_pcurve) {
193 if(auto s = m_pcurve->deserialize_scalar(bytes)) {
194 return std::make_unique<EC_Scalar_Data_PC>(shared_from_this(), *s);
195 } else {
196 return nullptr;
197 }
198 } else {
199 BigInt r(bytes);
200
201 if(r.is_zero() || r >= m_order) {
202 return nullptr;
203 }
204
205 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(), std::move(r));
206 }
207}

References Botan::BigInt::is_zero().

◆ scalar_from_bigint()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_from_bigint ( const BigInt & bn) const

Scalar from BigInt

This returns a value only if bn is in [1,n) where n is the group order. Otherwise it returns nullptr

Definition at line 155 of file ec_inner_data.cpp.

155 {
156 if(bn <= 0 || bn >= m_order) {
157 return {};
158 }
159
160 if(m_pcurve) {
161 return this->scalar_deserialize(bn.serialize(m_order_bytes));
162 } else {
163 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(), bn);
164 }
165}
std::unique_ptr< EC_Scalar_Data > scalar_deserialize(std::span< const uint8_t > bytes) const

References Botan::BigInt::serialize().

◆ scalar_from_bytes_mod_order()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_from_bytes_mod_order ( std::span< const uint8_t > bytes) const

Scalar from bytes with modular reduction

This returns a value only if bytes represents (in big-endian encoding) an integer that is at most the square of the scalar group size. Otherwise it returns nullptr.

Definition at line 114 of file ec_inner_data.cpp.

114 {
115 if(bytes.size() >= 2 * order_bytes()) {
116 return {};
117 }
118
119 if(m_pcurve) {
120 if(auto s = m_pcurve->scalar_from_wide_bytes(bytes)) {
121 return std::make_unique<EC_Scalar_Data_PC>(shared_from_this(), std::move(*s));
122 } else {
123 return {};
124 }
125 } else {
126 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(), mod_order(BigInt(bytes)));
127 }
128}
size_t order_bytes() const

◆ scalar_from_bytes_with_trunc()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_from_bytes_with_trunc ( std::span< const uint8_t > bytes) const

Scalar from bytes with ECDSA style trunction

This should always succeed

Definition at line 84 of file ec_inner_data.cpp.

84 {
85 const size_t bit_length = 8 * bytes.size();
86
87 if(bit_length < order_bits()) {
88 // No shifting required, but might still need to reduce by modulus
89 return this->scalar_from_bytes_mod_order(bytes);
90 } else {
91 const size_t shift = bit_length - order_bits();
92
93 const size_t new_length = bytes.size() - (shift / 8);
94 const size_t bit_shift = shift % 8;
95
96 if(bit_shift == 0) {
97 // Easy case just read different bytes
98 return this->scalar_from_bytes_mod_order(bytes.first(new_length));
99 } else {
100 std::vector<uint8_t> sbytes(new_length);
101
102 uint8_t carry = 0;
103 for(size_t i = 0; i != new_length; ++i) {
104 const uint8_t w = bytes[i];
105 sbytes[i] = (w >> bit_shift) | carry;
106 carry = w << (8 - bit_shift);
107 }
108
109 return this->scalar_from_bytes_mod_order(sbytes);
110 }
111 }
112}
std::unique_ptr< EC_Scalar_Data > scalar_from_bytes_mod_order(std::span< const uint8_t > bytes) const
size_t order_bits() const
void carry(int64_t &h0, int64_t &h1)

References Botan::carry().

◆ scalar_one()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_one ( ) const

Definition at line 147 of file ec_inner_data.cpp.

147 {
148 if(m_pcurve) {
149 return std::make_unique<EC_Scalar_Data_PC>(shared_from_this(), m_pcurve->scalar_one());
150 } else {
151 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(), BigInt::one());
152 }
153}
static BigInt one()
Definition bigint.h:55

◆ scalar_random()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_random ( RandomNumberGenerator & rng) const

Return a random scalar

This will be in the range [1,n) where n is the group order

Definition at line 130 of file ec_inner_data.cpp.

130 {
131 if(m_pcurve) {
132 return std::make_unique<EC_Scalar_Data_PC>(shared_from_this(), m_pcurve->random_scalar(rng));
133 } else {
134 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(),
135 BigInt::random_integer(rng, BigInt::one(), m_order));
136 }
137}
static BigInt random_integer(RandomNumberGenerator &rng, const BigInt &min, const BigInt &max)
Definition big_rand.cpp:43

◆ scalar_zero()

std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_zero ( ) const

Definition at line 139 of file ec_inner_data.cpp.

139 {
140 if(m_pcurve) {
141 return std::make_unique<EC_Scalar_Data_PC>(shared_from_this(), m_pcurve->scalar_zero());
142 } else {
143 return std::make_unique<EC_Scalar_Data_BN>(shared_from_this(), BigInt::zero());
144 }
145}
static BigInt zero()
Definition bigint.h:50

◆ set_oid()

void Botan::EC_Group_Data::set_oid ( const OID & oid)

Definition at line 75 of file ec_inner_data.cpp.

75 {
76 BOTAN_ARG_CHECK(!oid.empty(), "OID should be set");
77 BOTAN_STATE_CHECK(m_oid.empty() && m_der_named_curve.empty());
78 m_oid = oid;
79
80 DER_Encoder der(m_der_named_curve);
81 der.encode(m_oid);
82}
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:29

References BOTAN_ARG_CHECK, BOTAN_STATE_CHECK, Botan::OID::empty(), and Botan::DER_Encoder::encode().

◆ source()

EC_Group_Source Botan::EC_Group_Data::source ( ) const
inline

Definition at line 190 of file ec_inner_data.h.

190{ return m_source; }

◆ square_mod_order()

BigInt Botan::EC_Group_Data::square_mod_order ( const BigInt & x) const
inline

Definition at line 180 of file ec_inner_data.h.

180{ return m_mod_order.square(x); }
BigInt square(const BigInt &x) const
Definition reducer.h:45

References Botan::Modular_Reducer::square().


The documentation for this class was generated from the following files: