// ========================================================================= // Copy contents of CYPHER_DRIVER_INFO_v3 struct to CYPHER_DRIVER_INFO_v1 // struct // ! WARNING ! void CopyCYPHER_DRIVER_INFO_v1ToCYPHER_DRIVER_INFO_v3( IN CYPHER_DRIVER_INFO_v1* Source, OUT CYPHER_DRIVER_INFO_v3* Dest ) { unsigned int i; Dest->DriverGUID = Source->DriverGUID; FREEOTFE_MEMZERO(Dest->DriverTitle, sizeof(Dest->DriverTitle)); FREEOTFE_MEMCPY( Dest->DriverTitle, Source->DriverTitle, strlen(Source->DriverTitle) ); Dest->DriverVersionID = Source->DriverVersionID; Dest->CypherCount = Source->CypherCount; Dest->CypherDetails = FREEOTFE_MEMCALLOC( Source->CypherCount, sizeof(Dest->CypherDetails[0]) ); for (i = 0; i < Source->CypherCount; i++) { CopyCYPHER_v1ToCYPHER_v3( &(Source->CypherDetails[i]), &(Dest->CypherDetails[i]) ); } }
// ========================================================================= // Cypher driver init function // driverInfo - The structure to be initialized NTSTATUS ImpCypherDriverExtDetailsInit_v3( IN OUT CYPHER_DRIVER_INFO_v3* driverInfo ) { NTSTATUS status = STATUS_SUCCESS; int idx = -1; DEBUGOUTCYPHERIMPL(DEBUGLEV_ENTER, (TEXT("ImpCypherDriverExtDetailsInit_v3\n"))); // -- POPULATE DRIVER IDENTIFICATION -- FREEOTFE_MEMZERO(driverInfo->DriverTitle, sizeof(driverInfo->DriverTitle)); FREEOTFE_MEMCPY( driverInfo->DriverTitle, DRIVER_TITLE, strlen(DRIVER_TITLE) ); driverInfo->DriverGUID = DRIVER_GUID; driverInfo->DriverVersionID = DRIVER_CYPHER_VERSION; // -- POPULATE CYPHERS SUPPORTED -- driverInfo->CypherCount = CYPHERS_SUPPORTED; driverInfo->CypherDetails = FREEOTFE_MEMCALLOC( sizeof(CYPHER_v3), driverInfo->CypherCount ); // -- CAST5 -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_CAST5, strlen(DRIVER_CIPHER_TITLE_CAST5) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_CBC; driverInfo->CypherDetails[idx].KeySizeUnderlying = 128; driverInfo->CypherDetails[idx].BlockSize = (cast5_desc.block_length * 8); driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_CAST5; driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; DEBUGOUTCYPHERIMPL(DEBUGLEV_EXIT, (TEXT("ImpCypherDriverExtDetailsInit_v3\n"))); return status; }
// ========================================================================= // Hash driver init function // driverInfo - The structure to be initialized NTSTATUS ImpHashDriverExtDetailsInit( IN OUT HASH_DRIVER_INFO* driverInfo ) { NTSTATUS status = STATUS_SUCCESS; int idx = -1; DEBUGOUTHASHIMPL(DEBUGLEV_ENTER, (TEXT("ImpHashDriverExtDetailsInit\n"))); // -- POPULATE DRIVER IDENTIFICATION -- FREEOTFE_MEMZERO(driverInfo->DriverTitle, sizeof(driverInfo->DriverTitle)); FREEOTFE_MEMCPY( driverInfo->DriverTitle, DRIVER_TITLE, strlen(DRIVER_TITLE) ); driverInfo->DriverGUID = DRIVER_GUID; driverInfo->DriverVersionID = DRIVER_HASH_VERSION; // -- POPULATE HASHES SUPPORTED -- driverInfo->HashCount = HASHES_SUPPORTED; driverInfo->HashDetails = FREEOTFE_MEMCALLOC( sizeof(HASH), driverInfo->HashCount ); // -- Null -- idx++; FREEOTFE_MEMZERO(driverInfo->HashDetails[idx].Title, MAX_HASH_TITLE); FREEOTFE_MEMCPY( driverInfo->HashDetails[idx].Title, DRIVER_HASH_TITLE_NULL, strlen(DRIVER_HASH_TITLE_NULL) ); driverInfo->HashDetails[idx].Length = -1; driverInfo->HashDetails[idx].BlockSize = -1; driverInfo->HashDetails[idx].VersionID = DRIVER_HASH_IMPL_VERSION; driverInfo->HashDetails[idx].HashGUID = HASH_GUID_NULL; DEBUGOUTHASHIMPL(DEBUGLEV_EXIT, (TEXT("ImpHashDriverExtDetailsInit\n"))); return status; }
// ========================================================================= // Cypher driver init function // driverInfo - The structure to be initialized NTSTATUS ImpCypherDriverExtDetailsInit_v3( IN OUT CYPHER_DRIVER_INFO_v3* driverInfo ) { NTSTATUS status = STATUS_SUCCESS; int idx = -1; DEBUGOUTCYPHERIMPL(DEBUGLEV_ENTER, (TEXT("ImpCypherDriverExtDetailsInit_v3\n"))); // -- POPULATE DRIVER IDENTIFICATION -- FREEOTFE_MEMZERO(driverInfo->DriverTitle, sizeof(driverInfo->DriverTitle)); FREEOTFE_MEMCPY( driverInfo->DriverTitle, DRIVER_TITLE, strlen(DRIVER_TITLE) ); driverInfo->DriverGUID = DRIVER_GUID; driverInfo->DriverVersionID = DRIVER_CYPHER_VERSION; // -- POPULATE CYPHERS SUPPORTED -- driverInfo->CypherCount = CYPHERS_SUPPORTED; driverInfo->CypherDetails = FREEOTFE_MEMCALLOC( sizeof(CYPHER_v3), driverInfo->CypherCount ); // -- Twofish-256 XTS -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_256_XTS, strlen(DRIVER_CIPHER_TITLE_TWOFISH_256_XTS) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_XTS; driverInfo->CypherDetails[idx].KeySizeUnderlying = 256; driverInfo->CypherDetails[idx].BlockSize = TWOFISH_BLOCK_SIZE; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_256_XTS; driverInfo->CypherDetails[idx].KeySizeRequired = (2 * driverInfo->CypherDetails[idx].KeySizeUnderlying); // -- Twofish-192 XTS -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_192_XTS, strlen(DRIVER_CIPHER_TITLE_TWOFISH_192_XTS) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_XTS; driverInfo->CypherDetails[idx].KeySizeUnderlying = 192; driverInfo->CypherDetails[idx].BlockSize = TWOFISH_BLOCK_SIZE; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_192_XTS; driverInfo->CypherDetails[idx].KeySizeRequired = (2 * driverInfo->CypherDetails[idx].KeySizeUnderlying); // -- Twofish-128 XTS -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_128_XTS, strlen(DRIVER_CIPHER_TITLE_TWOFISH_128_XTS) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_XTS; driverInfo->CypherDetails[idx].KeySizeUnderlying = 128; driverInfo->CypherDetails[idx].BlockSize = TWOFISH_BLOCK_SIZE; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_128_XTS; driverInfo->CypherDetails[idx].KeySizeRequired = (2 * driverInfo->CypherDetails[idx].KeySizeUnderlying); // -- Twofish-256 CBC -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_256_CBC, strlen(DRIVER_CIPHER_TITLE_TWOFISH_256_CBC) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_CBC; driverInfo->CypherDetails[idx].KeySizeUnderlying = 256; driverInfo->CypherDetails[idx].BlockSize = TWOFISH_BLOCK_SIZE; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_256_CBC; driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; // -- Twofish-192 CBC -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_192_CBC, strlen(DRIVER_CIPHER_TITLE_TWOFISH_192_CBC) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_CBC; driverInfo->CypherDetails[idx].KeySizeUnderlying = 192; driverInfo->CypherDetails[idx].BlockSize = TWOFISH_BLOCK_SIZE; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_192_CBC; driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; // -- Twofish-128 CBC -- idx++; FREEOTFE_MEMZERO(driverInfo->CypherDetails[idx].Title, MAX_CYPHER_TITLE); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_128_CBC, strlen(DRIVER_CIPHER_TITLE_TWOFISH_128_CBC) ); driverInfo->CypherDetails[idx].Mode = CYPHER_MODE_CBC; driverInfo->CypherDetails[idx].KeySizeUnderlying = 128; driverInfo->CypherDetails[idx].BlockSize = TWOFISH_BLOCK_SIZE; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_128_CBC; driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; DEBUGOUTCYPHERIMPL(DEBUGLEV_EXIT, (TEXT("ImpCypherDriverExtDetailsInit_v3\n"))); return status; }
// ========================================================================= // Cypher driver init function // driverInfo - The structure to be initialized NTSTATUS ImpCypherDriverExtDetailsInit_v3( IN OUT CYPHER_DRIVER_INFO_v3* driverInfo ) { NTSTATUS status = STATUS_SUCCESS; int idx = -1; int blockSizeBits; DEBUGOUTCYPHERIMPL(DEBUGLEV_ENTER, (TEXT("ImpCypherDriverExtDetailsInit_v3\n"))); blockSizeBits = (twofish_desc.block_length * 8); // -- POPULATE DRIVER IDENTIFICATION -- FREEOTFE_MEMZERO(driverInfo->DriverTitle, sizeof(driverInfo->DriverTitle)); FREEOTFE_MEMCPY( driverInfo->DriverTitle, DRIVER_TITLE, strlen(DRIVER_TITLE) ); driverInfo->DriverGUID = DRIVER_GUID; driverInfo->DriverVersionID = DRIVER_CYPHER_VERSION; // -- POPULATE cyphers SUPPORTED -- driverInfo->CypherCount = CYPHERS_SUPPORTED; driverInfo->CypherDetails = FREEOTFE_MEMCALLOC( sizeof(CYPHER_v3), driverInfo->CypherCount ); // -- Twofish-256 CBC -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_256_CBC, strlen(DRIVER_CIPHER_TITLE_TWOFISH_256_CBC) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_256_CBC; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; // -- Twofish-256 XTS -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_256_XTS, strlen(DRIVER_CIPHER_TITLE_TWOFISH_256_XTS) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_256_XTS; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = (2 * driverInfo->CypherDetails[idx].KeySizeUnderlying); // -- Twofish-256 LRW -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_256_LRW, strlen(DRIVER_CIPHER_TITLE_TWOFISH_256_LRW) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_256_LRW; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying + driverInfo->CypherDetails[idx].BlockSize; // -- Twofish-192 CBC -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_192_CBC, strlen(DRIVER_CIPHER_TITLE_TWOFISH_192_CBC) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_192_CBC; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; // -- Twofish-192 XTS -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_192_XTS, strlen(DRIVER_CIPHER_TITLE_TWOFISH_192_XTS) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_192_XTS; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = (2 * driverInfo->CypherDetails[idx].KeySizeUnderlying); // -- Twofish-192 LRW -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_192_LRW, strlen(DRIVER_CIPHER_TITLE_TWOFISH_192_LRW) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_192_LRW; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying + driverInfo->CypherDetails[idx].BlockSize; // -- Twofish-128 CBC -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_128_CBC, strlen(DRIVER_CIPHER_TITLE_TWOFISH_128_CBC) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_128_CBC; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying; // -- Twofish-128 XTS -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_128_XTS, strlen(DRIVER_CIPHER_TITLE_TWOFISH_128_XTS) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_128_XTS; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = (2 * driverInfo->CypherDetails[idx].KeySizeUnderlying); // -- Twofish-128 LRW -- idx++; FREEOTFE_MEMZERO( driverInfo->CypherDetails[idx].Title, sizeof(driverInfo->CypherDetails[idx].Title) ); FREEOTFE_MEMCPY( driverInfo->CypherDetails[idx].Title, DRIVER_CIPHER_TITLE_TWOFISH_128_LRW, strlen(DRIVER_CIPHER_TITLE_TWOFISH_128_LRW) ); driverInfo->CypherDetails[idx].BlockSize = blockSizeBits; driverInfo->CypherDetails[idx].VersionID = DRIVER_CYPHER_IMPL_VERSION; driverInfo->CypherDetails[idx].CypherGUID = CIPHER_GUID_TWOFISH_128_LRW; DetermineCypherDetails( &driverInfo->CypherDetails[idx].CypherGUID, &driverInfo->CypherDetails[idx].KeySizeUnderlying, &driverInfo->CypherDetails[idx].Mode ); driverInfo->CypherDetails[idx].KeySizeRequired = driverInfo->CypherDetails[idx].KeySizeUnderlying + driverInfo->CypherDetails[idx].BlockSize; DEBUGOUTCYPHERIMPL(DEBUGLEV_EXIT, (TEXT("ImpCypherDriverExtDetailsInit_v3\n"))); return status; }
// ========================================================================= // Note: It is the *CALLERS* responsibility to free off the string returned WCHAR* GenerateDefaultMountpoint(HWND hDlg, const WCHAR* VolFilename) { const TRYMOUNTPOINTS = 100; WCHAR initBaseMountpoint[FREEOTFE_MAX_FILENAME_LENGTH]; WCHAR testMountpoint[FREEOTFE_MAX_FILENAME_LENGTH]; WCHAR useMountpoint[FREEOTFE_MAX_FILENAME_LENGTH]; int i; WCHAR* uncMachine; WCHAR* drive; WCHAR* path; WCHAR* filename; WCHAR* fileExtension; WCHAR* retval; int filenameChars; retval = NULL; // Identify default mountpoint to use... memset(initBaseMountpoint, 0, sizeof(initBaseMountpoint)); if ( (G_Options->MntPntUseVolFilename) && (VolFilename != NULL) ) { SDUParsePath( VolFilename, &uncMachine, &drive, &path, &filename, &fileExtension ); if (filename != NULL) { wcscpy(initBaseMountpoint, filename); } if (fileExtension != NULL) { if (wcsicmp(fileExtension, VOL_FILE_EXTN) == 0) { // -1 because we want to replace the "." filenameChars = wcslen(filename) - wcslen(fileExtension) - 1; initBaseMountpoint[filenameChars] = (WCHAR)NULL; } } } // Fallback... if (wcslen(initBaseMountpoint) == 0) { wcscpy(initBaseMountpoint, G_Options->MntPntDefault); } memset(useMountpoint, 0, sizeof(useMountpoint)); for (i = 1; i < TRYMOUNTPOINTS; i++) { if (i == 1) { wcscpy(testMountpoint, initBaseMountpoint); } else { _snwprintf( testMountpoint, (sizeof(testMountpoint) / sizeof(testMountpoint[0])), TEXT("%s (%d)"), initBaseMountpoint, i ); } if (ValidateMountpoint(hDlg, testMountpoint, FALSE, TRUE)) { // +1 for terminating NULL retval = FREEOTFE_MEMCALLOC(wcslen(testMountpoint) + 1, sizeof(WCHAR)); if (retval != NULL) { wcscpy(retval, testMountpoint); } break; } } return retval; }
// ========================================================================= // Hash driver init function // driverInfo - The structure to be initialized NTSTATUS ImpHashDriverExtDetailsInit( IN OUT HASH_DRIVER_INFO* driverInfo ) { NTSTATUS status = STATUS_SUCCESS; int idx = -1; DEBUGOUTHASHIMPL(DEBUGLEV_ENTER, (TEXT("ImpHashDriverExtDetailsInit\n"))); // -- POPULATE DRIVER IDENTIFICATION -- FREEOTFE_MEMZERO(driverInfo->DriverTitle, sizeof(driverInfo->DriverTitle)); FREEOTFE_MEMCPY( driverInfo->DriverTitle, DRIVER_TITLE, strlen(DRIVER_TITLE) ); driverInfo->DriverGUID = DRIVER_GUID; driverInfo->DriverVersionID = DRIVER_HASH_VERSION; // -- POPULATE HASHES SUPPORTED -- driverInfo->HashCount = HASHES_SUPPORTED; driverInfo->HashDetails = FREEOTFE_MEMCALLOC( sizeof(HASH), driverInfo->HashCount ); // -- SHA-512 -- idx++; FREEOTFE_MEMZERO(driverInfo->HashDetails[idx].Title, MAX_HASH_TITLE); FREEOTFE_MEMCPY( driverInfo->HashDetails[idx].Title, DRIVER_HASH_TITLE_SHA512, strlen(DRIVER_HASH_TITLE_SHA512) ); driverInfo->HashDetails[idx].Length = (sha512_desc.hashsize * 8); driverInfo->HashDetails[idx].BlockSize = (sha512_desc.blocksize * 8); driverInfo->HashDetails[idx].VersionID = DRIVER_HASH_IMPL_VERSION; driverInfo->HashDetails[idx].HashGUID = HASH_GUID_SHA512; // -- SHA-384 -- idx++; FREEOTFE_MEMZERO(driverInfo->HashDetails[idx].Title, MAX_HASH_TITLE); FREEOTFE_MEMCPY( driverInfo->HashDetails[idx].Title, DRIVER_HASH_TITLE_SHA384, strlen(DRIVER_HASH_TITLE_SHA384) ); driverInfo->HashDetails[idx].Length = (sha384_desc.hashsize * 8); driverInfo->HashDetails[idx].BlockSize = (sha384_desc.blocksize * 8); driverInfo->HashDetails[idx].VersionID = DRIVER_HASH_IMPL_VERSION; driverInfo->HashDetails[idx].HashGUID = HASH_GUID_SHA384; // -- SHA-256 -- idx++; FREEOTFE_MEMZERO(driverInfo->HashDetails[idx].Title, MAX_HASH_TITLE); FREEOTFE_MEMCPY( driverInfo->HashDetails[idx].Title, DRIVER_HASH_TITLE_SHA256, strlen(DRIVER_HASH_TITLE_SHA256) ); driverInfo->HashDetails[idx].Length = (sha256_desc.hashsize * 8); driverInfo->HashDetails[idx].BlockSize = (sha256_desc.blocksize * 8); driverInfo->HashDetails[idx].VersionID = DRIVER_HASH_IMPL_VERSION; driverInfo->HashDetails[idx].HashGUID = HASH_GUID_SHA256; // -- SHA-224 -- idx++; FREEOTFE_MEMZERO(driverInfo->HashDetails[idx].Title, MAX_HASH_TITLE); FREEOTFE_MEMCPY( driverInfo->HashDetails[idx].Title, DRIVER_HASH_TITLE_SHA224, strlen(DRIVER_HASH_TITLE_SHA224) ); driverInfo->HashDetails[idx].Length = (sha224_desc.hashsize * 8); driverInfo->HashDetails[idx].BlockSize = (sha224_desc.blocksize * 8); driverInfo->HashDetails[idx].VersionID = DRIVER_HASH_IMPL_VERSION; driverInfo->HashDetails[idx].HashGUID = HASH_GUID_SHA224; // -- SHA-1 -- idx++; FREEOTFE_MEMZERO(driverInfo->HashDetails[idx].Title, MAX_HASH_TITLE); FREEOTFE_MEMCPY( driverInfo->HashDetails[idx].Title, DRIVER_HASH_TITLE_SHA1, strlen(DRIVER_HASH_TITLE_SHA1) ); driverInfo->HashDetails[idx].Length = (sha1_desc.hashsize * 8); driverInfo->HashDetails[idx].BlockSize = (sha1_desc.blocksize * 8); driverInfo->HashDetails[idx].VersionID = DRIVER_HASH_IMPL_VERSION; driverInfo->HashDetails[idx].HashGUID = HASH_GUID_SHA1; DEBUGOUTHASHIMPL(DEBUGLEV_EXIT, (TEXT("ImpHashDriverExtDetailsInit\n"))); return status; }