Skip to content

Commit

Permalink
[efi] Drop to TPL_APPLICATION when gathering entropy
Browse files Browse the repository at this point in the history
Commit c89a446 ("[efi] Run at TPL_CALLBACK to protect against UEFI
timers") introduced a regression in the EFI entropy gathering code.
When the EFI_RNG_PROTOCOL is not present, we fall back to using timer
interrupts (as for the BIOS build).  Since timer interrupts are
disabled at TPL_CALLBACK, WaitForEvent() fails and no entropy can be
gathered.

Fix by dropping to TPL_APPLICATION while entropy gathering is enabled.

Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 12, 2018
1 parent c84f9d6 commit d8c500b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/interface/efi/efi_entropy.c
Expand Up @@ -79,6 +79,9 @@ static int efi_entropy_enable ( void ) {
DBGC ( &tick, "ENTROPY %s RNG protocol\n",
( efirng ? "has" : "has no" ) );

/* Drop to TPL_APPLICATION to allow timer tick event to take place */
bs->RestoreTPL ( TPL_APPLICATION );

/* Create timer tick event */
if ( ( efirc = bs->CreateEvent ( EVT_TIMER, TPL_NOTIFY, NULL, NULL,
&tick ) ) != 0 ) {
Expand All @@ -100,6 +103,9 @@ static void efi_entropy_disable ( void ) {

/* Close timer tick event */
bs->CloseEvent ( tick );

/* Return to TPL_CALLBACK */
bs->RaiseTPL ( TPL_CALLBACK );
}

/**
Expand Down

0 comments on commit d8c500b

Please sign in to comment.