Changeset 30829 in vbox
- Timestamp:
- Jul 14, 2010 12:50:10 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibCredentials.cpp
r28800 r30829 30 30 *******************************************************************************/ 31 31 #include <iprt/asm.h> 32 #include <iprt/mem.h> 33 #include <iprt/rand.h> 32 34 #include <iprt/string.h> 33 #include <iprt/rand.h>34 35 #include <VBox/log.h> 35 36 … … 113 114 VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint32_t cPasses) 114 115 { 115 size_t const cchUser = pszUser ? strlen(pszUser) : 0; 116 size_t const cchPassword = pszPassword ? strlen(pszPassword) : 0; 117 size_t const cchDomain = pszDomain ? strlen(pszDomain) : 0; 116 /* wipe first */ 117 if (pszUser) 118 RTMemWipeThoroughly(pszUser, strlen(pszUser) + 1, cPasses); 119 if (pszPassword) 120 RTMemWipeThoroughly(pszPassword, strlen(pszPassword) + 1, cPasses); 121 if (pszDomain) 122 RTMemWipeThoroughly(pszDomain, strlen(pszDomain) + 1, cPasses); 118 123 119 do 120 { 121 if (cchUser) 122 memset(pszUser, 0xff, cchUser); 123 if (cchPassword) 124 memset(pszPassword, 0xff, cchPassword); 125 if (cchDomain) 126 memset(pszDomain, 0xff, cchDomain); 127 ASMMemoryFence(); 128 129 if (cchUser) 130 memset(pszUser, 0x00, cchUser); 131 if (cchPassword) 132 memset(pszPassword, 0x00, cchPassword); 133 if (cchDomain) 134 memset(pszDomain, 0x00, cchDomain); 135 ASMMemoryFence(); 136 137 if (cchUser) 138 RTRandBytes(pszUser, cchUser); 139 if (cchPassword) 140 RTRandBytes(pszPassword, cchPassword); 141 if (cchDomain) 142 RTRandBytes(pszDomain, cchDomain); 143 ASMMemoryFence(); 144 145 } while (cPasses-- > 0); 146 124 /* then free. */ 147 125 RTStrFree(pszUser); 148 126 RTStrFree(pszPassword);
Note:
See TracChangeset
for help on using the changeset viewer.