Changeset 91213 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Sep 10, 2021 5:58:08 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r90828 r91213 2830 2830 * Constructor. Needs to set sane defaults which stand the test of time. 2831 2831 */ 2832 TpmSettings::TpmSettings() : 2833 tpmType(TpmType_None) 2834 { 2835 } 2836 2837 /** 2838 * Check if all settings have default values. 2839 */ 2840 bool TpmSettings::areDefaultSettings() const 2841 { 2842 return tpmType == TpmType_None 2843 && strLocation.isEmpty(); 2844 } 2845 2846 /** 2847 * Comparison operator. This gets called from MachineConfigFile::operator==, 2848 * which in turn gets called from Machine::saveSettings to figure out whether 2849 * machine settings have really changed and thus need to be written out to disk. 2850 */ 2851 bool TpmSettings::operator==(const TpmSettings &g) const 2852 { 2853 return (this == &g) 2854 || ( tpmType == g.tpmType 2855 && strLocation == g.strLocation); 2856 } 2857 2858 /** 2859 * Constructor. Needs to set sane defaults which stand the test of time. 2860 */ 2832 2861 USBController::USBController() : 2833 2862 enmType(USBControllerType_Null) … … 3504 3533 && graphicsAdapter == h.graphicsAdapter 3505 3534 && usbSettings == h.usbSettings 3535 && tpmSettings == h.tpmSettings 3506 3536 && llNetworkAdapters == h.llNetworkAdapters 3507 3537 && llSerialPorts == h.llSerialPorts … … 4924 4954 hw.storage.llStorageControllers.push_back(sctl); 4925 4955 } 4956 } 4957 else if (pelmHwChild->nameEquals("TrustedPlatformModule")) 4958 { 4959 Utf8Str strTpmType; 4960 if (pelmHwChild->getAttributeValue("type", strTpmType)) 4961 { 4962 if (strTpmType == "None") 4963 hw.tpmSettings.tpmType = TpmType_None; 4964 else if (strTpmType == "v1_2") 4965 hw.tpmSettings.tpmType = TpmType_v1_2; 4966 else if (strTpmType == "v2_0") 4967 hw.tpmSettings.tpmType = TpmType_v2_0; 4968 else if (strTpmType == "Host") 4969 hw.tpmSettings.tpmType = TpmType_Host; 4970 else if (strTpmType == "Swtpm") 4971 hw.tpmSettings.tpmType = TpmType_Swtpm; 4972 else 4973 throw ConfigFileError(this, 4974 pelmHwChild, 4975 N_("Invalid value '%s' in TrustedPlatformModule/@type"), 4976 strTpmType.c_str()); 4977 } 4978 4979 pelmHwChild->getAttributeValue("location", hw.tpmSettings.strLocation); 4926 4980 } 4927 4981 else if ( (m->sv <= SettingsVersion_v1_14) … … 6393 6447 if (hw.biosSettings.fSmbiosUuidLittleEndian) 6394 6448 pelmBIOS->createChild("SmbiosUuidLittleEndian")->setAttribute("enabled", hw.biosSettings.fSmbiosUuidLittleEndian); 6449 } 6450 6451 if (!hw.tpmSettings.areDefaultSettings()) 6452 { 6453 xml::ElementNode *pelmTpm = pelmHardware->createChild("TrustedPlatformModule"); 6454 6455 const char *pcszTpm; 6456 switch (hw.tpmSettings.tpmType) 6457 { 6458 default: 6459 case TpmType_None: 6460 pcszTpm = "None"; 6461 break; 6462 case TpmType_v1_2: 6463 pcszTpm = "v1_2"; 6464 break; 6465 case TpmType_v2_0: 6466 pcszTpm = "v2_0"; 6467 break; 6468 case TpmType_Host: 6469 pcszTpm = "Host"; 6470 break; 6471 case TpmType_Swtpm: 6472 pcszTpm = "Swtpm"; 6473 break; 6474 } 6475 pelmTpm->setAttribute("type", pcszTpm); 6476 pelmTpm->setAttribute("location", hw.tpmSettings.strLocation); 6395 6477 } 6396 6478 … … 7687 7769 return; 7688 7770 } 7771 7772 // VirtualBox 6.2 adds a Trusted Platform Module. 7773 if ( hardwareMachine.tpmSettings.tpmType != TpmType_None 7774 || hardwareMachine.tpmSettings.strLocation.isNotEmpty()) 7775 { 7776 m->sv = SettingsVersion_v1_19; 7777 return; 7778 } 7689 7779 } 7690 7780
Note:
See TracChangeset
for help on using the changeset viewer.