Skip to content

Commit

Permalink
fix the start_interface_nonce not fully randomized bug.
Browse files Browse the repository at this point in the history
fix #282

Signed-off-by: Yang, Longlong <longlong.yang@intel.com>
  • Loading branch information
longlongyang authored and jyao1 committed Aug 15, 2023
1 parent c32d9bd commit 3630f47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ libtdisp_error_code_t pci_tdisp_device_lock_interface (const void *pci_doe_conte
sizeof(interface_context->lock_interface_param),
lock_interface_param,
sizeof(*lock_interface_param));
result = libspdm_random_bytes(start_interface_nonce, sizeof(*start_interface_nonce));
result = libspdm_random_bytes(start_interface_nonce, PCI_TDISP_START_INTERFACE_NONCE_SIZE);
if (!result) {
return PCI_TDISP_ERROR_CODE_INSUFFICIENT_ENTROPY;
}

libspdm_copy_mem (&interface_context->start_interface_nonce,
sizeof(interface_context->start_interface_nonce),
start_interface_nonce,
sizeof(*start_interface_nonce));
PCI_TDISP_START_INTERFACE_NONCE_SIZE);

/* lock the interface */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ libtdisp_error_code_t pci_tdisp_device_lock_interface (const void *pci_doe_conte
sizeof(interface_context->lock_interface_param),
lock_interface_param,
sizeof(*lock_interface_param));
result = libspdm_random_bytes(start_interface_nonce, sizeof(*start_interface_nonce));
result = libspdm_random_bytes(start_interface_nonce, PCI_TDISP_START_INTERFACE_NONCE_SIZE);
if (!result) {
return PCI_TDISP_ERROR_CODE_INSUFFICIENT_ENTROPY;
}

libspdm_copy_mem (&interface_context->start_interface_nonce,
sizeof(interface_context->start_interface_nonce),
start_interface_nonce,
sizeof(*start_interface_nonce));
PCI_TDISP_START_INTERFACE_NONCE_SIZE);

/* lock the interface */

Expand Down

0 comments on commit 3630f47

Please sign in to comment.