Changeset 102361 in vbox
- Timestamp:
- Nov 28, 2023 12:53:33 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/crypto/shacrypt.h
r102360 r102361 62 62 * 63 63 * @returns IPRT status code. 64 * @param szSalt Where to store the generated salt. 65 * @param cchSalt Number of characters the generated salt should use. 64 * @param pszSalt Where to store the generated salt. 65 * @param cchSalt Size of \a pszSalt. 66 * Also marks the number of characters the generated salt should use. 66 67 * Must be >= RT_SHACRYPT_MIN_SALT_LEN and <= RT_SHACRYPT_MAX_SALT_LEN. 67 68 */ 68 RTR3DECL(int) RTCrShaCryptGenerateSalt(char szSalt[RT_SHACRYPT_MAX_SALT_LEN + 1], size_t cchSalt);69 RTR3DECL(int) RTCrShaCryptGenerateSalt(char *pszSalt, size_t cchSalt); 69 70 70 71 -
trunk/src/VBox/Runtime/common/crypto/shacrypt.cpp
r102336 r102361 49 49 50 50 51 RTR3DECL(int) RTCrShaCryptGenerateSalt(char szSalt[RT_SHACRYPT_MAX_SALT_LEN + 1], size_t cchSalt)51 RTR3DECL(int) RTCrShaCryptGenerateSalt(char *pszSalt, size_t cchSalt) 52 52 { 53 53 AssertMsgReturn(cchSalt >= RT_SHACRYPT_MIN_SALT_LEN && cchSalt <= RT_SHACRYPT_MAX_SALT_LEN, ("len=%zu\n", cchSalt), … … 56 56 static const char aRange[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890./"; 57 57 for (size_t i = 0; i < cchSalt; i++) 58 szSalt[i] = aRange[RTRandU32Ex(0, sizeof(aRange) - 2)];59 60 szSalt[RT_SHACRYPT_MAX_SALT_LEN] = '\0';58 pszSalt[i] = aRange[RTRandU32Ex(0, sizeof(aRange) - 2)]; 59 60 pszSalt[cchSalt] = '\0'; 61 61 return VINF_SUCCESS; 62 62 }
Note:
See TracChangeset
for help on using the changeset viewer.