-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add support to store FDO Credentials in the TPM #261
Add support to store FDO Credentials in the TPM #261
Conversation
b73a8c7
to
906307b
Compare
…NV storage Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
906307b
to
3002825
Compare
…orage Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
c8deb8c
to
c3ab532
Compare
Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
b0ff1ab
to
1b92b86
Compare
Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
- Add TPM2_NV_WriteLock/TPM2_NV_ReadLock support - Update readme for FDO TPM usage Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
…r writes Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
if (BN_bn2bin(s, sig_s) <= 0) { | ||
LOG(LOG_ERROR, "Sig s conversion Failed\n"); | ||
goto error; | ||
} | ||
|
||
*signature_length = sig_r_len + sig_s_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.
There is no check whether message_signature has enough space to store a total of sig_r_len + sig_s_len bytes - there is no validation of the buffer size . Maybe something like following check we can have
if (*signature_length > MAX_SIGNATURE_BUFFER_SIZE)
|
||
sealed_data_len = | ||
PLATFORM_HMAC_SIZE + BLOB_CONTENT_SIZE + n_bytes; | ||
|
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.
Possibility of integer overflow in sealed_data_len whenever you do any arithmetic operation please make sure total length is not crossing integer boundary otherwise integer wrap around can happen. Please all the places
*/ | ||
write_context_len = | ||
PLATFORM_HMAC_SIZE + BLOB_CONTENT_SIZE + n_bytes; | ||
|
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.
Possibility of integer overflow in write_context_len whenever you do any arithmetic operation please make sure total length is not crossing integer boundary otherwise integer wrap around can happen. Please all the places
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.
And also try to make this function more modular. Dont write very big function as it difficult to read/ maintain as well as cyclomatic matrix is very high. Check all other place also
} | ||
|
||
if (fdo_tpm_nvwrite(write_context, write_context_len, nv)) { | ||
LOG(LOG_ERROR, "Failed to write in TPM NV!\n"); |
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.
fdo_tpm_nvwrite operation has no check on returned length and no guarantee that full write has been performed without error
#else | ||
size_t dev_cred_len = | ||
fdo_blob_size((char *)FDO_CRED_NORMAL, FDO_SDK_NORMAL_DATA); | ||
#endif | ||
// Device has not yet been initialized. | ||
// Since, Normal.blob is empty, the file size will be 0 | ||
if (dev_cred_len == 0) { | ||
LOG(LOG_DEBUG, | ||
LOG(LOG_INFO, | ||
"DeviceCredential is empty. Set state to run DI\n"); |
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.
Why this is change to LOG_INFO as this might reveal extra info.. Please make sure if you are dealing with sensitive info like key, password please put log at LOG_DEBUG level. Check other places also
Add support to store FDO Credentials in the TPM NV storage as per specs