From 98fd2027309ffd6fab3d9ac5b8cfb2f45ab0e57b Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Thu, 3 Jan 2013 12:04:40 +0100 Subject: [PATCH] Constify a couple of globals --- Core/ELF/PrxDecrypter.cpp | 8 ++++---- ext/libkirk/AES.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Core/ELF/PrxDecrypter.cpp b/Core/ELF/PrxDecrypter.cpp index 38ddc980f9..248d27f2b4 100644 --- a/Core/ELF/PrxDecrypter.cpp +++ b/Core/ELF/PrxDecrypter.cpp @@ -454,7 +454,7 @@ struct TAG_INFO2 u8 type; }; -static TAG_INFO2 g_tagInfo2[] = +static const TAG_INFO2 g_tagInfo2[] = { { 0x4C9494F0, keys660_k1, 0x43 }, { 0x4C9495F0, keys660_k2, 0x43 }, @@ -590,7 +590,7 @@ static TAG_INFO2 g_tagInfo2[] = }; -static TAG_INFO2 *GetTagInfo2(u32 tagFind) +static const TAG_INFO2 *GetTagInfo2(u32 tagFind) { for (u32 iTag = 0; iTag < sizeof(g_tagInfo2) / sizeof(TAG_INFO2); iTag++) { @@ -605,7 +605,7 @@ static TAG_INFO2 *GetTagInfo2(u32 tagFind) static int DecryptPRX2(const u8 *inbuf, u8 *outbuf, u32 size, u32 tag) { - TAG_INFO2 * pti = GetTagInfo2(tag); + const TAG_INFO2 *pti = GetTagInfo2(tag); if (!pti) { @@ -632,7 +632,7 @@ static int DecryptPRX2(const u8 *inbuf, u8 *outbuf, u32 size, u32 tag) return -2; } - if ((size - 0x150) < retsize) + if (((int)size - 0x150) < retsize) { return -4; } diff --git a/ext/libkirk/AES.c b/ext/libkirk/AES.c index fc80f348b9..c75748510b 100644 --- a/ext/libkirk/AES.c +++ b/ext/libkirk/AES.c @@ -37,11 +37,11 @@ //CMAC GLOBS #define AES_128 0 -unsigned char const_Rb[16] = { +const unsigned char const_Rb[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87 }; -unsigned char const_Zero[16] = { +const unsigned char const_Zero[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1294,7 +1294,7 @@ void AES_encrypt(AES_ctx *ctx, const u8 *src, u8 *dst) rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst); } -void xor_128(unsigned char *a, unsigned char *b, unsigned char *out) +void xor_128(const unsigned char *a, const unsigned char *b, unsigned char *out) { int i; for (i=0;i<16; i++)