Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various bugs #44

Merged
merged 7 commits into from Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,31 +131,6 @@ You have to set these environment variables for cmake:
- LIBTOMCRYPT_INCLUDE_DIR=C:\libtomcrypt\build\include
- LIBTOMCRYPT_LIBRARY=C:\libtomcrypt\build\lib\tomcrypt.lib

### curl

#### Windows (example)
- Direct installation: https://curl.haxx.se/download.html
- Sources: https://github.com/curl/curl

It is easier to build curl from sources if your are on Windows. By default - it does not have any additional dependencies.
However it looks like Windows binary distribution built with mingw requires openssl binaries:
- libssl-1_1.dll
- libcrypto-1_1.dll

You have to set these environment variables for cmake:
- CURL_INCLUDE_DIR=C:\Program Files (x86)\CURL\include
- CURL_LIBRARY=C:\Program Files (x86)\CURL\lib\libcurl_imp.lib
#### Ubuntu (example)
You can install curl library with apt-get:

```
apt-get install libcurl4-gnutls-dev
```
or
```
apt-get install libcurl4-openssl-dev
```

### boost

#### Windows (example)
Expand Down
1 change: 0 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/scripts
include(scripts/ConfigureDependencies.cmake)

configure_boost()
configure_curl()
configure_zlib()
configure_libtomcrypt()

Expand Down
3 changes: 0 additions & 3 deletions cmake/build.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
set BOOST_INCLUDEDIR=N:\svnroot\src\vendor\boost_1_55_0
set BOOST_LIBRARYDIR=N:\svnroot\vendor\boost_1_55_0\vc110\lib

set CURL_INCLUDE_DIR=C:\Program Files (x86)\curl_win7\include
set CURL_LIBRARY=C:\Program Files (x86)\curl_win7\lib\libcurl-d_imp.lib

set ZLIB_INCLUDE_DIR=N:\zlib
set ZLIB_LIBRARY=N:\zlib\contrib\vstudio\vc11\x86\ZlibStatDebug\zlibstat.lib

Expand Down
3 changes: 0 additions & 3 deletions cmake/build_win32_7.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
set BOOST_INCLUDEDIR=N:\boost_1_66_0_install\win_7\include\boost-1_66
set BOOST_LIBRARYDIR=N:\boost_1_66_0_install\win_7\lib_32

set CURL_INCLUDE_DIR=C:\Program Files (x86)\curl_win7\include
set CURL_LIBRARY=C:\Program Files (x86)\curl_win7\lib\libcurl_imp.lib

set ZLIB_INCLUDE_DIR=N:\zlib
set ZLIB_LIBRARY=N:\zlib\contrib\vstudio\vc11\x86\ZlibStatRelease\zlibstat.lib

Expand Down
3 changes: 0 additions & 3 deletions cmake/build_win32_xp.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
set BOOST_INCLUDEDIR=N:\boost_1_66_0_install\win_xp\include\boost-1_66
set BOOST_LIBRARYDIR=N:\boost_1_66_0_install\win_xp\lib_32

set CURL_INCLUDE_DIR=C:\Program Files (x86)\curl_win_xp\include
set CURL_LIBRARY=C:\Program Files (x86)\curl_win_xp\lib\libcurl_imp.lib

set ZLIB_INCLUDE_DIR=N:\zlib
set ZLIB_LIBRARY=N:\zlib\contrib\vstudio\vc11\x86\ZlibStatRelease-WinXP\zlibstat.lib

Expand Down
3 changes: 0 additions & 3 deletions cmake/build_win64_7.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
set BOOST_INCLUDEDIR=N:\boost_1_66_0_install\win_7\include\boost-1_66
set BOOST_LIBRARYDIR=N:\boost_1_66_0_install\win_7\lib_64

set CURL_INCLUDE_DIR=C:\Program Files\curl_win7\include
set CURL_LIBRARY=C:\Program Files\curl_win7\lib\libcurl_imp.lib

set ZLIB_INCLUDE_DIR=N:\zlib
set ZLIB_LIBRARY=N:\zlib\contrib\vstudio\vc11\x64\ZlibStatRelease\zlibstat.lib

Expand Down
3 changes: 0 additions & 3 deletions cmake/build_win64_xp.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
set BOOST_INCLUDEDIR=N:\boost_1_66_0_install\win_xp\include\boost-1_66
set BOOST_LIBRARYDIR=N:\boost_1_66_0_install\win_xp\lib_64

set CURL_INCLUDE_DIR=C:\Program Files\curl_win_xp\include
set CURL_LIBRARY=C:\Program Files\curl_win_xp\lib\libcurl_imp.lib

set ZLIB_INCLUDE_DIR=N:\zlib
set ZLIB_LIBRARY=N:\zlib\contrib\vstudio\vc11\x64\ZlibStatRelease-WinXP\zlibstat.lib

Expand Down
25 changes: 0 additions & 25 deletions cmake/scripts/ConfigureDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,6 @@ endif()

endmacro(configure_boost)

#environment variables for configure_curl have to be set
#CURL_INCLUDE_DIR
#CURL_LIBRARY

macro(configure_curl)

message("configuring curl")

if (MSVC)
set(CURL_INCLUDE_DIR "$ENV{CURL_INCLUDE_DIR}")
set(CURL_LIBRARY "$ENV{CURL_LIBRARY}")
endif()

