hyperledger / hyperledger/fabric-private-chaincode

Make generate_enclave.sh more robust

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
174
Forks
98
Avg merge
2d 21h
Merged PRs (30d)
1

Description

Currently, `ecc_enclave` and `tlcc_enclave` use a script to generate `mrenclave.go`. However, this script is a) duplicated and b) not robust.

As suggested by @g2flyer ...

... bigger problem seems that we do no catch any errors and so it was happily running so far (just producing only an empty mrenclave). Easiest fix for that seems to be o just add a 'set -e' in the beginning?

Also, given that the generate_mrenclave.sh is the same in ecc_enclave and tlcc_enclave, maybe we should move that to a common bin directory?

Thinking of it, the method here also seems rather brittle, the way we do it in [pdo ](https://github.com/hyperledger-labs/private-data-objects)is more robust:

add to sgx_sign sign the '-dumpfile "${SIGNED_ENCLAVE_METADATA}"' option (see [https://github.com/hyperledger-labs/private-data-objects/blob/master/common/CMakeLists.txt](common/CMakeLists.txt)) and then
extract it with a more understandable like the ' VAR_MRENCLAVE=$$(perl -0777 -ne 'if (/metadata->enclave_css.body.enclave_hash.m:([a-fx0-9 \n]+)/) { $$eh = $$1; $$eh=~s/0x| |\n//g; $$eh=~tr/a-z/A-Z/; print "$${eh}\n"; }' $(CONTRACT_ENCLAVE_MRENCLAVE_META_FILE))' in target '$(CONTRACT_ENCLAVE_MRENCLAVE_C_FILE)' in [pservice/Makefile](https://github.com/hyperledger-labs/private-data-objects/blob/master/pservice/Makefile)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.