|
Botan 3.14.1
Crypto and TLS for C&
|
#include <bls12_381.h>
Public Member Functions | |
| G2Projective | add (const G2Projective &other) const |
| G2Projective | add_mixed (const G2Affine &other) const |
| G2Projective () | |
| bool | is_identity () const |
| G2Projective | mul (const Scalar &scalar) const |
| G2Projective | negate () const |
| G2Affine | to_affine () const |
Static Public Member Functions | |
| static G2Projective | _unchecked_from_affine_coords (const FieldElement2 &x, const FieldElement2 &y) |
| static G2Projective | from_affine (const G2Affine &affine) |
| static G2Projective | generator () |
| static G2Projective | hash_to_curve_nu (std::span< const uint8_t > input, std::span< const uint8_t > dst) |
| static G2Projective | hash_to_curve_ro (std::span< const uint8_t > input, std::span< const uint8_t > dst) |
| static G2Projective | identity () |
| static G2Projective | msm_vartime (std::span< const G2Affine > points, std::span< const Scalar > scalars) |
| static G2Projective | mul2 (const G2Projective &p, const Scalar &a, const G2Projective &q, const Scalar &b) |
| static G2Projective | mul2_vartime (const G2Projective &p, const Scalar &a, const G2Projective &q, const Scalar &b) |
| static std::vector< G2Affine > | to_affine_batch (std::span< const G2Projective > points) |
Friends | |
| class | G2Affine |
| template<typename Group> | |
| class | GroupOps |
| template<typename Pt> | |
| class | PointMul |
An element of the group G2, in projective form
Definition at line 453 of file bls12_381.h.
| Botan::BLS12_381::G2Projective::G2Projective | ( | ) |
Default constructed as the identity element
Definition at line 156 of file bls12_381_g2.cpp.
Referenced by _unchecked_from_affine_coords(), add(), add_mixed(), from_affine(), generator(), hash_to_curve_nu(), hash_to_curve_ro(), identity(), msm_vartime(), mul(), mul2(), mul2_vartime(), and negate().
|
static |
The input is assumed to be a point on the curve, though possibly outside the prime order subgroup.
Reserved for internal use, not covered by SemVer.
Definition at line 164 of file bls12_381_g2.cpp.
References G2Projective(), and Botan::BLS12_381::FieldElement2::one().
| G2Projective Botan::BLS12_381::G2Projective::add | ( | const G2Projective & | other | ) | const |
Return the sum of this point and other
Definition at line 198 of file bls12_381_g2.cpp.
References G2Projective().
| G2Projective Botan::BLS12_381::G2Projective::add_mixed | ( | const G2Affine & | other | ) | const |
Return the sum of this point and an affine point
Definition at line 202 of file bls12_381_g2.cpp.
References G2Affine, and G2Projective().
|
static |
Convert an affine point to projective form
Definition at line 159 of file bls12_381_g2.cpp.
References G2Affine, and G2Projective().
Referenced by Botan::BLS12_381::G2Affine::deserialize().
|
static |
Return the G2 standard group generator
Definition at line 169 of file bls12_381_g2.cpp.
References G2Projective(), and Botan::BLS12_381::FieldElement2::one().
|
static |
Nonuniform encoding to curve (RFC 9380 encode_to_curve), suite BLS12381G2_XMD:SHA-256_SSWU_NU_
Throws Invalid_Argument if dst is empty.
Definition at line 561 of file bls12_381_h2c.cpp.
References G2Projective(), Botan::CT::poison(), and Botan::CT::unpoison_all().
|
static |
Hash to curve (RFC 9380), suite BLS12381G2_XMD:SHA-256_SSWU_RO_
Throws Invalid_Argument if dst is empty.
Definition at line 538 of file bls12_381_h2c.cpp.
References G2Projective(), Botan::CT::poison(), and Botan::CT::unpoison_all().
|
inlinestatic |
Return the G2 identity element
Definition at line 464 of file bls12_381.h.
References G2Projective().
| bool Botan::BLS12_381::G2Projective::is_identity | ( | ) | const |
Check if this point is the identity element
Definition at line 190 of file bls12_381_g2.cpp.
References Botan::CT::all_zeros().
|
static |
Multiscalar multiplication, the sum of scalars[i]*points[i]
The empty sum is the identity element. Throws Invalid_Argument if the spans are of unequal length.
Warning: this function runs in variable time and must be used only with public inputs, such as signature verification. Use mul() with secret scalars.
Definition at line 228 of file bls12_381_g2.cpp.
References G2Projective(), and Botan::BLS12_381::PointMul< Pt >::msm_vartime().
| G2Projective Botan::BLS12_381::G2Projective::mul | ( | const Scalar & | scalar | ) | const |
Scalar multiplication
Constant time; safe for secret scalars
Definition at line 210 of file bls12_381_g2.cpp.
References G2Projective(), and Botan::BLS12_381::PointMul< Pt >::mul().
|
static |
Compute a*p + b*q in constant time
Faster than composing mul() and add(), and safe for secret scalars, as arise for example in Pedersen commitments.
Definition at line 215 of file bls12_381_g2.cpp.
References G2Projective(), and Botan::BLS12_381::PointMul< Pt >::mul2().
|
static |
Compute a*p + b*q
Warning: this function runs in variable time and must be used only with public inputs, such as signature verification. Use mul2() with secret scalars.
Definition at line 220 of file bls12_381_g2.cpp.
References G2Projective(), and Botan::BLS12_381::PointMul< Pt >::mul2_vartime().
| G2Projective Botan::BLS12_381::G2Projective::negate | ( | ) | const |
Return the negation of this point
Definition at line 182 of file bls12_381_g2.cpp.
References G2Projective().
| G2Affine Botan::BLS12_381::G2Projective::to_affine | ( | ) | const |
Convert to affine form, at the cost of a field inversion
Definition at line 173 of file bls12_381_g2.cpp.
References G2Affine.
|
static |
Convert a batch of points to affine
Equivalent to calling to_affine on each point, but much faster, since a single field inversion is shared across the batch.
Definition at line 178 of file bls12_381_g2.cpp.
|
friend |
Definition at line 572 of file bls12_381.h.
References G2Affine.
Referenced by add_mixed(), from_affine(), G2Affine, and to_affine().
|
friend |
|
friend |