Files
termux-packages/x11-packages/godot/crypto_core.cpp.patch
termux-pacman-bot fc7f506d6b bump(x11/godot): 4.5
- Fixes https://github.com/termux/termux-packages/issues/26487

- New dependencies in this release that are added as system dependencies because they do not build within Godot for Termux unless unvendored:
  - `sdl3`
  - `libjpeg-turbo`

- Unvendor all other dependencies that can be unvendored without causing any errors or warnings in the build process:
  - `brotli`
  - `freetype`
  - `libgraphite`
  - `zlib`

- Implement `TERMUX_DEBUG_BUILD=true` support

- Force the use of system `libjpeg-turbo`, since the Godot build system currently seems unable to officially do that without patching

- Drop `libudev.so` patch because its file no longer exists, and also `libudev.so` does not exist in Android or Termux, so if the `dlopen("libudev.so.1")` has been moved somewhere else, it should be allowed to fail as the expected behavior.

> [!IMPORTANT]
> I have discovered that this release of Godot contains **code which is capable of triggering this error on Pointer-tag-checking-enabled devices:**
> ```
> Pointer tag for 0xf was truncated, see 'https://source.android.com/devices/tech/debug/tagged-pointers'.
> ```
> I have managed to debug and successfully disable this code, because in my opinion it appears to be incompatible with Android, so I do not think attempting to fix the pointer tag problem rather than bulk-disable the code would have any benefit.

- https://github.com/godotengine/godot/pull/53666

- 6efa557e9b/modules/camera/camera_linux.cpp (L80)

- The exact line of code that triggers the `Pointer tag for 0xf was truncated, see 'https://source.android.com/devices/tech/debug/tagged-pointers'.` is `free(devices);` in `CameraLinux::_update_devices()` in `camera_linux.cpp`

- Pointer-tag-checking-enabled device used to debug: Samsung Galaxy A70 SM-A705FN with LineageOS 20 Android 13

- licy183's Pointer-tag-truncated debugging guide was very helpful for this https://github.com/termux/termux-packages/pull/22911#issuecomment-2588503676
2025-10-14 16:05:21 +00:00

86 lines
3.2 KiB
Diff

--- godot-3.5.1-stable/core/crypto/crypto_core.cpp 2022-09-28 01:03:35.000000000 +0300
+++ godot-3.5.1-stable/core/crypto/crypto_core.cpp.patch 2023-02-10 11:41:17.183264630 +0300
@@ -48,17 +48,17 @@
}
Error CryptoCore::MD5Context::start() {
- int ret = mbedtls_md5_starts_ret((mbedtls_md5_context *)ctx);
+ int ret = mbedtls_md5_starts((mbedtls_md5_context *)ctx);
return ret ? FAILED : OK;
}
Error CryptoCore::MD5Context::update(const uint8_t *p_src, size_t p_len) {
- int ret = mbedtls_md5_update_ret((mbedtls_md5_context *)ctx, p_src, p_len);
+ int ret = mbedtls_md5_update((mbedtls_md5_context *)ctx, p_src, p_len);
return ret ? FAILED : OK;
}
Error CryptoCore::MD5Context::finish(unsigned char r_hash[16]) {
- int ret = mbedtls_md5_finish_ret((mbedtls_md5_context *)ctx, r_hash);
+ int ret = mbedtls_md5_finish((mbedtls_md5_context *)ctx, r_hash);
return ret ? FAILED : OK;
}
@@ -74,17 +74,17 @@
}
Error CryptoCore::SHA1Context::start() {
- int ret = mbedtls_sha1_starts_ret((mbedtls_sha1_context *)ctx);
+ int ret = mbedtls_sha1_starts((mbedtls_sha1_context *)ctx);
return ret ? FAILED : OK;
}
Error CryptoCore::SHA1Context::update(const uint8_t *p_src, size_t p_len) {
- int ret = mbedtls_sha1_update_ret((mbedtls_sha1_context *)ctx, p_src, p_len);
+ int ret = mbedtls_sha1_update((mbedtls_sha1_context *)ctx, p_src, p_len);
return ret ? FAILED : OK;
}
Error CryptoCore::SHA1Context::finish(unsigned char r_hash[20]) {
- int ret = mbedtls_sha1_finish_ret((mbedtls_sha1_context *)ctx, r_hash);
+ int ret = mbedtls_sha1_finish((mbedtls_sha1_context *)ctx, r_hash);
return ret ? FAILED : OK;
}
@@ -100,17 +100,17 @@
}
Error CryptoCore::SHA256Context::start() {
- int ret = mbedtls_sha256_starts_ret((mbedtls_sha256_context *)ctx, 0);
+ int ret = mbedtls_sha256_starts((mbedtls_sha256_context *)ctx, 0);
return ret ? FAILED : OK;
}
Error CryptoCore::SHA256Context::update(const uint8_t *p_src, size_t p_len) {
- int ret = mbedtls_sha256_update_ret((mbedtls_sha256_context *)ctx, p_src, p_len);
+ int ret = mbedtls_sha256_update((mbedtls_sha256_context *)ctx, p_src, p_len);
return ret ? FAILED : OK;
}
Error CryptoCore::SHA256Context::finish(unsigned char r_hash[32]) {
- int ret = mbedtls_sha256_finish_ret((mbedtls_sha256_context *)ctx, r_hash);
+ int ret = mbedtls_sha256_finish((mbedtls_sha256_context *)ctx, r_hash);
return ret ? FAILED : OK;
}
@@ -236,16 +236,16 @@ Error CryptoCore::b64_decode(uint8_t *r_dst, size_t p_dst_len, size_t *r_len, co
}
Error CryptoCore::md5(const uint8_t *p_src, size_t p_src_len, unsigned char r_hash[16]) {
- int ret = mbedtls_md5_ret(p_src, p_src_len, r_hash);
+ int ret = mbedtls_md5(p_src, p_src_len, r_hash);
return ret ? FAILED : OK;
}
Error CryptoCore::sha1(const uint8_t *p_src, size_t p_src_len, unsigned char r_hash[20]) {
- int ret = mbedtls_sha1_ret(p_src, p_src_len, r_hash);
+ int ret = mbedtls_sha1(p_src, p_src_len, r_hash);
return ret ? FAILED : OK;
}
Error CryptoCore::sha256(const uint8_t *p_src, size_t p_src_len, unsigned char r_hash[32]) {
- int ret = mbedtls_sha256_ret(p_src, p_src_len, r_hash, 0);
+ int ret = mbedtls_sha256(p_src, p_src_len, r_hash, 0);
return ret ? FAILED : OK;
}