Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Problem: no gen keypackage command in dev-utils (fix #1692) #1738

Merged
merged 1 commit into from Jun 12, 2020

Conversation

leejw51crypto
Copy link
Collaborator

added keyspace generation in dev-utils.

certificate_validity_secs: 86400,
});
if config.is_err() {
println!("cannot connect ra-sp-server, run ra-sp-server beforehand e.g.) ra-sp-server --quote-type Unlinkable --ias-key $IAS_API_KEY --spid $SPID")
Copy link
Collaborator

Choose a reason for hiding this comment

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

print out the error itself?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to notify keypackage failure just when user create it,
otherwise, it's very hard for user to know which step is wrong

.keypackage
.verify(&*ra_client::ENCLAVE_CERT_VERIFIER, now);
if let Err(value) = verication_result {
println!("verification_fail {}", value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Write the error into the stderr, and exit with a non zero code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #1738 into master will decrease coverage by 0.04%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1738      +/-   ##
==========================================
- Coverage   65.71%   65.66%   -0.05%     
==========================================
  Files         204      205       +1     
  Lines       25294    25310      +16     
==========================================
- Hits        16622    16621       -1     
- Misses       8672     8689      +17     
Impacted Files Coverage Δ
...-enclave-next/enclave-ra/ra-client/src/verifier.rs 43.24% <ø> (ø)
chain-tx-enclave-next/mls/src/main.rs 0.00% <ø> (ø)
client-cli/src/command/transaction_command.rs 0.00% <0.00%> (ø)
client-common/src/lib.rs 50.00% <ø> (ø)
client-rpc/src/rpc/staking_rpc.rs 0.00% <ø> (ø)
dev-utils/src/commands/genesis_command.rs 2.59% <ø> (ø)
dev-utils/src/commands/init_command.rs 0.00% <ø> (ø)
dev-utils/src/commands/keypackage_command.rs 0.00% <0.00%> (ø)
dev-utils/src/dev_utils.rs 0.00% <0.00%> (ø)
dev-utils/src/keypackage.rs 0.00% <0.00%> (ø)
... and 6 more

@leejw51 leejw51 force-pushed the cro-1692 branch 2 times, most recently from eaa675b to aacd2b1 Compare June 8, 2020 15:25
Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

client-* can be made simple by not including the development-only utilities, like gen_package -- it can just accept the generated payload?

@@ -22,8 +22,9 @@ use client_common::tendermint::types::{Genesis, Time};
use client_common::{ErrorKind, Result, ResultExt};

use crate::commands::genesis_dev_config::GenesisDevConfig;
use client_common::gen_keypackage;
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps no need to have that function in client_common, it can be moved to dev-utils?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok,
i'll also remove it from client-cli, because no longer necessary.
user can use dev-utils to create key-package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

working on now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

gen-package is being used in client-rpc, so i will not remove it.
only remove in client-cli

Copy link
Contributor

Choose a reason for hiding this comment

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

why is it used in client-rpc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, it's used in integration test.
can be replaced with dev-utils

Copy link
Contributor

Choose a reason for hiding this comment

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

ok to be replaced then in the integration test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, i'll change integration test,
and remove from client-rpc.

@leejw51crypto
Copy link
Collaborator Author

leejw51crypto commented Jun 10, 2020

removed gen-keypackage in client-rpc,
now modifying integration test
fixed integration test

@leejw51crypto
Copy link
Collaborator Author

./dev-utils keypackage generate
./dev-utils keypackage verify

added another category in dev-utils

@tomtau tomtau self-requested a review June 11, 2020 02:00
Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

@tomtau
Copy link
Contributor

tomtau commented Jun 11, 2020

bors try

bors bot added a commit that referenced this pull request Jun 11, 2020
@bors
Copy link
Contributor

bors bot commented Jun 11, 2020

try

Build failed:

@leejw51crypto
Copy link
Collaborator Author

i'm checking travis issue

@tomtau
Copy link
Contributor

tomtau commented Jun 11, 2020

@leejw51crypto travis issue should be fixable with cargo fmt?

@leejw51crypto
Copy link
Collaborator Author

yes, i'm checking again

@tomtau
Copy link
Contributor

tomtau commented Jun 11, 2020

bors try

bors bot added a commit that referenced this pull request Jun 11, 2020
@bors
Copy link
Contributor

bors bot commented Jun 11, 2020

try

Timed out.

@@ -59,7 +59,7 @@ steps:
commands:
- export CARGO_HOME=$PWD/drone/cargo
- export CARGO_TARGET_DIR=$PWD/drone/target
- export PATH=$CARGO_HOME/bin:$PATH
- export PATH=$CARGO_HOME/bin:$CARGO_TARGET_DIR/debug:$PATH
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, because it need to call 'dev-utils', without it, cannot call 'dev-utils'

Copy link
Collaborator

Choose a reason for hiding this comment

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

The run_multinode.sh will add the target dir into PATH, it'll also take BUILD_PROFILE into account.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but, when i run drone local, PATH didn't work.
also this PATH is static, i think it's simpler just to include inside .drone.yml,
not inside runtime bash script.
this is for simplicity.

if it's located to other script, hard to catch bug when runtime error occurs,
because you don't know exact PATH env status just like in checking time.

@leejw51crypto
Copy link
Collaborator Author

updated hmac

@tomtau
Copy link
Contributor

tomtau commented Jun 12, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 12, 2020

Merge conflict.

} else {
break kp;
}
/* TODO : use dev-utils to verify*/
Copy link
Collaborator

@yihuang yihuang Jun 12, 2020

Choose a reason for hiding this comment

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

why not verify by calling the function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because mls, ra-client moved to dev-utils, cannot call verification directly.
also client-core will be compiled via WASM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'm adding verification now

@@ -479,9 +468,6 @@ fn get_node_metadata(
.err_kind(ErrorKind::InvalidInput, || "invalid base64")
.map_err(to_rpc_error)?;

#[cfg(not(feature = "mock-enclave"))]
verify_keypackage(&keypackage).map_err(to_rpc_error)?;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, to remove dependency of mls,ra-client in client-core

Copy link
Collaborator

Choose a reason for hiding this comment

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

But we should verify this in client.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's supported in dev-utils
dev-utils keypackage verify
also i added verification in generation process
so if sgx remote attestation fails, generation itself stops

because it is not necessary to continue with failed remote attestation result.
it is much easier just to notify to user in generating keypackage.
so when remote attestation fails, user will resolve by configuration in bios or reinstall sgx-driver, and aesm_service.

so commands are
dev-utils keypackage generate <- generate keypacakge via ra-sp-server
dev-utils keypackage verify <- verify

Solution: add gen-keypackage
tidy up


more detail in message


tidy up


print error in stderr


remove gen-keypackage in client-cli


fix integration test


add path for dev-utils


tidy up


update hmac
@leejw51crypto
Copy link
Collaborator Author

rebased for merge conflict

@tomtau
Copy link
Contributor

tomtau commented Jun 12, 2020

bors retry

@bors
Copy link
Contributor

bors bot commented Jun 12, 2020

Build succeeded:

@bors bors bot merged commit b17886c into crypto-com:master Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants