Skip to content

Commit

Permalink
Adding second param for sgx_ql_set_logging_callback
Browse files Browse the repository at this point in the history
  • Loading branch information
msft-gumunjal committed Jun 4, 2024
1 parent c8ab207 commit 7511bbf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
14 changes: 10 additions & 4 deletions src/UnitTest/test_quote_prov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ static constexpr uint8_t TDX_TEST_FMSPC[] =
const uint16_t custom_param_length = 45;
const char* custom_param = "tcbEvaluationDataNumber=11;region=us central";
std::string tcbEvaluationDataNumber = "11";
static const sgx_ql_log_level_t LEVEL_ERROR = SGX_QL_LOG_ERROR;

const uint16_t incorrect_custom_param_length = 24;
const char* incorrect_custom_param = "tcbEvaluationDataNum=11";
Expand Down Expand Up @@ -956,8 +957,11 @@ void ReloadLibrary(libary_type_t* library, bool set_logging_callback = true)
#endif
if (set_logging_callback)
{
ASSERT_TRUE(SGX_PLAT_ERROR_OK == sgx_ql_set_logging_function(Log));
ASSERT_TRUE(SGX_QL_SUCCESS == sgx_ql_set_logging_callback(Log));
ASSERT_TRUE(
SGX_PLAT_ERROR_OK == sgx_ql_set_logging_function(Log));
ASSERT_TRUE(
SGX_QL_SUCCESS ==
sgx_ql_set_logging_callback(Log, SGX_QL_LOG_INFO));
}
}

Expand Down Expand Up @@ -1305,7 +1309,8 @@ TEST(testQuoteProv, quoteProviderTestsData)
TEST(testQuoteProv, quoteProviderTestsV2DataFromService)
{
libary_type_t library = LoadFunctions();
ASSERT_TRUE(SGX_QL_SUCCESS == sgx_ql_set_logging_callback(Log));
ASSERT_TRUE(
SGX_QL_SUCCESS == sgx_ql_set_logging_callback(Log, SGX_QL_LOG_INFO));

//
// Get the data from the service
Expand Down Expand Up @@ -1345,7 +1350,8 @@ TEST(testQuoteProv, quoteProviderTestsV2Data)
TEST(testQuoteProv, quoteProviderTestsV3DataFromService)
{
libary_type_t library = LoadFunctions();
ASSERT_TRUE(SGX_QL_SUCCESS == sgx_ql_set_logging_callback(Log));
ASSERT_TRUE(
SGX_QL_SUCCESS == sgx_ql_set_logging_callback(Log, SGX_QL_LOG_INFO));

//
// Get the data from the service
Expand Down
4 changes: 3 additions & 1 deletion src/dcap_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2308,9 +2308,11 @@ extern "C" sgx_plat_error_t sgx_ql_set_logging_function(
}

extern "C" quote3_error_t sgx_ql_set_logging_callback(
sgx_ql_logging_callback_t logger)
sgx_ql_logging_callback_t logger,
sgx_ql_log_level_t loglevel)
{
logger_callback = logger;
g_loglevel = loglevel;
return SGX_QL_SUCCESS;
}

Expand Down
3 changes: 2 additions & 1 deletion src/dcap_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const std::string customParam = "customParameter";

/// Set the callback used for recording log information.
typedef quote3_error_t (*sgx_ql_set_logging_callback_t)(
sgx_ql_logging_callback_t logger);
sgx_ql_logging_callback_t logger,
sgx_ql_log_level_t loglevel);

#endif // #ifndef PLATFORM_QUOTE_PROVIDER_H
1 change: 1 addition & 0 deletions src/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

extern sgx_ql_logging_function_t logger_function;
extern sgx_ql_logging_callback_t logger_callback;
extern sgx_ql_log_level_t g_loglevel;

///////////////////////////////////////////////////////////////////////////////
// Various internal functions which are not exported.
Expand Down
2 changes: 1 addition & 1 deletion src/sgx_ql_lib_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#ifndef _SGX_QL_LIB_COMMON_H_
#define _SGX_QL_LIB_COMMON_H_

#include "sgx_key.h"
#include ".\Windows\ext\intel\sgx_key.h"

#define SGX_QL_MK_ERROR(x) (0x0000E000|(x))

Expand Down

0 comments on commit 7511bbf

Please sign in to comment.