/** Exit Boot Services Event notification handler. Measure invocation and success of ExitBootServices. @param[in] Event Event whose notification function is being invoked @param[in] Context Pointer to the notification function's context **/ VOID EFIAPI OnExitBootServices ( IN EFI_EVENT Event, IN VOID *Context ) { EFI_STATUS Status; // // Measure invocation of ExitBootServices, // Status = TcgMeasureAction ( EFI_EXIT_BOOT_SERVICES_INVOCATION ); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_INVOCATION)); } // // Measure success of ExitBootServices // Status = TcgMeasureAction ( EFI_EXIT_BOOT_SERVICES_SUCCEEDED ); if (EFI_ERROR (Status)){ DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_SUCCEEDED)); } }
/** Exit Boot Services Event notification handler. Measure invocation and success of ExitBootServices. @param[in] Event Event whose notification function is being invoked @param[in] Context Pointer to the notification function's context **/ VOID EFIAPI OnExitBootServices ( IN EFI_EVENT Event, IN VOID *Context ) { EFI_STATUS Status; // // Measure invocation of ExitBootServices, // Status = TcgMeasureAction ( EFI_EXIT_BOOT_SERVICES_INVOCATION ); ASSERT_EFI_ERROR (Status); // // Measure success of ExitBootServices // Status = TcgMeasureAction ( EFI_EXIT_BOOT_SERVICES_SUCCEEDED ); ASSERT_EFI_ERROR (Status); }
/** Exit Boot Services Failed Event notification handler. Measure Failure of ExitBootServices. @param[in] Event Event whose notification function is being invoked @param[in] Context Pointer to the notification function's context **/ VOID EFIAPI OnExitBootServicesFailed ( IN EFI_EVENT Event, IN VOID *Context ) { EFI_STATUS Status; // // Measure Failure of ExitBootServices, // Status = TcgMeasureAction ( EFI_EXIT_BOOT_SERVICES_FAILED ); ASSERT_EFI_ERROR (Status); }
/** Exit Boot Services Failed Event notification handler. Measure Failure of ExitBootServices. @param[in] Event Event whose notification function is being invoked @param[in] Context Pointer to the notification function's context **/ VOID EFIAPI OnExitBootServicesFailed ( IN EFI_EVENT Event, IN VOID *Context ) { EFI_STATUS Status; // // Measure Failure of ExitBootServices, // Status = TcgMeasureAction ( EFI_EXIT_BOOT_SERVICES_FAILED ); if (EFI_ERROR (Status)){ DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_FAILED)); } }
/** Ready to Boot Event notification handler. Sequence of OS boot events is measured in this event notification handler. @param[in] Event Event whose notification function is being invoked @param[in] Context Pointer to the notification function's context **/ VOID EFIAPI OnReadyToBoot ( IN EFI_EVENT Event, IN VOID *Context ) { EFI_STATUS Status; TPM_PCRINDEX PcrIndex; if (mBootAttempts == 0) { // // Measure handoff tables. // Status = MeasureHandoffTables (); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "HOBs not Measured. Error!\n")); } // // Measure BootOrder & Boot#### variables. // Status = MeasureAllBootVariables (); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Boot Variables not Measured. Error!\n")); } // // 1. This is the first boot attempt. // Status = TcgMeasureAction ( EFI_CALLING_EFI_APPLICATION ); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", EFI_CALLING_EFI_APPLICATION)); } // // 2. Draw a line between pre-boot env and entering post-boot env. // for (PcrIndex = 0; PcrIndex < 8; PcrIndex++) { Status = MeasureSeparatorEvent (PcrIndex); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Seperator Event not Measured. Error!\n")); } } // // 3. Measure GPT. It would be done in SAP driver. // // // 4. Measure PE/COFF OS loader. It would be done in SAP driver. // // // 5. Read & Measure variable. BootOrder already measured. // } else { // // 6. Not first attempt, meaning a return from last attempt // Status = TcgMeasureAction ( EFI_RETURNING_FROM_EFI_APPLICATOIN ); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "%a not Measured. Error!\n", EFI_RETURNING_FROM_EFI_APPLICATOIN)); } } DEBUG ((EFI_D_INFO, "TPM TcgDxe Measure Data when ReadyToBoot\n")); // // Increase boot attempt counter. // mBootAttempts++; }