Skip to content
Open
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
Empty file modified resign_linux.sh
100644 → 100755
Empty file.
15 changes: 13 additions & 2 deletions source/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@ CC=g++
CFLAGS=-pipe -fvisibility=hidden -D_GNU_SOURCE -O3 -static -D_FILE_OFFSET_BITS=64
OS_TARGET=ps3xploit_rifgen_edatresign
LDFLAGS=-lcrypto -lssl
OBJS=aes.o aes_omac.o main.o sha1.o util.o pkg2zip_aes.o pkg2zip_aes_x86.o
OBJS=aes.o aes_omac.o main.o sha1.o util.o pkg2zip_aes.o
.SILENT:
.SUFFIXES: .c .cpp .o

uname_m := $(shell uname -m)

ifeq ($(uname_m),i386)
OBJS += pkg2zip_aes_x86.o
endif
ifeq ($(uname_m),i686)
OBJS += pkg2zip_aes_x86.o
endif
ifeq ($(uname_m),x86_64)
OBJS += pkg2zip_aes_x86.o
endif

$(OS_TARGET): $(OBJS)
${LINK}
if $(CC) $(CFLAGS) $(OBJS) -o $(OS_TARGET) $(LDFLAGS) $(LIBS); then \
${LINK_OK}; \
else \
${LINK_FAILED}; \
fi


%aes_x86.o: %aes_x86.c
@echo [C] $<
Expand Down
3 changes: 3 additions & 0 deletions source/src/cputype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#if defined(__i386__)||defined(_M_X86)
#define X86CPU
#endif
13 changes: 11 additions & 2 deletions source/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define ACT_DAT_KEYBITS 128
#define RIF_KEYBITS 128
#define RAP_KEYBITS 128
#include "cputype.h"
#include "aes.h"
#include "util.h"
#include "sha1.h"
Expand Down Expand Up @@ -1041,7 +1042,9 @@ static inline void wbe64(u8 *p, u64 v)
}

#include <openssl/sha.h>
#include "pkg2zip_aes_x86.h"
#ifdef X86CPU
#include "pkg2zip_aes_x86.h"
#endif

static void decrypt_debug_pkg_normal(uint8_t *pkg, uint64_t size, uint64_t offset, int file, uint64_t len)
{
Expand Down Expand Up @@ -1105,6 +1108,7 @@ static void decrypt_debug_pkg_normal(uint8_t *pkg, uint64_t size, uint64_t offse
munmap(pkg, last_round_size);
}

#ifdef X86CPU
static void decrypt_debug_pkg_sse(uint8_t *pkg, uint64_t size, uint64_t offset, int file, uint64_t len)
{
u8 key[0x40];
Expand Down Expand Up @@ -1169,17 +1173,22 @@ static void decrypt_debug_pkg_sse(uint8_t *pkg, uint64_t size, uint64_t offset,
write(file, pkg, last_round_size);
munmap(pkg, last_round_size);
}
#endif

static void decrypt_debug_pkg(uint8_t *pkg, uint64_t size, uint64_t offset_data, int file, uint64_t len)
{
#ifdef X86CPU
if(aes128_supported_x86())
{
decrypt_debug_pkg_sse(pkg,size,offset_data, file, len);
}
else
{
#endif
decrypt_debug_pkg_normal(pkg,size,offset_data, file, len);
#ifdef X86CPU
}
#endif
}

int decrypt_retail_pkg_data(uint8_t *buf, uint64_t size, uint8_t *data_riv, uint8_t *gpkg_key)
Expand Down Expand Up @@ -1757,4 +1766,4 @@ if((strstr(argv[1], ".rap")) || (strstr(argv[1], ".RAP")))
getchar();
getchar();
return -1;
}
}