From ca227ec27f59dca8ad1f3c81a4508906941da2e5 Mon Sep 17 00:00:00 2001 From: VitaSmith Date: Sat, 5 Dec 2020 00:57:53 +0000 Subject: [PATCH] Add AppVeyor builds and fix small issues --- .gitignore | 1 + .vs/cdecrypt.vcxproj | 6 +----- README.md | 9 ++++++++- aes.c | 2 +- appveyor.yml | 30 ++++++++++++++++++++++++++++++ cdecrypt.c | 4 ++-- 6 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 appveyor.yml diff --git a/.gitignore b/.gitignore index 9e558f5..43f582b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.d *.db *.dat +*.dec *.dll *.doc *.exe diff --git a/.vs/cdecrypt.vcxproj b/.vs/cdecrypt.vcxproj index bf0ae37..416cf80 100644 --- a/.vs/cdecrypt.vcxproj +++ b/.vs/cdecrypt.vcxproj @@ -104,7 +104,7 @@ - /DGUST_TOOLS_VERSION=$(AppVersion) %(AdditionalOptions) + /DAPP_VERSION=$(AppVersion) %(AdditionalOptions) @@ -123,7 +123,6 @@ Console true - C:\Program Files (x86)\OpenSSL-Win32\lib @@ -142,7 +141,6 @@ Console true - C:\Program Files\OpenSSL-Win64\lib @@ -164,7 +162,6 @@ true true true - C:\Program Files (x86)\OpenSSL-Win32\lib @@ -186,7 +183,6 @@ true true true - C:\Program Files\OpenSSL-Win64\lib diff --git a/README.md b/README.md index 31d0bad..73f6a35 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ # cdecrypt +[![Build status](https://img.shields.io/appveyor/ci/VitaSmith/cdecrypt.svg?style=flat-square)](https://ci.appveyor.com/project/VitaSmith/cdecrypt) +[![Github stats](https://img.shields.io/github/downloads/VitaSmith/gust_tools/total.svg?style=flat-square)](https://github.com/VitaSmith/gust_tools/releases) +[![Latest release](https://img.shields.io/github/release-pre/VitaSmith/gust_tools?style=flat-square)](https://github.com/VitaSmith/gust_tools/releases) + A commandline utility that can be used to decrypt Wii U NUS content files. -This is a fork of fork of https://code.google.com/p/cdecrypt intended for modders, +This is a fork of https://code.google.com/p/cdecrypt intended for modders, who want to explore or modify the content of the Wii U applications they own. + +Unlike other clones, this version of cdecrypt has **no** external dependencies +such as OpenSSL libraries and whatnot. A single executable file is all you need. diff --git a/aes.c b/aes.c index d447bc1..abe1b7f 100644 --- a/aes.c +++ b/aes.c @@ -566,7 +566,7 @@ int aes_setkey_dec(aes_context* ctx, const uint8_t* key, unsigned int keybits) ctx->nr = cty.nr; - SK = cty.rk + cty.nr * 4; + SK = cty.rk + (uintptr_t)cty.nr * 4; *RK++ = *SK++; *RK++ = *SK++; diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..66bde0b --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,30 @@ +image: Visual Studio 2019 + +skip_non_tags: true + +environment: + PROJECT_NAME: cdecrypt + FRIENDLY_NAME: cdecrypt + +build_script: + ps: |- + msbuild "$env:PROJECT_NAME.sln" /m /p:Configuration=Release /p:Platform=x86 /p:AppVersion=$env:APPVEYOR_REPO_TAG_NAME /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + +after_build: + ps: |- + 7z a "$env:PROJECT_NAME.zip" .\x86\Release\*.exe README.md LICENSE.txt + Get-FileHash "$env:PROJECT_NAME.zip" -Algorithm SHA256 | Format-List + +artifacts: + - path: $(PROJECT_NAME).zip + name: $(FRIENDLY_NAME) + +deploy: + release: $(APPVEYOR_REPO_TAG_NAME) + description: $(FRIENDLY_NAME) $(APPVEYOR_REPO_TAG_NAME) + provider: GitHub + auth_token: + secure: NJtYKU1LEV3Y13rBlM/EU93LwU7di/h2o/Sa0niABhIhFqD5Q2/jjbHYbS45IPhf + artifact: /.*\.zip/ + draft: false + prerelease: false diff --git a/cdecrypt.c b/cdecrypt.c index bbaf5c0..0a22a74 100644 --- a/cdecrypt.c +++ b/cdecrypt.c @@ -263,7 +263,7 @@ static bool ExtractFileHash(FILE* in, uint64_t PartDataOffset, uint64_t FileOffs goto out; } - Size -= fwrite(decdata + soffset, sizeof(char), WriteSize, dst); + Size -= fwrite(decdata + soffset, sizeof(char), (size_t)WriteSize, dst); Wrote += WriteSize; @@ -328,7 +328,7 @@ static bool ExtractFile(FILE* in, uint64_t PartDataOffset, uint64_t FileOffset, aes_crypt_cbc(&ctx, AES_DECRYPT, BLOCK_SIZE, IV, (const uint8_t*)(encdata), (uint8_t*)decdata); - Size -= fwrite(decdata + soffset, sizeof(char), WriteSize, dst); + Size -= fwrite(decdata + soffset, sizeof(char), (size_t)WriteSize, dst); Wrote += WriteSize;