Changeset 72950 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 7, 2018 4:31:24 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MediumIOImpl.cpp
r72948 r72950 31 31 #include <iprt/fsvfs.h> 32 32 #include <iprt/dvm.h> 33 #include <iprt/cpp/utils.h> 33 34 34 35 … … 41 42 struct MediumIO::Data 42 43 { 43 Data(Medium * const a_pMedium = NULL, bool a_fWritable = false, uint32_t a_cbSector = 512)44 Data(Medium * const a_pMedium, bool a_fWritable, uint32_t a_cbSector = 512) 44 45 : ptrMedium(a_pMedium) 45 46 , fWritable(a_fWritable) 46 47 , cbSector(a_cbSector) 47 , SecretKeyStore(false /*fKeyBufNonPageable*/)48 , PasswordStore(false /*fKeyBufNonPageable*/) 48 49 , pHdd(NULL) 49 50 , hVfsFile(NIL_RTVFSFILE) … … 58 59 uint32_t cbSector; 59 60 /** Secret key store used to hold the passwords for encrypted medium. */ 60 SecretKeyStore SecretKeyStore;61 SecretKeyStore PasswordStore; 61 62 /** Crypto filter settings. */ 62 63 MediumCryptoFilterSettings CryptoSettings; … … 67 68 /** VFS file for the HDD instance. */ 68 69 RTVFSFILE hVfsFile; 70 71 private: 72 Data() : PasswordStore(false) { } 69 73 }; 70 74 … … 129 133 if (rStrKeyId.isNotEmpty()) 130 134 { 131 int vrc = m-> SecretKeyStore.addSecretKey(rStrKeyId, (const uint8_t *)rStrPassword.c_str(),132 135 int vrc = m->PasswordStore.addSecretKey(rStrKeyId, (const uint8_t *)rStrPassword.c_str(), 136 rStrPassword.length() + 1 /*including the Schwarzenegger character*/); 133 137 if (vrc == VERR_NO_MEMORY) 134 138 hrc = setError(E_OUTOFMEMORY, tr("Failed to allocate enough secure memory for the key/password")); … … 142 146 if (SUCCEEDED(hrc)) 143 147 { 144 hrc = pMedium->i_openHddForIO(fWritable, &m-> SecretKeyStore, &m->pHdd, &m->LockList, &m->CryptoSettings);148 hrc = pMedium->i_openHddForIO(fWritable, &m->PasswordStore, &m->pHdd, &m->LockList, &m->CryptoSettings); 145 149 if (SUCCEEDED(hrc)) 146 150 { … … 326 330 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 327 331 RTERRINFOSTATIC ErrInfo; 328 int vrc = RTFsFatVolFormat(m->hVfsFile, 0, 0, a_fQuick ? RTFSFATVOL_FMT_F_QUICK : RTFSFATVOL_FMT_F_FULL, m->cbSector, 0,329 RTFSFATTYPE_INVALID, 0, 0, 0, 0, 0, RTErrInfoInitStatic(&ErrInfo));332 int vrc = RTFsFatVolFormat(m->hVfsFile, 0, 0, a_fQuick ? RTFSFATVOL_FMT_F_QUICK : RTFSFATVOL_FMT_F_FULL, 333 (uint16_t)m->cbSector, 0, RTFSFATTYPE_INVALID, 0, 0, 0, 0, 0, RTErrInfoInitStatic(&ErrInfo)); 330 334 alock.release(); 331 335 … … 430 434 m->LockList.Clear(); 431 435 m->ptrMedium.setNull(); 432 m-> SecretKeyStore.deleteAllSecretKeys(false /* fSuspend */, true /* fForce */);433 } 434 436 m->PasswordStore.deleteAllSecretKeys(false /* fSuspend */, true /* fForce */); 437 } 438
Note:
See TracChangeset
for help on using the changeset viewer.