FIND_PACKAGE(CURL REQUIRED)

if(CURL_FOUND)
message("Using CURL_VERSION_STRING: ${CURL_VERSION_STRING}")
message("Using CURL_INCLUDE_DIRS: ${CURL_INCLUDE_DIRS}")
message("Using CURL_LIBRARIES: ${CURL_LIBRARIES}")
else()
message("Curl library is not found")
endif()

endmacro(configure_curl)

macro(configure_zlib)

message("configuring zlib")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
# LIBTOMCRYPT_INCLUDE_DIRS - The LIBTOMCRYPT include directories
# LIBTOMCRYPT_LIBRARIES - The libraries needed to use LIBTOMCRYPT

if(${LIBTOMCRYPT_INCLUDE_DIR})
motoharu-gosuto marked this conversation as resolved.
Show resolved Hide resolved
set(LIBTOMCRYPT_LIBRARIES ${LIBTOMCRYPT_LIBRARY})
if(LIBTOMCRYPT_INCLUDE_DIR)
set(LIBTOMCRYPT_INCLUDE_DIRS ${LIBTOMCRYPT_INCLUDE_DIR})
else()
find_path(LIBTOMCRYPT_INCLUDE_DIR "tomcrypt.h")
set(LIBTOMCRYPT_LIBRARIES ${LIBTOMCRYPT_LIBRARY})
set(LIBTOMCRYPT_INCLUDE_DIRS ${LIBTOMCRYPT_INCLUDE_DIR})
endif()

if(${LIBTOMCRYPT_LIBRARY})
set(LIBTOMCRYPT_INCLUDE_DIRS ${LIBTOMCRYPT_INCLUDE_DIR})
if(LIBTOMCRYPT_LIBRARY)
set(LIBTOMCRYPT_LIBRARIES ${LIBTOMCRYPT_LIBRARY})
else()
find_library(LIBTOMCRYPT_LIBRARY tomcrypt)
set(LIBTOMCRYPT_INCLUDE_DIRS ${LIBTOMCRYPT_INCLUDE_DIR})
set(LIBTOMCRYPT_LIBRARIES ${LIBTOMCRYPT_LIBRARY})
endif()

include(FindPackageHandleStandardArgs)
Expand Down
5 changes: 1 addition & 4 deletions psvpfsparser/F00DKeyEncryptorFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "F00DKeyEncryptorFactory.h"

#include "F00DUrlKeyEncryptor.h"
#include "F00DFileKeyEncryptor.h"
#include "F00DNativeKeyEncryptor.h"

Expand All @@ -9,8 +8,6 @@ std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::string>(
{
switch(type)
{
//case F00DEncryptorTypes::url:
// return std::make_shared<F00DUrlKeyEncryptor>(arg);
case F00DEncryptorTypes::file:
return std::make_shared<F00DFileKeyEncryptor>(arg);
default:
Expand All @@ -19,7 +16,7 @@ std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::string>(
}

template<>
static std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::shared_ptr<ICryptoOperations> >(F00DEncryptorTypes type, std::shared_ptr<ICryptoOperations> arg)
std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::shared_ptr<ICryptoOperations> >(F00DEncryptorTypes type, std::shared_ptr<ICryptoOperations> arg)
{
switch(type)
{
Expand Down
5 changes: 2 additions & 3 deletions psvpfsparser/F00DKeyEncryptorFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

enum class F00DEncryptorTypes
{
url,
file,
native
};
Expand All @@ -21,7 +20,7 @@ class F00DKeyEncryptorFactory
};

template<>
static std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::string>(F00DEncryptorTypes type, std::string arg);
std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::string>(F00DEncryptorTypes type, std::string arg);

template<>
static std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::shared_ptr<ICryptoOperations> >(F00DEncryptorTypes type, std::shared_ptr<ICryptoOperations> arg);
std::shared_ptr<IF00DKeyEncryptor> F00DKeyEncryptorFactory::create<std::shared_ptr<ICryptoOperations> >(F00DEncryptorTypes type, std::shared_ptr<ICryptoOperations> arg);
8 changes: 4 additions & 4 deletions psvpfsparser/F00DNativeKeyEncryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ int F00DNativeKeyEncryptor::encrypt_key(const unsigned char* key, int key_size,
key_size != 0x100)
return -1;

std::string keyStr = byte_array_to_string(key, key_size / 8);
std::uint32_t nbytes = key_size / 8;
std::string keyStr = byte_array_to_string(key, nbytes);

auto kit = m_keyCache.find(keyStr);
if(kit != m_keyCache.end())
{
std::uint32_t nbytes = key_size / 8;
string_to_byte_array(kit->second, nbytes, drv_key);
return 0;
}
else
{
if(kprx_auth_service_0x50001(key, key_size, drv_key, 0) < 0)
if(kprx_auth_service_0x50001(key, nbytes, drv_key, 0) < 0)
This conversation was marked as resolved.
Show resolved Hide resolved
return -1;

std::string drv_keyStr = byte_array_to_string(drv_key, key_size / 8);
std::string drv_keyStr = byte_array_to_string(drv_key, nbytes);

m_keyCache.insert(std::make_pair(keyStr, drv_keyStr));

Expand Down
162 changes: 0 additions & 162 deletions psvpfsparser/F00DUrlKeyEncryptor.cpp

This file was deleted.

Loading