Giter Club home page Giter Club logo

liblvpa's People

Contributors

fgenesis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

liblvpa's Issues

Errors when building the TDFS bindings

I'm trying to build the bindings with Visual Studio 2015 using these flags:

-DTTVFS_INCLUDE_DIRS="D:\source\ttvfs\ttvfs" -DTTVFS_SRC_DIR="D:\source\ttvfs\ttvfs" -DLVPA_ENABLE_LZHAM=ON -DLVPA_BUILD_TTVFS_BINDINGS=ON

I get a bunch of CMake policy errors (see below) when using these flags, and the binding project can't compile. Am not too familiar with cmake, so not sure how to fix this.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSBase.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSDebug.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSDir.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSDirInternal.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSDirView.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSFile.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSFileFuncs.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSLoader.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSRoot.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSSystemPaths.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string

D:\source\ttvfs\ttvfs/VFSTools.cpp

Invalid escape sequence \s

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

What is the Calc function call doing in _CryptBlock

@fgenesis
`bool LVPAFile::_CryptBlock(uint8 *buf, LVPAFileHeader &hdr, bool writeMode)
{
if (!(hdr.flags & (LVPAFLAG_ENCRYPTED | LVPAFLAG_SCRAMBLED)))
return true; //Not encrypted, not scrambled, nothing to do, everythings fine

uint8 mem[LVPAHash_Size];
LVPACipher ciph;

if (hdr.flags & LVPAFLAG_SCRAMBLED) {
	if (hdr.filename.empty()) {
		DEBUG(logerror("File is scrmabled, but given filename is empty, can't decrypt"));
		return false;
	}

	_CalcSaltedFilenameHash(&mem[0], hdr.filename.c_str());

	if (writeMode)
		memcpy(&hdr.hash[0], &mem[0], LVPAHash_Size);
	else if (memcmp(&mem[0], hdr.hash, LVPAHash_Size)) {
		DEBUG(logerror("_CryptBlock: wrong filename"));
		return false;
	}

	//LVPAHash::Calc(&mem[0], (uint8*)hdr.filename.c_str(), hdr.filename.length());	//This doesn't include the terminating '\0'
	LVPAHash::Calc(&mem[0], (uint8*)hdr.hash, LVPAHash_Size);

	if (hdr.flags & LVPAFLAG_ENCRYPTED) {
		LVPAHash sha(&mem[0]);
		if (_masterKey.size())
			sha.Update(&_masterKey[0], _masterKey.size());

		sha.Update(&mem[0], LVPAHash_Size);
		sha.Finalize();
	}

	ciph.Init(&mem[0], LVPAHash_Size);
}
else if (hdr.flags & LVPAFLAG_ENCRYPTED) {
	if (_masterKey.size())
		ciph.Init(&_masterKey[0], _masterKey.size());
	else {
		DEBUG(logerror("_CryptBlock: encrypted, not scrambled, and no master key!"));
	}
}

if (!hdr.cipherWarmup) {
	uint32 r = _mtrand->RandInt(128) + 30;
	hdr.cipherWarmup = uint16(r * sizeof(uint32));	//For spped, we always use full uint32 blocks
}

ciph.WarmUp(hdr.cipherWarmup);
ciph.Apply(buf, hdr.packedSize);	//We use packedSize here because the file is encrypted after the compression

//CRC will get checked elsewhere

return true;

}`

I've kind of run into a wall while digging around in your code. I understand what this function does for the most part. However, in trying to create a separate decrypt function I ran into trouble trying to figure what exactly is going on when the call to LVPAHash::Calc() function is made. You create a hash of the filename and then compare that to the hash of the file that's to be decrypted (this part makes sense to me), but then you do something with that filename again in the Calc() function. What does this do? Also, the result from this is used in the next block of code dealing with the master key. What is mem[0] being used for here?

Any info you have would be appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.