blob: 4d9c74a0a42a5620e56b50b9327128e8e18032cd [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License..
#ifndef ENCLAVE_H
#define ENCLAVE_H
#include <string>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include "enclave_u.h"
#include "LogBase.h"
#include "UtilityFunctions.h"
// Needed to call untrusted key exchange library APIs, i.e. sgx_ra_proc_msg2.
#include "sgx_ukey_exchange.h"
// Needed to query extended epid group id.
#include "sgx_uae_service.h"
class Enclave {
public:
static Enclave* getInstance();
virtual ~Enclave();
sgx_status_t createEnclave();
sgx_enclave_id_t getID();
sgx_status_t raInit(sgx_ra_context_t *ra_context);
void raClose(sgx_ra_context_t ra_context);
private:
Enclave();
static Enclave *instance;
const char *enclave_path = "enclave.signed.so";
sgx_enclave_id_t enclave_id;
};
#endif