Skip to content

Commit 0a35583

Browse files
authored
sha: fix define name to not confuse and clash with actual sha block size (#155)
1 parent 9ffad97 commit 0a35583

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

gc/ogc/sha.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ distribution.
3838
extern "C" {
3939
#endif /* __cplusplus */
4040

41-
#define SHA_BLOCK_SIZE 0x10000
41+
#define SHA_MSGBLOCK_SIZE 0x10000
4242

4343
typedef struct
4444
{

libogc/sha.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ static s32 SHA_ExecuteCommand(const ShaCommand command, sha_context* context, co
5252
if(params == NULL)
5353
return -4;
5454

55-
for (u32 i = 0; i < data_size; i += SHA_BLOCK_SIZE) {
56-
u32 size = SHA_BLOCK_SIZE;
55+
for (u32 i = 0; i < data_size; i += SHA_MSGBLOCK_SIZE) {
56+
u32 size = SHA_MSGBLOCK_SIZE;
5757
ShaCommand block_cmd = command;
5858

5959
//if it's the final block, set size correctly.
6060
//if it's not the final block, and we got a finalize, we will first send the add command
61-
if(i+SHA_BLOCK_SIZE >= data_size)
61+
if(i+SHA_MSGBLOCK_SIZE >= data_size)
6262
size = data_size - i;
6363
else if(command == FinalizeHash)
6464
block_cmd = AddData;
@@ -151,7 +151,7 @@ s32 SHA_Input(sha_context* context, const void* data, const u32 data_size)
151151
if(context == NULL || data == NULL || data_size == 0)
152152
return -1;
153153

154-
if((((u32)context) & 0x1F) || (((u32)data) & 0x3F) || (data_size & ~(SHA_BLOCK_SIZE-1)) != 0)
154+
if((((u32)context) & 0x1F) || (((u32)data) & 0x3F) || (data_size & ~(SHA_MSGBLOCK_SIZE-1)) != 0)
155155
return -4;
156156

157157
return SHA_ExecuteCommand(AddData, context, data, data_size, NULL);

0 commit comments

Comments
 (0)