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

Fixed compilation bugs? #151

Open
wants to merge 1 commit into
base: dev/msft-gumunjal/AddingCalltoThimAgent
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions src/Linux/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This library requires libcurl built with OpenSSL support and package config.
* `sudo apt-get install libssl-dev`
* `sudo apt install libcurl4-openssl-dev`
* `sudo apt-get install pkg-config`
* `sudo apt-get install nlohmann-json3-dev`

Copy link

Choose a reason for hiding this comment

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

I think also g++ is missing (at least on ubuntu 20.04)

Install Google Test
```
Expand Down
4 changes: 2 additions & 2 deletions src/Linux/curl_easy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ char const* curl_easy::error::what() const noexcept
///////////////////////////////////////////////////////////////////////////////
// curl_easy implementation
///////////////////////////////////////////////////////////////////////////////
std::unique_ptr<curl_easy> curl_easy::create(const std::string& url, const std::string* const p_body, unsigned long dwflag, std::wstring httpVerb))
std::unique_ptr<curl_easy> curl_easy::create(const std::string& url, const std::string* const p_body, unsigned long dwflag, std::wstring httpVerb)
{
std::unique_ptr<curl_easy> easy(new curl_easy);

Expand All @@ -93,7 +93,7 @@ std::unique_ptr<curl_easy> curl_easy::create(const std::string& url, const std::

if (p_body != nullptr && !p_body->empty())
{
if (_wcsnicmp(httpVerb, L"POST"))
if (wcscasecmp(httpVerb.c_str(), L"POST"))
{
easy->set_opt_or_throw(CURLOPT_POST, 1L);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Linux/curl_easy.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class curl_easy
const std::string& url,
const std::string* const p_body,
unsigned long dwflags = 0x00800000,
std::wstringstd::wstring httpVerb = L"GET");
std::wstring httpVerb = L"GET");

~curl_easy();

Expand Down
20 changes: 10 additions & 10 deletions src/dcap_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <winsock.h>
#endif

using nlohmann::json;
using namespace std;

// External function names are dictated by Intel
Expand Down Expand Up @@ -358,7 +357,7 @@ std::string get_collateral_friendly_name(CollateralTypes collateral_type)
// extract raw value from response body, if exists
//
sgx_plat_error_t extract_from_json(
nlohmann::json json,
const nlohmann::json& json,
const std::string& header_item,
std::string* out_header)
{
Expand All @@ -374,7 +373,7 @@ sgx_plat_error_t extract_from_json(
*out_header = raw_header;
}
}
catch (exception ex)
catch (const exception& ex)
{
log(SGX_QL_LOG_ERROR, "Header '%s' is missing.", header_item.c_str());
return SGX_PLAT_ERROR_UNEXPECTED_SERVER_RESPONSE;
Expand Down Expand Up @@ -595,7 +594,7 @@ static void build_pck_cert_url(
//
// Build a complete cert chain from a completed curl object.
//
static std::string build_cert_chain(const curl_easy& curl, const nlohmann::json json)
static std::string build_cert_chain(const curl_easy& curl, const nlohmann::json& json)
{
std::string leaf_cert;
std::string chain;
Expand Down Expand Up @@ -664,7 +663,7 @@ static sgx_plat_error_t hex_decode(const std::string& hex_string, T* decoded)
// PCESVN(2 bytes)."
//
static sgx_plat_error_t parse_svn_values(
nlohmann::json json,
const nlohmann::json& json,
const curl_easy& curl,
sgx_ql_config_t* quote_config)
{
Expand Down Expand Up @@ -1074,19 +1073,20 @@ extern "C" quote3_error_t sgx_ql_get_quote_config(
"Runtime exception thrown, error: %s",
error.what());
}
catch (const std::exception& error)
catch (const curl_easy::error& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
"error thrown, error code: %x: %s",
error.code,
error.what());
}
catch (const curl_easy::error& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"error thrown, error code: %x: %s",
error.code,
"Unknown exception thrown, error: %s",
error.what());
}

if (!thim_agent_success)
{
if (auto cache_hit = try_cache_get(cert_url))
Expand Down