Skip to content

Instantly share code, notes, and snippets.

View sangfansh's full-sized avatar

Fan Sang sangfansh

View GitHub Profile
#define MAX_ITEMS 100
#define MAX_ITEM_SIZE 100
// item
struct Item {
char title[MAX_ITEM_SIZE];
char username[MAX_ITEM_SIZE];
char password[MAX_ITEM_SIZE];
};
typedef struct Item item_t;
int main(int argc, char** argv) {
sgx_enclave_id_t eid = 0;
sgx_launch_token_t token = {0};
int updated, ret;
sgx_status_t ecall_status, enclave_status;
enclave_status = sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL);
if(enclave_status != SGX_SUCCESS) {
error_print("Fail to initialize enclave.");
void Client::startConnection() {
Log("Start connecting...");
boost::system::error_code ec;
boost::asio::connect(socket_.lowest_layer(), this->endpoint_iterator, ec);
handle_connect(ec);
}
void Client::handle_connect(const boost::system::error_code &error) {
void NetworkManagerClient::startService() {
this->client->startConnection();
}
void VerificationManager::start() {
this->nm->startService();
Log("Remote attestation done");
}
vector<string> VerificationManager::incomingHandler(string v, int type) {
vector<string> res;
if (!v.empty()) {
string s;
bool ret;
switch (type) {
case RA_MSG0: {
Messages::MessageMsg0 msg0;
int VerificationManager::init() {
if (this->sp) {
delete this->sp;
this->sp = new ServiceProvider(this->ws);
}
this->nm->Init();
this->nm->connectCallbackHandler([this](string v, int type) {
return this->incomingHandler(v, type);
});
#ifndef WEBSERVICE_H
#define WEBSERVICE_H
#include <string>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include <stdio.h>
#include <curl/curl.h>
#include <jsoncpp/json/json.h>
#ifndef VERIFICATIONMANAGER_H
#define VERIFICATIONMANAGER_H
#include <string>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include "ServiceProvider.h"
#include "NetworkManagerClient.h"
#include <iostream>
#include <unistd.h>
#include "LogBase.h"
#include "NetworkManager.h"
#include "VerificationManager.h"
#include "UtilityFunctions.h"
using namespace util;