Skip to content

Commit

Permalink
Add support to store device credentials and device status inside TPM …
Browse files Browse the repository at this point in the history
…NV storage

Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
  • Loading branch information
shrikant1407 committed Nov 13, 2023
1 parent e1dc9d0 commit 906307b
Show file tree
Hide file tree
Showing 14 changed files with 1,579 additions and 30 deletions.
1 change: 1 addition & 0 deletions app/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#if defined(DEVICE_TPM20_ENABLED)
#include "tpm20_Utils.h"
#include "fdo_crypto.h"
#include "tpm2_nv_storage.h"
#endif

#if !defined(DEVICE_TPM20_ENABLED)
Expand Down
21 changes: 20 additions & 1 deletion app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "cse_utils.h"
#include "cse_tools.h"
#endif
#if defined(DEVICE_TPM20_ENABLED)
#include "tpm20_Utils.h"
#include "fdo_crypto.h"
#endif

#define STORAGE_NAMESPACE "storage"
#define OWNERSHIP_TRANSFER_FILE "data/owner_transfer"
Expand Down Expand Up @@ -273,13 +277,28 @@ int app_main(bool is_resale)
#endif /* SECURE_ELEMENT */

#if !defined(DEVICE_CSE_ENABLED)
LOG(LOG_DEBUG, "CSE not enabled, Normal Blob Modules loaded!\n");
#if defined(DEVICE_TPM20_ENABLED)
if (0 == is_valid_tpm_data_protection_key_present()) {
if (0 != fdo_generate_storage_hmac_key()) {
LOG(LOG_ERROR, "Failed to generate TPM data protection"
" key.\n");
ret = -1;
goto end;
}

LOG(LOG_DEBUG,
"TPM data protection key generated successfully.\n");
}
#else
LOG(LOG_DEBUG,
"CSE and TPM not enabled, Normal Blob Modules loaded!\n");
if (-1 == configure_normal_blob()) {
LOG(LOG_ERROR,
"Provisioning Normal blob for the 1st time failed!\n");
ret = -1;
goto end;
}
#endif
#endif

/* List and Init all Sv_info modules */
Expand Down
16 changes: 9 additions & 7 deletions cmake/blob_path.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(TARGET_OS MATCHES linux)
-DDEVICE_CSE_ENABLED
)
endif()

if (${MTLS} MATCHES true)
client_sdk_compile_definitions(
-DSSL_CERT=\"${BLOB_PATH}/data/apiUser.pem\"
Expand Down Expand Up @@ -176,9 +176,11 @@ if(TARGET_OS MATCHES linux)
# Configure if needed at a later point
# configure_file(${BLOB_PATH}/data/Normal.blob NEWLINE_STYLE DOS)

file(WRITE ${BLOB_PATH}/data/platform_iv.bin "")
file(WRITE ${BLOB_PATH}/data/platform_hmac_key.bin "")
file(WRITE ${BLOB_PATH}/data/platform_aes_key.bin "")
file(WRITE ${BLOB_PATH}/data/Normal.blob "")
file(WRITE ${BLOB_PATH}/data/Secure.blob "")
file(WRITE ${BLOB_PATH}/data/raw.blob "")
if (NOT ${DA} MATCHES tpm)
file(WRITE ${BLOB_PATH}/data/platform_iv.bin "")
file(WRITE ${BLOB_PATH}/data/platform_hmac_key.bin "")
file(WRITE ${BLOB_PATH}/data/platform_aes_key.bin "")
file(WRITE ${BLOB_PATH}/data/Normal.blob "")
file(WRITE ${BLOB_PATH}/data/Secure.blob "")
file(WRITE ${BLOB_PATH}/data/raw.blob "")
endif()
Loading

0 comments on commit 906307b

Please sign in to comment.