Skip to content

Commit

Permalink
fixed errors in ubuntu20.04 (#134)
Browse files Browse the repository at this point in the history
* fixed errors in ubuntu20.04

* changed to const reference

* added new version number

* added more instruction for ubuntu20.04

* fixed format

* fixed verion typo

* changed the text of readme

* changed the readme text

Co-authored-by: Ubuntu <wewang3@ubuntu18.wkwiz420iasuzkg1m1ozlt1gsa.zx.internal.cloudapp.net>
  • Loading branch information
wewang3 and Ubuntu authored Mar 24, 2021
1 parent 2b5530e commit 0360fd1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 30 deletions.
12 changes: 12 additions & 0 deletions src/Linux/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ build-essential package (`sudo apt install build-essential`) and dh-virtualenv

The output deb file is suitable for installation on any amd64 Ubuntu system.

In Ubuntu 20.04, please run this command to install dh-virtualenv:
```
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install virtualenv
```
Install fakeroot:
```
sudo apt install build-essential devscripts debhelper check libsubunit-dev fakeroot
```

## Troubleshooting

1. You're seeing cryptic errors such as ": No such file or directory":
Expand Down
5 changes: 5 additions & 0 deletions src/Linux/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
az-dcap-client (1.8) stable; urgency=medium
* Enable Ubuntu 20.04 package and Fixed compile errors

-- Wei Wang <[email protected]> Fri, 19 Mar 2021 2:42:00 -0700

az-dcap-client (1.7) stable; urgency=medium
* Enable v3 for icx and coffelake. Use the Cache-Control header to determine how long collateral should be cached for. Cleanup of error handling logs in Windows

Expand Down
4 changes: 2 additions & 2 deletions src/Windows/GeneratePackage/Azure.DCAP.Windows.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Microsoft.Azure.DCAP</id>
<version>1.7.0</version>
<version>1.8.0</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>Enable v3 for icx and coffelake and Use the Cache-Control header to determine how long collateral should be cached for. Cleanup of error handling logs in Windows</releaseNotes>
<releaseNotes>Enable Ubuntu20.04 package and Fixed compile errors</releaseNotes>
<description>
This library serves as a quoting data provider plugin for the Intel SGX Data Center Attestation Primitives (DCAP). Specifically, the Intel DCAP library will search out and load provider plugins, such as the Azure DCAP Client.
This provider plugin is then used to fetch certain data files, such as platform certificates, TCB structures, and revocation lists.
Expand Down
56 changes: 28 additions & 28 deletions src/dcap_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ bool get_cache_expiration_time(const string &cache_control, const string &url, t
return false;
}
}
catch (std::invalid_argument e)
catch (const std::invalid_argument& e)
{
log(SGX_QL_LOG_ERROR,
"Invalid argument thrown when parsing cache-control. Header text: '%s' Error: '%s'. Collateral will not be cached",
cache_control.c_str(),
e.what());
return false;
}
catch (std::out_of_range e)
catch (const std::out_of_range& e)
{
log(SGX_QL_LOG_ERROR,
"Invalid argument thrown when parsing cache-control. Header "
Expand Down Expand Up @@ -450,7 +450,7 @@ static size_t safe_multiply(size_t first, size_t second)
template <typename input_t, typename output_t>
void safe_cast(input_t in, output_t* out)
{
if (in > (std::numeric_limits<output_t>::max)())
if (in > static_cast<input_t>((std::numeric_limits<output_t>::max)()))
{
throw std::overflow_error("Integer cast overflow");
}
Expand Down Expand Up @@ -764,7 +764,7 @@ static std::unique_ptr<std::vector<uint8_t>> try_cache_get(
{
return local_cache_get(cert_url);
}
catch (std::runtime_error& error)
catch (const std::runtime_error& error)
{
log(SGX_QL_LOG_WARNING, "Unable to access cache: %s", error.what());
return nullptr;
Expand Down Expand Up @@ -835,7 +835,7 @@ static quote3_error_t get_collateral(

return retval;
}
catch (std::runtime_error& error)
catch (const std::runtime_error& error)
{
log(SGX_QL_LOG_WARNING,
"Runtime exception thrown, error: %s",
Expand All @@ -844,7 +844,7 @@ static quote3_error_t get_collateral(
// operate without caching
return retval;
}
catch (curl_easy::error& error)
catch (const curl_easy::error& error)
{
log(SGX_QL_LOG_ERROR,
"curl error thrown, error code: %x: %s",
Expand Down Expand Up @@ -988,12 +988,12 @@ extern "C" quote3_error_t sgx_ql_get_quote_config(
}
}
}
catch (std::bad_alloc&)
catch (const std::bad_alloc&)
{
log_message(SGX_QL_LOG_ERROR, "Out of memory thrown");
return SGX_QL_ERROR_OUT_OF_MEMORY;
}
catch (curl_easy::error& error)
catch (const curl_easy::error& error)
{
log(SGX_QL_LOG_ERROR,
"error thrown, error code: %x: %s",
Expand All @@ -1003,7 +1003,7 @@ extern "C" quote3_error_t sgx_ql_get_quote_config(
? SGX_QL_NO_PLATFORM_CERT_DATA
: SGX_QL_ERROR_UNEXPECTED;
}
catch (std::runtime_error& error)
catch (const std::runtime_error& error)
{
log(SGX_QL_LOG_WARNING,
"Runtime exception thrown, error: %s",
Expand All @@ -1012,7 +1012,7 @@ extern "C" quote3_error_t sgx_ql_get_quote_config(
// operate without caching
// return SGX_QL_ERROR_UNEXPECTED;
}
catch (std::exception& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
Expand Down Expand Up @@ -1219,18 +1219,18 @@ extern "C" sgx_plat_error_t sgx_ql_get_revocation_info(

assert(buffer == buffer_end);
}
catch (std::bad_alloc&)
catch (const std::bad_alloc&)
{
return SGX_PLAT_ERROR_OUT_OF_MEMORY;
}
catch (std::overflow_error& error)
catch (const std::overflow_error& error)
{
log(SGX_QL_LOG_ERROR, "Overflow error. '%s'", error.what());
delete[] buffer;
*pp_revocation_info = nullptr;
return SGX_PLAT_ERROR_OVERFLOW;
}
catch (curl_easy::error& error)
catch (const curl_easy::error& error)
{
log(SGX_QL_LOG_ERROR,
"error thrown, error code: %x: %s",
Expand All @@ -1240,7 +1240,7 @@ extern "C" sgx_plat_error_t sgx_ql_get_revocation_info(
? SGX_PLAT_NO_DATA_FOUND
: SGX_PLAT_ERROR_UNEXPECTED_SERVER_RESPONSE;
}
catch (std::exception& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
Expand Down Expand Up @@ -1331,17 +1331,17 @@ extern "C" sgx_plat_error_t sgx_get_qe_identity_info(
issuer_chain.size());
*pp_qe_identity_info = p_qe_identity_info;
}
catch (std::bad_alloc&)
catch (const std::bad_alloc&)
{
return SGX_PLAT_ERROR_OUT_OF_MEMORY;
}
catch (std::overflow_error& error)
catch (const std::overflow_error& error)
{
log(SGX_QL_LOG_ERROR, "Overflow error. '%s'", error.what());
*pp_qe_identity_info = nullptr;
return SGX_PLAT_ERROR_OVERFLOW;
}
catch (curl_easy::error& error)
catch (const curl_easy::error& error)
{
log(SGX_QL_LOG_ERROR,
"error thrown, error code: %x: %s",
Expand All @@ -1351,7 +1351,7 @@ extern "C" sgx_plat_error_t sgx_get_qe_identity_info(
? SGX_PLAT_NO_DATA_FOUND
: SGX_PLAT_ERROR_UNEXPECTED_SERVER_RESPONSE;
}
catch (std::exception& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
Expand Down Expand Up @@ -1622,19 +1622,19 @@ extern "C" quote3_error_t sgx_ql_get_quote_verification_collateral(

return result;
}
catch (std::bad_alloc&)
catch (const std::bad_alloc&)
{
sgx_ql_free_quote_verification_collateral(p_quote_collateral);
log(SGX_QL_LOG_ERROR, "Out of memory thrown");
return SGX_QL_ERROR_OUT_OF_MEMORY;
}
catch (std::overflow_error& error)
catch (const std::overflow_error& error)
{
log(SGX_QL_LOG_ERROR, "Overflow error. '%s'", error.what());
sgx_ql_free_quote_verification_collateral(p_quote_collateral);
return SGX_QL_ERROR_UNEXPECTED;
}
catch (std::exception& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
Expand Down Expand Up @@ -1714,21 +1714,21 @@ extern "C" quote3_error_t sgx_ql_get_qve_identity(

return operation_result;
}
catch (std::bad_alloc&)
catch (const std::bad_alloc&)
{
sgx_ql_free_qve_identity(
*pp_qve_identity, *pp_qve_identity_issuer_chain);
log(SGX_QL_LOG_ERROR, "Out of memory thrown");
return SGX_QL_ERROR_OUT_OF_MEMORY;
}
catch (std::overflow_error& error)
catch (const std::overflow_error& error)
{
log(SGX_QL_LOG_ERROR, "Overflow error. '%s'", error.what());
sgx_ql_free_qve_identity(
*pp_qve_identity, *pp_qve_identity_issuer_chain);
return SGX_QL_ERROR_UNEXPECTED;
}
catch (std::exception& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
Expand Down Expand Up @@ -1784,23 +1784,23 @@ extern "C" quote3_error_t sgx_ql_get_root_ca_crl(
*p_root_ca_crl_size = (uint16_t)bufferSize;
return retval;
}
catch (std::bad_alloc&)
catch (const std::bad_alloc&)
{
sgx_ql_free_root_ca_crl(*pp_root_ca_crl);
log(SGX_QL_LOG_ERROR, "Out of memory thrown");
return SGX_QL_ERROR_OUT_OF_MEMORY;
}
catch (std::overflow_error& error)
catch (const std::overflow_error& error)
{
log(SGX_QL_LOG_ERROR, "Overflow error. '%s'", error.what());
sgx_ql_free_root_ca_crl(*pp_root_ca_crl);
return SGX_QL_ERROR_UNEXPECTED;
}
catch (std::exception& error)
catch (const std::exception& error)
{
log(SGX_QL_LOG_ERROR,
"Unknown exception thrown, error: %s",
error.what());
return SGX_QL_ERROR_UNEXPECTED;
}
}
}

0 comments on commit 0360fd1

Please sign in to comment.