mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
embed/extmod/modtrezorcrypto: rename crc32 to checksum_crc32
this resolves really weird linker error which causes crashes when using libSDL2 which in turn uses libpng with function also named crc32
This commit is contained in:
parent
939a932219
commit
fcffdbbca7
@ -65,7 +65,7 @@ static const uint32_t crc32tab[16] = {
|
||||
};
|
||||
|
||||
/* crc is previous value for incremental computation, 0xffffffff initially */
|
||||
uint32_t crc32(const uint8_t *data, uint32_t length, uint32_t crc)
|
||||
uint32_t checksum_crc32(const uint8_t *data, uint32_t length, uint32_t crc)
|
||||
{
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
crc ^= data[i];
|
||||
|
@ -22,6 +22,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t crc32(const uint8_t *data, uint32_t length, uint32_t crc);
|
||||
uint32_t checksum_crc32(const uint8_t *data, uint32_t length, uint32_t crc);
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@ mp_obj_t mod_trezorcrypto_crc_crc32(size_t n_args, const mp_obj_t *args) {
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
|
||||
uint32_t crc = (n_args > 1) ? trezor_obj_get_uint(args[1]) : 0;
|
||||
crc = crc32(bufinfo.buf, bufinfo.len, crc ^ 0xffffffff);
|
||||
crc = checksum_crc32(bufinfo.buf, bufinfo.len, crc ^ 0xffffffff);
|
||||
return mp_obj_new_int_from_uint(crc ^ 0xffffffff);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorcrypto_crc_crc32_obj, 1, 2, mod_trezorcrypto_crc_crc32);
|
||||
|
Loading…
Reference in New Issue
Block a user