Comments (5)
I think we want to handle this both in the seal/unseal executable main
functions, (early exit with a message if you hand it a size 0 file) and in the library seal/unseal library functions.
from kmyth.
Looking more closely at the code, I think by putting the check in kmyth_wrap_input
in src/util/tpm2_kmyth_seal.c
is the best place from the library perspective.
The src/seal/main.c
executable should also check before doing all the TPM work.
from kmyth.
The first fix seems easy enough, but for the check in src/seal/main.c
it looks like we would want to make a call to read_arbitrary_file()
to get the data length. This is already done later on, in kmyth_wrap_input
in src/util/tpm2_kmyth_seal.c
. Doing this twice seems like it may be redundant if we are not passing along the output values.
from kmyth.
That's a good point. For now let's just fix kmyth_wrap_input
. I still don't like the idea of doing all that TPM work just to find out the file has zero size, but it's going to be a bigger job to do the filesize check reasonably, so we can keep it in mind for future work if we decide it's worthwhile.
from kmyth.
I'm a bit late to the discussion but I figured this was relevant.
I'm adding error handling to read_arbitrary_file
in src/util/tpm2_kmyth_io.c
. A file size of 0 bytes may cause malloc
to return NULL
, which is indistinguishable from an allocation failure. Right now (with my edits) this returns 1, which would get caught and handled right before the fix added in #26, resurrecting the original issue.
I can change this so that read_arbitrary_file
just short circuits and returns early when it encounters a 0 byte file, so that the fix in #26 still applies as expected. Would that be the preferred error flow here?
On the opposite end of spectrum, what is the maximum file size that should be supported? We could just rely on malloc
erroring out in that case but that may not be sufficient. Is there a reasonable maximum threshold? Or is this out-of-scope here anyway since the user is supplying the file?
from kmyth.
Related Issues (20)
- Derefencing raw pointer without nullcheck HOT 1
- Add formatting for SGX-sealed files. HOT 1
- Make logger prefix optional for logging to screen
- Create-sgx-demo HOT 1
- Investigate ECDH session key generation in a single step HOT 3
- Investigate Merging Makefiles for SGX demo and test HOT 1
- Update enclave_retrieve_key() API HOT 1
- Enclave to Enclave Attestation
- 'Retrieve Key' Protocol Improvement HOT 1
- Design and implement kmyth-reseal workflow
- kmyth-seal with -g (get expected policy digest) option should not produce empty .ski file HOT 1
- Detect TPM "Policy-OR" criteria from .ski file (remove "policy OR" command line option for kmyth-unseal)
- Separate marshalling tests from formatting_tools tests HOT 1
- Create test to verify PolicyOR
- Add unit tests for kmyth seal application HOT 2
- Add unit tests for kmyth unseal application HOT 2
- Add unit tests for kmyth getkey application HOT 2
- Unused sk_handle parameter in create_sk() function HOT 1
- Fix logic in check_if_srk()
- Make get_srk_handle() more readable/modular
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kmyth.