Fixing SGX

parent 35044c70
//
// Created by kladko on 9/2/19.
//
#include <memory>
#include "BLSCrypto.h"
......@@ -12,6 +13,7 @@
#include "leveldb/db.h"
#include <jsonrpccpp/server/connectors/httpserver.h>
#include "BLSPrivateKeyShareSGX.h"
extern "C" void init_daemon() {
......@@ -28,8 +30,18 @@ extern "C" void init_daemon() {
}
class BLSCrypto {
bool sign(char* encryptedKeyHex, char* hashHex, size_t t, size_t n, char* _sig) {
auto keyStr = std::make_shared<std::string>(encryptedKeyHex);
auto keyShare = std::make_shared<BLSPrivateKeyShareSGX>(keyStr, t, n);
return true;
}
};
......@@ -13,6 +13,10 @@
EXTERNC void init_daemon();
EXTERNC bool sign(char* encryptedKeyHex, char* hashHex, size_t t, size_t n, char* _sig);
#endif //SGXD_BLSCRYPTO_H
......@@ -181,6 +181,6 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX(
auto s = make_shared<BLSSigShare>(sig, _signerIndex, requiredSigners,
totalSigners);
return s;
}
......@@ -23,23 +23,25 @@
#ifndef SGXD_BLSPRIVATEKEYSHARESGX_H
#define SGXD_BLSPRIVATEKEYSHARESGX_H
#define SGXD_BLSPRIVATEKEYSHARESGX_H
#include "BLSPrivateKeyShare.h"
class BLSPrivateKeyShareSGX {
size_t requiredSigners;
class BLSPrivateKeyShareSGX {
size_t totalSigners;
size_t requiredSigners;
size_t totalSigners;
shared_ptr<string> encryptedKeyHex;
std::shared_ptr<std::string> encryptedKeyHex;
std::shared_ptr<BLSSigShare> signWithHelperSGX(std::shared_ptr<std::array<uint8_t, 32>> _hash, size_t _signerIndex);
BLSPrivateKeyShareSGX(shared_ptr<std::string> _encryptedKeyHex, size_t _requiredSigners, size_t _totalSigners);
public:
std::shared_ptr<BLSSigShare>
signWithHelperSGX(std::shared_ptr<std::array<uint8_t, 32>> _hash,
size_t _signerIndex);
BLSPrivateKeyShareSGX(std::shared_ptr<std::string> _encryptedKeyHex,
size_t _requiredSigners, size_t _totalSigners);
};
#endif // LIBBLS_BLSPRIVATEKEYSHARE_H
#endif // LIBBLS_BLSPRIVATEKEYSHARE_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment