-
Notifications
You must be signed in to change notification settings - Fork 66
Problem (Fix #1457): No mock mode for developing on non-sgx platform #1458
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
bors try |
tryBuild succeeded: |
e68e57c
to
a4a7a2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this adds a new path in chain-abci, perhaps bump a version to "0.4.1" + update a changelog (instead of *Unreleased* ## v0.5.0
it could be *Unreleased* ## v0.4.1
)?
-- or bump to / keep it in v0.5.0 if this goes ahead #1466
|
||
const ENCRYPTION_KEY: u8 = 0x0f; | ||
const SEAL_KEY: u8 = 0xf0; | ||
pub fn decryt(payload: &TxObfuscated) -> PlainTxAux { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decrypt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decrypt
?
Thanks, done.
const SEAL_KEY: u8 = 0xf0; | ||
pub fn decryt(payload: &TxObfuscated) -> PlainTxAux { | ||
let unpad = unpad_payload(&payload.txpayload); | ||
let bs = unpad.iter().map(|b| b ^ ENCRYPTION_KEY).collect::<Vec<_>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of this custom xor, it could just import and use AEAD + aes-gcm-siv ?
tx.encode() | ||
.into_iter() | ||
.map(|b| b ^ SEAL_KEY) | ||
.collect::<Vec<_>>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's now this pure Rust sealing: https://github.com/crypto-com/chain/blob/master/chain-tx-enclave/enclave-utils/src/lib.rs
instead of this custom, it could just produce mock payloads that correspond to the Intel SDK payloads, but it won't be deriving key using the "egetkey" instruction -- it'll just have one hardcoded mock key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that simple xor may be good enough for the mock purpose?
After all, it's only for dev/testing purpose, people should bear in mind that there's always potential false positive and false negatives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these were just small suggestions -- the main requested change is just updating the changelog; it's ok to merge this without this improved mocking for now
… platform Solution: - Add mock mode - Fix warning of release building, Fix crypto-com#1465
The changelog is added. |
bors r+ |
Build failed: |
#1475 again. |
yeah, will be good to resolve #1475 soon |
bors retry |
Build succeeded: |
Solution:
The basic idea is described in #1457.