Skip to content

Commit a9da1bc

Browse files
committed
fix sha1 name conflict
1 parent ac6eb4b commit a9da1bc

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

cheevos/cheevos_rvz.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ static void wii_encrypt_group(const uint8_t* decrypted_blocks,
17501750
const uint8_t* block_data = decrypted_blocks + (block * RVZ_WII_SECTOR_DATA_SIZE);
17511751

17521752
for (i = 0; i < RVZ_WII_H0_HASHES_PER_BLOCK; i++)
1753-
sha1_digest(block_data + (i * RVZ_WII_H0_CHUNK_SIZE), RVZ_WII_H0_CHUNK_SIZE, block_hashes[block].h0 + (i * 20));
1753+
SHA1Digest(block_data + (i * RVZ_WII_H0_CHUNK_SIZE), RVZ_WII_H0_CHUNK_SIZE, block_hashes[block].h0 + (i * 20));
17541754
}
17551755

17561756
/* Step 2: Generate H1 hashes for each block and store in subgroup base
@@ -1763,8 +1763,8 @@ static void wii_encrypt_group(const uint8_t* decrypted_blocks,
17631763
i = block % 8; /* Index within subgroup (0-7) */
17641764

17651765
/* Store this block's H1 hash in the subgroup base block */
1766-
sha1_digest(block_hashes[block].h0, 31 * 20,
1767-
block_hashes[h1_base].h1 + (i * 20));
1766+
SHA1Digest(block_hashes[block].h0, 31 * 20,
1767+
block_hashes[h1_base].h1 + (i * 20));
17681768
}
17691769

17701770
/* Step 2b: Copy H1 arrays from subgroup base to all blocks in subgroup
@@ -1786,8 +1786,8 @@ static void wii_encrypt_group(const uint8_t* decrypted_blocks,
17861786
for (subgroup = 0; subgroup < 8; subgroup++)
17871787
{
17881788
h1_base = subgroup * 8;
1789-
sha1_digest(block_hashes[h1_base].h1, 8 * 20,
1790-
block_hashes[0].h2 + (subgroup * 20));
1789+
SHA1Digest(block_hashes[h1_base].h1, 8 * 20,
1790+
block_hashes[0].h2 + (subgroup * 20));
17911791
}
17921792

17931793
/* Step 3b: Copy H2 array from block 0 to all other blocks */

libretro-common/hash/lrc_hash.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,15 +533,19 @@ static void SHA1Input(struct sha1_context *context,
533533
}
534534
}
535535

536-
void sha1_digest(const uint8_t* data, size_t len, uint8_t digest[20])
536+
void SHA1Digest(const uint8_t* data, size_t len, uint8_t digest[20])
537537
{
538+
#ifdef __APPLE__
539+
CC_SHA1(data, (CC_LONG)len, digest);
540+
#else
538541
struct sha1_context sha;
539542

540543
SHA1Reset(&sha);
541544
SHA1Input(&sha, data, len);
542545

543546
if (!SHA1Result(&sha, digest))
544547
memset(digest, 0, 20);
548+
#endif
545549
}
546550

547551
int sha1_calculate(const char *path, char *result)

libretro-common/include/lrc_hash.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ RETRO_BEGIN_DECLS
5252
void sha256_hash(char *s, const uint8_t *in, size_t len);
5353

5454
/**
55-
* sha1_digest:
55+
* SHA1Digest:
5656
* @data : Input.
5757
* @len : Size of @data.
5858
* @digest : Output.
5959
*
6060
* Hashes SHA1
6161
**/
62-
void sha1_digest(const uint8_t* data, size_t len, uint8_t digest[20]);
62+
void SHA1Digest(const uint8_t* data, size_t len, uint8_t digest[20]);
6363

6464
int sha1_calculate(const char *path, char *result);
6565

0 commit comments

Comments
 (0)