From 86b7862ae45aeaa09f9020274bbb57676acba7ca Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Tue, 28 May 2024 14:18:26 +0300 Subject: android-tools: fix adb/libssl-1.1 patch GCC 14.0 being stricter regarding const pointers pointed out the issue in the adb_libssl_11.diff. RSA_get0_key returns pointers to internal data of an RSA key structure. As such, this data should use const pointers, should not be allocated and, more importantly, should not be freed. Update the patch to use const pointers, drop allocation and freeing of the 'n' big number. Signed-off-by: Dmitry Baryshkov Signed-off-by: Khem Raj --- .../android-tools/android-tools/core/adb_libssl_11.diff | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff b/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff index 177d69a97a..ddb41ea4b0 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff +++ b/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff @@ -17,9 +17,10 @@ Upstream-Status: Pending +++ b/adb/adb_auth_host.c @@ -75,6 +75,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa, BIGNUM* rem = BN_new(); - BIGNUM* n = BN_new(); +- BIGNUM* n = BN_new(); ++ const BIGNUM* n; BIGNUM* n0inv = BN_new(); -+ BIGNUM* e = BN_new(); ++ const BIGNUM* e; if (RSA_size(rsa) != RSANUMBYTES) { ret = 0; @@ -32,7 +33,7 @@ Upstream-Status: Pending BN_set_bit(r, RSANUMWORDS * 32); BN_mod_sqr(rr, r, n, ctx); BN_div(NULL, rem, n, r32, ctx); -@@ -96,7 +97,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa, +@@ -96,11 +97,10 @@ static int RSA_to_RSAPublicKey(RSA *rsa, BN_div(n, rem, n, r32, ctx); pkey->n[i] = BN_get_word(rem); } @@ -41,3 +42,7 @@ Upstream-Status: Pending out: BN_free(n0inv); +- BN_free(n); + BN_free(rem); + BN_free(r); + BN_free(rr); -- cgit v1.2.3-54-g00ecf