Skip to content

Commit b9df50e

Browse files
authored
sha: don't return error on SHA_Init if already init
1 parent 9ccf804 commit b9df50e

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

libogc/sha.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ static s32 SHA_ExecuteCommand(const ShaCommand command, const sha_context* conte
9696

9797
s32 SHA_Init(void)
9898
{
99-
if (__sha_fd >= 0)
100-
return -1;
101-
102-
__sha_fd = IOS_Open("/dev/sha", 0);
99+
if (__sha_fd < 0)
100+
__sha_fd = IOS_Open("/dev/sha", 0);
103101
if (__sha_fd < 0)
104102
return __sha_fd;
105103

@@ -113,7 +111,7 @@ s32 SHA_Init(void)
113111
return __sha_hid;
114112
}
115113

116-
return 0;
114+
return IPC_OK;
117115
}
118116

119117
s32 SHA_Close(void)
@@ -181,4 +179,4 @@ s32 SHA_Calculate(const void* data, const u32 data_size, void* message_digest)
181179
return SHA_Finalize(&context, data, data_size, message_digest);
182180
}
183181

184-
#endif
182+
#endif

0 commit comments

Comments
 (0)