mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
depends: update 'src/dashbls' to PastaPastaPasta/bls-signatures@30aa085b as 3ac26192
This commit is contained in:
commit
440a9dafba
@ -1,5 +1,5 @@
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([libdashbls],[1.3.4])
|
||||
AC_INIT([libdashbls],[1.3.3])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([build-aux/m4])
|
||||
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
GTElement Pair(const G2Element &b) const;
|
||||
uint32_t GetFingerprint(bool fLegacy = false) const;
|
||||
std::vector<uint8_t> Serialize(bool fLegacy = false) const;
|
||||
std::array<uint8_t, SIZE> SerializeToArray(bool fLegacy = false) const;
|
||||
G1Element Copy();
|
||||
|
||||
friend bool operator==(const G1Element &a, const G1Element &b);
|
||||
@ -102,6 +103,7 @@ public:
|
||||
G2Element Negate() const;
|
||||
GTElement Pair(const G1Element &a) const;
|
||||
std::vector<uint8_t> Serialize(bool fLegacy = false) const;
|
||||
std::array<uint8_t, G2Element::SIZE> SerializeToArray(bool fLegacy = false) const;
|
||||
G2Element Copy();
|
||||
|
||||
friend bool operator==(G2Element const &a, G2Element const &b);
|
||||
@ -127,6 +129,7 @@ public:
|
||||
|
||||
void Serialize(uint8_t *buffer) const;
|
||||
std::vector<uint8_t> Serialize() const;
|
||||
std::array<uint8_t, SIZE> SerializeToArray() const;
|
||||
|
||||
friend bool operator==(GTElement const &a, GTElement const &b);
|
||||
friend bool operator!=(GTElement const &a, GTElement const &b);
|
||||
|
@ -82,6 +82,7 @@ class PrivateKey {
|
||||
// Serialize the key into bytes
|
||||
void Serialize(uint8_t *buffer) const;
|
||||
std::vector<uint8_t> Serialize(bool fLegacy = false) const;
|
||||
std::array<uint8_t, PrivateKey::PRIVATE_KEY_SIZE> SerializeToArray(bool fLegacy = false) const;
|
||||
|
||||
G2Element SignG2(
|
||||
const uint8_t *msg,
|
||||
|
@ -171,11 +171,16 @@ uint32_t G1Element::GetFingerprint(const bool fLegacy) const
|
||||
}
|
||||
|
||||
std::vector<uint8_t> G1Element::Serialize(const bool fLegacy) const {
|
||||
const auto arr = G1Element::SerializeToArray(fLegacy);
|
||||
return std::vector<uint8_t>{arr.begin(), arr.end()};
|
||||
}
|
||||
|
||||
std::array<uint8_t, G1Element::SIZE> G1Element::SerializeToArray(const bool fLegacy) const {
|
||||
uint8_t buffer[G1Element::SIZE + 1];
|
||||
g1_write_bin(buffer, G1Element::SIZE + 1, p, 1);
|
||||
|
||||
std::array<uint8_t, G1Element::SIZE> result{};
|
||||
if (buffer[0] == 0x00) { // infinity
|
||||
std::vector<uint8_t> result(G1Element::SIZE, 0);
|
||||
result[0] = 0xc0;
|
||||
return result;
|
||||
}
|
||||
@ -187,7 +192,9 @@ std::vector<uint8_t> G1Element::Serialize(const bool fLegacy) const {
|
||||
if (!fLegacy) {
|
||||
buffer[1] |= 0x80; // indicate compression
|
||||
}
|
||||
return std::vector<uint8_t>(buffer + 1, buffer + 1 + G1Element::SIZE);
|
||||
|
||||
std::copy_n(buffer + 1, G1Element::SIZE, result.begin());
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator==(const G1Element & a, const G1Element &b)
|
||||
@ -386,11 +393,18 @@ G2Element G2Element::Negate() const
|
||||
GTElement G2Element::Pair(const G1Element& a) const { return a & (*this); }
|
||||
|
||||
std::vector<uint8_t> G2Element::Serialize(const bool fLegacy) const {
|
||||
const auto arr = G2Element::SerializeToArray(fLegacy);
|
||||
return std::vector<uint8_t>{arr.begin(), arr.end()};
|
||||
}
|
||||
|
||||
std::array<uint8_t, G2Element::SIZE> G2Element::SerializeToArray(const bool fLegacy) const {
|
||||
uint8_t buffer[G2Element::SIZE + 1];
|
||||
g2_write_bin(buffer, G2Element::SIZE + 1, (g2_st*)q, 1);
|
||||
|
||||
std::array<uint8_t, G2Element::SIZE> result{};
|
||||
|
||||
if (buffer[0] == 0x00) { // infinity
|
||||
std::vector<uint8_t> result(G2Element::SIZE, 0);
|
||||
result.fill(0);
|
||||
result[0] = 0xc0;
|
||||
return result;
|
||||
}
|
||||
@ -410,7 +424,6 @@ std::vector<uint8_t> G2Element::Serialize(const bool fLegacy) const {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> result(G2Element::SIZE, 0);
|
||||
if (fLegacy) {
|
||||
std::memcpy(result.data(), buffer + 1, G2Element::SIZE);
|
||||
} else {
|
||||
@ -551,4 +564,11 @@ std::vector<uint8_t> GTElement::Serialize() const
|
||||
return data;
|
||||
}
|
||||
|
||||
std::array<uint8_t, GTElement::SIZE> GTElement::SerializeToArray() const
|
||||
{
|
||||
std::array<uint8_t, GTElement::SIZE> data{};
|
||||
Serialize(data.data());
|
||||
return data;
|
||||
}
|
||||
|
||||
} // end namespace bls
|
||||
|
@ -284,6 +284,13 @@ std::vector<uint8_t> PrivateKey::Serialize(const bool fLegacy) const
|
||||
return data;
|
||||
}
|
||||
|
||||
std::array<uint8_t, PrivateKey::PRIVATE_KEY_SIZE> PrivateKey::SerializeToArray(bool fLegacy) const
|
||||
{
|
||||
std::array<uint8_t, PRIVATE_KEY_SIZE> data{};
|
||||
Serialize(data.data());
|
||||
return data;
|
||||
}
|
||||
|
||||
G2Element PrivateKey::SignG2(
|
||||
const uint8_t *msg,
|
||||
size_t len,
|
||||
|
Loading…
Reference in New Issue
Block a user