Skip to content

Commit

Permalink
address review comments on PR
Browse files Browse the repository at this point in the history
Signed-off-by: Prakash Narayana Moorthy <[email protected]>
  • Loading branch information
prakashngit committed Feb 21, 2024
1 parent 68430c2 commit 2dad0bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def set_contract_enclave_check_attestation_flag(client, options):
def Main() :

(_, unprocessed_args, member_client) = parse_common_arguments(
sys.argv[1:], 'Fetch the ledger authority key from a CCF server', True)
sys.argv[1:], 'Set contract enclave attestation check flag', True)

# Parse the arguments that are unique to the script
parser = argparse.ArgumentParser(description='Set contract enclave attestation check flag')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def set_contract_enclave_expected_sgx_measurements(client, options):
def Main() :

(_, unprocessed_args, member_client) = parse_common_arguments(
sys.argv[1:], 'Fetch the ledger authority key from a CCF server', True)
sys.argv[1:], 'Set contract enclave expected sgx measurements', True)

# Parse the arguments that are unique to the script

parser = argparse.ArgumentParser(description='Fetch the ledger authority key from a CCF server')
parser = argparse.ArgumentParser(description='Set contract enclave expected sgx measurements')
parser.add_argument('--mrenclave', help="Expected MRENCLAVE of pdo enclaves", type=str)
parser.add_argument('--basename', help="PDO enclave basename", type=str)
parser.add_argument('--ias-public-key', help="IAS public key derived from cert used to verify report signatures", type=str)
Expand Down
6 changes: 4 additions & 2 deletions ledgers/ccf/transaction_processor/pdo_tp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ namespace ccfapp
auto check_attestation_flag_view = ctx.tx.rw(contract_enclave_check_attestation_flag);
auto check_attestation_flag_global = check_attestation_flag_view->get_globally_committed(PDO_ENCLAVE_CHECK_ATTESTATION_FLAG);
if (!check_attestation_flag_global.has_value()){
return ccf::make_success("No attestation verification policy has been set. Enclave cannot be registered");
return ccf::make_error(
HTTP_STATUS_BAD_REQUEST, ccf::errors::InvalidInput, "No attestation verification policy has been set. Enclave cannot be registered");
}

auto check_attestation_flag = check_attestation_flag_global.value();
Expand All @@ -224,7 +225,8 @@ namespace ccfapp
auto expected_sgx_measurements_view = ctx.tx.rw(contract_enclave_expected_sgx_measurements);
auto expected_sgx_measurements_global = expected_sgx_measurements_view->get_globally_committed(PDO_ENCLAVE_EXPECTED_SGX_MEASUREMENTS);
if (!check_attestation_flag_global.has_value()){
return ccf::make_success("Expected sgx measurents have not been set. Enclave cannot be registered");
return ccf::make_error(
HTTP_STATUS_BAD_REQUEST, ccf::errors::InvalidInput, "Expected sgx measurents have not been set. Enclave cannot be registered");
}

auto expected_sgx_measurements = expected_sgx_measurements_global.value();
Expand Down

0 comments on commit 2dad0bd

Please sign in to comment.