Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Added source code
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Jun 18, 2019
1 parent 62bee22 commit 72edb5d
Show file tree
Hide file tree
Showing 61 changed files with 13,023 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "taiHEN"]
path = taiHEN
url = https://github.com/TheOfficialFloW/taiHEN
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (C) 2019 TheFloW

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
all:
make henkaku
make menu
make exploit
make copy

exploit:
cd payload; make; rm payload.bin.gz; gzip -9 -n -c payload.bin > payload.bin.gz; xxd -i payload.bin.gz > ../eboot/payload.h
cd eboot; make

henkaku:
cd taiHEN; mkdir build; cd build; cmake ..; make; cp taihen.skprx ../../bootstrap/res/taihen.skprx
cd plugin; mkdir build; cd build; cmake ..; make; cp henkaku.skprx ../../bootstrap/res/henkaku.skprx; cp henkaku.suprx ../../bootstrap/res/henkaku.suprx

menu:
cd bootstrap; mkdir build; cd build; cmake ..; make; xxd -i bootstrap.self > ../../payload/bootstrap.h

copy:
cp eboot/PBOOT.PBP F:/pspemu/PSP/GAME/NPEZ00101/PBOOT.PBP

clean:
-rm -rf taiHEN/build
-rm -rf plugin/build
-rm -rf bootstrap/build
-rm bootstrap/res/henkaku.skprx
-rm bootstrap/res/henkaku.suprx
-rm payload/bootstrap.h
-rm payload/payload.bin.gz
-rm eboot/payload.h
cd payload; make clean
cd eboot; make clean
13 changes: 13 additions & 0 deletions PrxEncrypter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CC = gcc
CFLAGS = -Wall -Os
TARGET = PrxEncrypter
OBJS = crypto.o kirk_engine.o main.o
LDFLAGS=-lz

all: $(TARGET)

$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)

clean:
$(RM) *.o $(TARGET) *.exe *.exe.stackdump
1,885 changes: 1,885 additions & 0 deletions PrxEncrypter/crypto.c

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions PrxEncrypter/crypto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#ifndef __RIJNDAEL_H
#define __RIJNDAEL_H

#include "kirk_engine.h"

#define AES_KEY_LEN_128 (128)
#define AES_KEY_LEN_192 (192)
#define AES_KEY_LEN_256 (256)

#define AES_BUFFER_SIZE (16)

#define AES_MAXKEYBITS (256)
#define AES_MAXKEYBYTES (AES_MAXKEYBITS/8)
/* for 256-bit keys, fewer for less */
#define AES_MAXROUNDS 14
#define pwuAESContextBuffer rijndael_ctx

/* The structure for key information */
typedef struct
{
int enc_only; /* context contains only encrypt schedule */
int Nr; /* key-length-dependent number of rounds */
u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */
u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */
} rijndael_ctx;

typedef struct
{
int enc_only; /* context contains only encrypt schedule */
int Nr; /* key-length-dependent number of rounds */
u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */
u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */
} AES_ctx;

int rijndael_set_key(rijndael_ctx *, const u8 *, int);
int rijndael_set_key_enc_only(rijndael_ctx *, const u8 *, int);
void rijndael_decrypt(rijndael_ctx *, const u8 *, u8 *);
void rijndael_encrypt(rijndael_ctx *, const u8 *, u8 *);

int AES_set_key(AES_ctx *ctx, const u8 *key, int bits);
void AES_encrypt(AES_ctx *ctx, const u8 *src, u8 *dst);
void AES_decrypt(AES_ctx *ctx, const u8 *src, u8 *dst);
void AES_cbc_encrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size);
void AES_cbc_decrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size);
void AES_CMAC(AES_ctx *ctx, unsigned char *input, int length, unsigned char *mac);
void AES_CMAC_forge (AES_ctx *ctx, unsigned char *input, int length, unsigned char * forge );

int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
int rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
void rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
unsigned char []);

typedef struct SHA1Context
{
unsigned Message_Digest[5]; /* Message Digest (output) */
unsigned Length_Low; /* Message length in bits */
unsigned Length_High; /* Message length in bits */
unsigned char Message_Block[64]; /* 512-bit message blocks */
int Message_Block_Index; /* Index into message block array */
int Computed; /* Is the digest computed? */
int Corrupted; /* Is the message digest corruped? */
} SHA1Context;

/*
* Function Prototypes
*/
void SHA1Reset(SHA1Context *);
int SHA1Result(SHA1Context *);
void SHA1Input( SHA1Context *,
const unsigned char *,
unsigned);

#endif /* __RIJNDAEL_H */
34 changes: 34 additions & 0 deletions PrxEncrypter/endian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* endian.h
*
* Created on: Jan 4, 2011
*/

#ifndef ENDIAN_H_
#define ENDIAN_H_

static inline u16 Swap16(u16 v)
{
return (((v & 0x00FF) << 8) | (v & 0xFF00) >> 8);
}

static inline u32 Swap32(u32 v)
{
return (((v & 0x000000FF) << 24) | ((v & 0x0000FF00) << 8) |
((v & 0xFF000000) >> 24) | ((v & 0x00FF0000) >> 8));
}

static inline u64 Swap64(u64 v)
{
return (((v & 0x00000000000000FFULL) << 56) |
((v & 0x000000000000FF00ULL) << 40) |
((v & 0x0000000000FF0000ULL) << 24) |
((v & 0x00000000FF000000ULL) << 8) |
((v & 0x000000FF00000000ULL) >> 8) |
((v & 0x0000FF0000000000ULL) >> 24) |
((v & 0x00FF000000000000ULL) >> 40) |
((v & 0xFF00000000000000ULL) >> 56));
}


#endif /* ENDIAN_H_ */
Loading

0 comments on commit 72edb5d

Please sign in to comment.