-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for digital signatures + integration tests work (again) #501
support for digital signatures + integration tests work (again) #501
Conversation
…egrations; signature computation and validation; rwset serialization and replay; fixed echo test Signed-off-by: Bruno Vavala <[email protected]>
…ort for composite-key routines) Signed-off-by: Bruno Vavala <[email protected]>
Signed-off-by: Bruno Vavala <[email protected]>
Signed-off-by: Bruno Vavala <[email protected]>
Signed-off-by: Bruno Vavala <[email protected]>
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.
Looks overall very good. Build requires a simple patch (see below) but then works. However, for me, in both SIM and HW mode, the auction_test fails for two cases (echo and deployment test succeed). Maybe related to the state consistency assumptions? (Looking at auction_test it could also have been due to attempting concurency which actually would be a problem for DRAW detection when reordering happens. But you forced a --waitForEvent inside peer.cli, so this should not be the issue?0
A number of inline comments. As mentioned there (but maybe a bit hidden). mock_enclave
also has to be changed with the new message formats and pdo signature
From b0c16f4370607a027edc433b24e3b5e056f3c06d Mon Sep 17 00:00:00 2001
From: michael steiner <[email protected]>
Date: Fri, 18 Dec 2020 11:28:22 -0800
Subject: [PATCH] build fix
Signed-off-by: michael steiner <[email protected]>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 43753d5..50fd55d 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,8 @@ include $(TOP)/build.mk
SUB_DIRS = protos common internal ercc ecc_enclave ecc fabric client_sdk examples utils integration # docs
-FPC_SDK_DEP_DIRS = protos utils/fabric common ecc_enclave ecc
-FPC_PEER_DEP_DIRS = protos common ercc fabric ecc_enclave ecc
+FPC_SDK_DEP_DIRS = protos common ecc_enclave ecc utils/fabric
+FPC_PEER_DEP_DIRS = protos common ercc ecc_enclave ecc fabric
# FPC_PEER_DEP_DIRS has to include protos, ecc, ecc_enclave, common and ercc only if we run chaincode in external builder directly on host and not indirectly via docker
FPC_PEER_CLI_WRAPPER_DEP_DIRS = utils/fabric
--
2.29.2
uint32_t max_hash_len, | ||
uint32_t* actual_hash_len); | ||
|
||
bool verify_signature(uint8_t* public_key, uint32_t public_key_len, uint8_t* message, uint32_t message_len, uint8_t* signature, uint32_t signature_len); |
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.
for mock_enclave.go
(and for symmetry) you will also need the generate signature?
@@ -43,14 +41,16 @@ func NewEnclaveStub() StubInterface { | |||
} | |||
|
|||
func (e *EnclaveStub) Init(chaincodeParams, hostParams, attestationParams []byte) ([]byte, error) { | |||
const credentialsBufferMaxLen = 16 * 1024 |
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.
This number sounds like magic. Can you add a comment on how you got to this number?
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.
added comment
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.
hmm, the comment doesn't really mention on how you got to that number. That it was an estimate i already had figured out before :-)
@@ -106,6 +106,8 @@ func (e *EnclaveStub) GetEnclaveId() (string, error) { | |||
|
|||
// ChaincodeInvoke calls the enclave for transaction processing | |||
func (e *EnclaveStub) ChaincodeInvoke(stub shim.ChaincodeStubInterface, crmProtoBytes []byte) ([]byte, error) { | |||
const scresmProtoBytesMaxLen = 1024 * 100 // Let's be really conservative ... |
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.
See above, would be useful to add some comments on how we came to this number. Maybe also add a comment in the protobufs pointing to here so if we change there we also adapt number here?
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.
added comment, if there isn't enough space...it will fail. In the future we should make it adaptive.
Signed-off-by: Bruno Vavala <[email protected]>
Ah, notice that you also just found the build issue (note my commit tries to make the order of directories overall consistent across the different SUB_DIR definitions as these were also slightly different) and looking at the code i also realized the issue with auction test was composite keys ... |
We really should support the fabric shim functions for the composite keys. FPC is now redefining the machinery and translating it for Fabric. |
Signed-off-by: Bruno Vavala <[email protected]>
Well, shim.h does define composite keys somewhat consistent with go shim. Just that the implementaion merges it in a singe ecall for get/put. If you look at the full FPC design and the related ECC<->TLCC channel with the corresponding verification function, i already split that back. That said, we anyway don't support them for FPC lite right now. We could, of course, by demultiplexing them onto a single key, similar to doing so to support multiple keys. Not sure whether from a priority perspective it is on the top of the list though? I.e., given that an application can also handle it reasonably well at the application level (and us implementing in shim would still loose the data-parallel aspect of fabric), i would wait until there is push-back. Seems to me much less fundamental than support of seal (otherwise you simply won't survive a peer restart) or multi-enclave (robustness but also better security/fairness), neither of which an application writer can do anything at the app level |
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.
builds and runs now smoothly. I'm fine also with doing mock_enclave in a separate pr, in particular as (a) already in the current state we get again a working integration test and (b) doing this change for mock_enclave also bring in all the stuff mentioned in #502, so better done separately.
That's correct, but just part of the story. |
Not clear to me why why we added the '.' separator, it should also work without with the pre-fix match? but also not clear whether it has any impact on the developer? Looking at fabric go stub it seems that they (a) keep composite keys in a completely different namespace of non-composite-keys and (b) use MinUnicodeRuneValue as separator. Now the way we use the stub, we do inherit the namespace separation, i.e., (a) and as our separator is valid only during the transfer between enclave and go, it shouldn't really matter? The main problem though would only be if the developer would use a non-composite key which uses the dot, thinking it would be separate? https://github.com/hyperledger/fabric-chaincode-go/blob/master/shim/stub.go |
I speculate that originally the separator was something like
Yes, more generally: a developer must know about that (i) to use it, (ii) to avoid mistakes when choosing key strings, (iii) to avoid using Fabric's composite keys. |
Actually, this paragraph (and subsequent link) were left overs which i forgot to clean up and the paragraph above actually argues, based on the fabric go implementation that ...
... this is actually not a concern |
This PR add:
Notes: