From b9df50e7ca94d865ec7c01866218e21e3cf7c489 Mon Sep 17 00:00:00 2001 From: DacoTaco Date: Thu, 26 Dec 2024 12:09:28 +0100 Subject: [PATCH] sha: don't return error on SHA_Init if already init --- libogc/sha.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libogc/sha.c b/libogc/sha.c index 813874d1..7b689db5 100644 --- a/libogc/sha.c +++ b/libogc/sha.c @@ -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; @@ -113,7 +111,7 @@ s32 SHA_Init(void) return __sha_hid; } - return 0; + return IPC_OK; } s32 SHA_Close(void) @@ -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 \ No newline at end of file +#endif