gta4xl-common: Add shim for updated libcrypto

Change-Id: I3bf41472129090c68b81afd749e9e474b88954a8
diff --git a/common.mk b/common.mk
index 3195611..df40b4a 100644
--- a/common.mk
+++ b/common.mk
@@ -166,9 +166,13 @@
 # Keymaster
 PRODUCT_PACKAGES += \
     android.hardware.keymaster@4.0-service.samsung \
-    libcrypto-v33 \
     libkeymaster4_1support.vendor:64
 
+PRODUCT_PACKAGES += \
+    libcrypto-v33 \
+    libshim_crypto:64 \
+    libssl-v33
+
 # Lineage Health
 PRODUCT_PACKAGES += \
     vendor.lineage.health-service.default
diff --git a/extract-files.sh b/extract-files.sh
index c7916be..5775faa 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -69,6 +69,8 @@
             ;;
         vendor/lib*/libskeymaster4device.so)
             "${PATCHELF}" --replace-needed libcrypto.so libcrypto-v33.so "${2}"
+            "${PATCHELF}" --add-needed libssl-v33.so "${2}"
+            "${PATCHELF}" --add-needed libshim_crypto.so "${2}"
             ;;
         vendor/lib*/libwvhidl.so)
             "${PATCHELF}" --replace-needed libprotobuf-cpp-lite-3.9.1.so libprotobuf-cpp-full-3.9.1.so "${2}"
diff --git a/shims/libcrypto/Android.bp b/shims/libcrypto/Android.bp
new file mode 100644
index 0000000..39f14e9
--- /dev/null
+++ b/shims/libcrypto/Android.bp
@@ -0,0 +1,22 @@
+//
+// Copyright (C) 2023-2024 The LineageOS Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_library_shared {
+    name: "libshim_crypto",
+    srcs: ["crypto.c"],
+    compile_multilib: "64",
+    shared_libs: ["libcrypto-v33"],
+    vendor: true,
+}
diff --git a/shims/libcrypto/crypto.c b/shims/libcrypto/crypto.c
new file mode 100644
index 0000000..2c143c5
--- /dev/null
+++ b/shims/libcrypto/crypto.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2024 The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stddef.h>
+
+extern void *sk_new_null(void);
+void *OPENSSL_sk_new_null(void) {
+    return sk_new_null();
+}
+
+extern size_t sk_num(void *sk);
+size_t OPENSSL_sk_num(void *sk) {
+    return sk_num(sk);
+}
+
+extern size_t sk_push(void *sk, void *p);
+size_t OPENSSL_sk_push(void *sk, void *p) {
+    return sk_push(sk, p);
+}
+
+extern void *sk_value(const void *sk, size_t i);
+void* OPENSSL_sk_value(const void *sk, size_t i) {
+    return sk_value(sk, i);
+}
diff --git a/vndk/Android.bp b/vndk/Android.bp
index e7ca6a3..7577665 100644
--- a/vndk/Android.bp
+++ b/vndk/Android.bp
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2023 The LineageOS Project
+// Copyright (C) 2023-2024 The LineageOS Project
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -25,3 +25,15 @@
     check_elf_files: false,
     vendor: true,
 }
+
+cc_prebuilt_library_shared {
+    name: "libssl-v33",
+    target: {
+        android_arm64: {
+            srcs: ["libssl-v33.so"],
+        },
+    },
+    compile_multilib: "64",
+    check_elf_files: false,
+    vendor: true,
+}
diff --git a/vndk/libssl-v33.so b/vndk/libssl-v33.so
new file mode 120000
index 0000000..05cee97
--- /dev/null
+++ b/vndk/libssl-v33.so
@@ -0,0 +1 @@
+../../../../prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libssl.so
\ No newline at end of file