Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rid of UB and memory leak based on clang warnings #67

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/dashbls/schemes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CoreMPL {
public:
CoreMPL() = delete;
CoreMPL(const std::string& strId) : strCiphersuiteId(strId) {}
virtual ~CoreMPL() {}
// Generates a private key from a seed, similar to HD key generation
// (hashes the seed), and reduces it mod the group order
virtual PrivateKey KeyGen(const vector<uint8_t>& seed);
Expand Down Expand Up @@ -112,7 +113,7 @@ class CoreMPL {
bool fLegacy);
};

class BasicSchemeMPL : public CoreMPL {
class BasicSchemeMPL final : public CoreMPL {
public:
static const std::string CIPHERSUITE_ID;
BasicSchemeMPL() : CoreMPL(BasicSchemeMPL::CIPHERSUITE_ID) {}
Expand All @@ -133,7 +134,7 @@ class BasicSchemeMPL : public CoreMPL {
const G2Element& signature) override;
};

class AugSchemeMPL : public CoreMPL {
class AugSchemeMPL final : public CoreMPL {

public:
static const std::string CIPHERSUITE_ID;
Expand Down Expand Up @@ -221,7 +222,7 @@ class PopSchemeMPL : public CoreMPL {
/**
* This scheme reflects the Sign/Verify behaviour of older bls-signatures library versions (<0.1.29).
*/
class LegacySchemeMPL : public CoreMPL {
class LegacySchemeMPL final : public CoreMPL {

public:
LegacySchemeMPL() : CoreMPL(std::string{}) {}
Expand Down
1 change: 0 additions & 1 deletion src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ void TestHKDF(string ikm_hex, string salt_hex, string info_hex, string prk_expec

TEST_CASE("class PrivateKey") {
uint8_t buffer[PrivateKey::PRIVATE_KEY_SIZE];
memcmp(buffer, getRandomSeed().data(), PrivateKey::PRIVATE_KEY_SIZE);
SECTION("Copy {constructor|assignment operator}") {
PrivateKey pk1 = PrivateKey::RandomPrivateKey();
PrivateKey pk2 = PrivateKey::RandomPrivateKey();
Expand Down