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: add missing destructor for CoreMPL and final for nested classes #359

Closed
wants to merge 1 commit into from
Closed
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 src/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() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still necessary when you make the other types final?

Copy link
Contributor Author

@knst knst May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because final in other class mean just no more inheritance and it doesn't need its own virtual destructor. But above class/struct still needs so

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I guess we already have other virtual functions in this class, and we do use it polymorphically. so this seems right.

// 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 @@ -96,7 +97,7 @@ class CoreMPL {
bool NativeVerify(g1_t *pubKeys, g2_t *mappedHashes, size_t length);
};

class BasicSchemeMPL : public CoreMPL {
class BasicSchemeMPL final : public CoreMPL {
public:
static const std::string CIPHERSUITE_ID;
BasicSchemeMPL() : CoreMPL(BasicSchemeMPL::CIPHERSUITE_ID) {}
Expand All @@ -117,7 +118,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 @@ -170,7 +171,7 @@ class AugSchemeMPL : public CoreMPL {
const G2Element& signature) override;
};

class PopSchemeMPL : public CoreMPL {
class PopSchemeMPL final : public CoreMPL {

public:
static const std::string CIPHERSUITE_ID;
Expand Down