Skip to content

Commit

Permalink
sha: don't return error on SHA_Init if already init
Browse files Browse the repository at this point in the history
  • Loading branch information
DacoTaco authored Dec 26, 2024
1 parent 9ccf804 commit b9df50e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libogc/sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@ static s32 SHA_ExecuteCommand(const ShaCommand command, const sha_context* conte

s32 SHA_Init(void)
{
if (__sha_fd >= 0)
return -1;

__sha_fd = IOS_Open("/dev/sha", 0);
if (__sha_fd < 0)
__sha_fd = IOS_Open("/dev/sha", 0);
if (__sha_fd < 0)
return __sha_fd;

Expand All @@ -113,7 +111,7 @@ s32 SHA_Init(void)
return __sha_hid;
}

return 0;
return IPC_OK;
}

s32 SHA_Close(void)
Expand Down Expand Up @@ -181,4 +179,4 @@ s32 SHA_Calculate(const void* data, const u32 data_size, void* message_digest)
return SHA_Finalize(&context, data, data_size, message_digest);
}

#endif
#endif

0 comments on commit b9df50e

Please sign in to comment.