├── .github
└── workflows
│ └── android.yml
├── .gitignore
├── .gitmodules
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ ├── AndroidManifest.xml
│ └── java
│ │ └── io
│ │ └── github
│ │ └── vvb2060
│ │ └── ndk
│ │ └── boringssl
│ │ └── test
│ │ └── BoringSSLTest.java
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── io
│ └── github
│ └── vvb2060
│ └── ndk
│ └── boringssl
│ └── test
│ └── MainActivity.java
├── boringssl
├── .gitignore
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── native
│ ├── Android.mk
│ ├── Application.mk
│ ├── BoringSSL.mk
│ ├── build-executable.mk
│ ├── patchs
│ ├── cert_dir.patch
│ └── gen.patch
│ └── sources.mk
├── build.gradle
├── copy_test_files.sh
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.github/workflows/android.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on: [ push, pull_request ]
4 |
5 | jobs:
6 | build:
7 | name: Build
8 | runs-on: ubuntu-24.04
9 |
10 | steps:
11 | - name: Check out
12 | uses: actions/checkout@v4
13 | with:
14 | submodules: 'recursive'
15 | - name: Set up JDK 21
16 | uses: actions/setup-java@v4
17 | with:
18 | distribution: 'temurin'
19 | java-version: '21'
20 | - name: Configuration Environment
21 | shell: bash
22 | run: |
23 | echo 'android.sdk.channel=3' >> gradle.properties
24 | echo 'android.native.buildOutput=verbose' >> gradle.properties
25 | echo 'org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8' >> gradle.properties
26 | echo 'org.gradle.caching=true' >> gradle.properties
27 |
28 | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
29 | sudo udevadm control --reload-rules
30 | sudo udevadm trigger --name-match=kvm
31 | sudo usermod -aG kvm,render $USER
32 | yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null || true
33 | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --channel=3 platform-tools emulator
34 |
35 | sh copy_test_files.sh
36 | git apply boringssl/src/main/native/patchs/*.patch
37 | rm -rf boringssl/src/main/native/src/third_party/googletest
38 | curl -sL https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz | tar -xz -C boringssl/src/main/native/src/third_party
39 | mv boringssl/src/main/native/src/third_party/googletest-1.15.2 boringssl/src/main/native/src/third_party/googletest
40 | - name: Setup Gradle
41 | uses: gradle/actions/setup-gradle@v4
42 | - name: Build with Gradle
43 | run: |
44 | ./gradlew :a:assemble
45 | ./gradlew :b:publishToMavenLocal
46 | ./gradlew :b:publishToMavenLocal -PenableLTO=1
47 | - name: Test with Gradle
48 | run: |
49 | ./gradlew :a:allDevicesDebugAndroidTest
50 | - name: Upload app
51 | if: ${{ always() }}
52 | uses: actions/upload-artifact@v4
53 | with:
54 | name: app
55 | path: app/build/outputs
56 | compression-level: 9
57 | - name: Upload library
58 | if: ${{ always() }}
59 | uses: actions/upload-artifact@v4
60 | with:
61 | name: library
62 | path: ~/.m2
63 | compression-level: 9
64 | include-hidden-files: true
65 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 | .cxx
10 | /app/src/main/assets
11 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "boringssl/src/main/native/src"]
2 | path = boringssl/src/main/native/src
3 | url = https://github.com/google/boringssl.git
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BoringSSL Android
2 |
3 | boringssl static library prefab for android
4 |
5 | This library is based on the [boringssl repo](https://github.com/google/boringssl).
6 |
7 | ## Integration
8 |
9 | Gradle:
10 |
11 | ```gradle
12 | implementation("io.github.vvb2060.ndk:boringssl:20250114")
13 | // or LTO version (~40MiB), it does not strip any debug info
14 | implementation("io.github.vvb2060.ndk:boringssl:20250114-lto-ndk28")
15 | ```
16 |
17 | This library is [Prefab](https://google.github.io/prefab/), so you will need to enable it in your project (Android Gradle Plugin 4.1+):
18 |
19 | ```gradle
20 | android {
21 | ...
22 | buildFeatures {
23 | ...
24 | prefab = true
25 | }
26 | }
27 | ```
28 |
29 | ## Usage
30 |
31 | ### ndk-build
32 |
33 | you can use `crypto_static`/`ssl_static` in your `Android.mk`.
34 | For example, if your application defines `libapp.so` and it uses `ssl_static`, your `Android.mk` file should include the following:
35 |
36 | ```makefile
37 | include $(CLEAR_VARS)
38 | LOCAL_MODULE := app
39 | LOCAL_SRC_FILES := app.cpp
40 | LOCAL_STATIC_LIBRARIES := ssl_static
41 | include $(BUILD_SHARED_LIBRARY)
42 |
43 | # If you don't need your project to build with NDKs older than r21, you can omit
44 | # this block.
45 | ifneq ($(call ndk-major-at-least,21),true)
46 | $(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
47 | endif
48 |
49 | $(call import-module,prefab/boringssl)
50 | ```
51 |
52 | ### CMake
53 |
54 | you can use `crypto_static`/`ssl_static` in your `CMakeLists.txt`.
55 | For example, if your application defines `libapp.so` and it uses `crypto_static`, your `CMakeLists.txt` file should include the following:
56 |
57 | ```cmake
58 | add_library(app SHARED app.cpp)
59 |
60 | # Add these two lines.
61 | find_package(boringssl REQUIRED CONFIG)
62 | target_link_libraries(app boringssl::crypto_static)
63 | ```
64 |
65 | ## Changelog
66 |
67 | * 1.0 [android-r-beta-3](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-r-beta-3) [2fb729d4f36beaf263ad85e24a790b571652679c](https://github.com/google/boringssl/tree/2fb729d4f36beaf263ad85e24a790b571652679c)
68 | * 2.0 [android-s-preview-1](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-s-preview-1) [ae2bb641735447496bed334c495e4868b981fe32](https://github.com/google/boringssl/tree/ae2bb641735447496bed334c495e4868b981fe32)
69 | * 3.0 [android-t-preview-2](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-t-preview-2) [345c86b1cfcc478a71a9a71f0206893fd16ae912](https://github.com/google/boringssl/tree/345c86b1cfcc478a71a9a71f0206893fd16ae912)
70 | * 3.1 [android-13.0.0_r18](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-13.0.0_r18) [base 1530333b25589ee4d4d52b10e78ee55dd82f6dcd](https://github.com/google/boringssl/tree/1530333b25589ee4d4d52b10e78ee55dd82f6dcd) [patch adeb743478cf1894e0148e46044dc51f091a312e](https://github.com/google/boringssl/tree/adeb743478cf1894e0148e46044dc51f091a312e)
71 | * 4.0 [android-14.0.0_r18](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-14.0.0_r18) [base 32b51305debe43e38e7bf2c2b13c4ebf3b474e80](https://github.com/google/boringssl/tree/32b51305debe43e38e7bf2c2b13c4ebf3b474e80) [patch a430310d6563c0734ddafca7731570dfb683dc19](https://github.com/google/boringssl/tree/a430310d6563c0734ddafca7731570dfb683dc19)
72 | * 4.1 [android-14.0.0_r54](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-14.0.0_r54) [538b2a6cf0497cf8bb61ae726a484a3d7a34e54e](https://github.com/google/boringssl/tree/538b2a6cf0497cf8bb61ae726a484a3d7a34e54e)
73 | * 5.0 [android-15.0.0_r1](https://android.googlesource.com/platform/external/boringssl/+/refs/tags/android-15.0.0_r1) [4d50a595b49a2e7b7017060a4d402c4ee9fe28a2](https://github.com/google/boringssl/tree/4d50a595b49a2e7b7017060a4d402c4ee9fe28a2)
74 | * 20241024 [0.20241024.0](https://github.com/google/boringssl/releases/tag/0.20241024.0) [781a72b2aa513bbbf01b9bc670b0495a6b115968](https://github.com/google/boringssl/tree/781a72b2aa513bbbf01b9bc670b0495a6b115968)
75 | * 20250114 [0.20250114.0](https://github.com/google/boringssl/releases/tag/0.20250114.0)
76 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | import com.android.build.api.dsl.ManagedVirtualDevice
2 |
3 | plugins {
4 | id 'com.android.application'
5 | }
6 |
7 | android {
8 | compileSdk = 35
9 | buildToolsVersion = '35.0.1'
10 | ndkVersion = '28.0.12674087'
11 | namespace = 'io.github.vvb2060.ndk.boringssl.test'
12 | defaultConfig {
13 | minSdk = 21
14 | targetSdk = 35
15 | versionCode = 20250114
16 | versionName = '20250114'
17 | testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'
18 | externalNativeBuild {
19 | ndkBuild {
20 | arguments += [ "-j${Runtime.runtime.availableProcessors()}" ]
21 | }
22 | }
23 | ndk {
24 | debugSymbolLevel = "FULL"
25 | abiFilters += [ "x86", "x86_64", "armeabi-v7a", "arm64-v8a", "riscv64" ]
26 | }
27 | }
28 |
29 | buildTypes {
30 | release {
31 | minifyEnabled = true
32 | shrinkResources = true
33 | signingConfig = signingConfigs.debug
34 | proguardFiles("proguard-rules.pro")
35 | externalNativeBuild {
36 | ndkBuild {
37 | arguments += [ "enableLTO=1" ]
38 | }
39 | }
40 | }
41 | }
42 |
43 | externalNativeBuild {
44 | ndkBuild {
45 | path file('../boringssl/src/main/native/Android.mk')
46 | }
47 | }
48 |
49 | compileOptions {
50 | coreLibraryDesugaringEnabled = true
51 | sourceCompatibility = JavaVersion.VERSION_21
52 | targetCompatibility = JavaVersion.VERSION_21
53 | }
54 |
55 | buildFeatures {
56 | buildConfig = false
57 | prefab = true
58 | }
59 |
60 | lint {
61 | checkReleaseBuilds = false
62 | }
63 |
64 | dependenciesInfo {
65 | includeInApk = false
66 | }
67 |
68 | packagingOptions {
69 | jniLibs {
70 | useLegacyPackaging = false
71 | }
72 | }
73 |
74 | testOptions {
75 | devices {
76 | api30(ManagedVirtualDevice) {
77 | device = "Nexus One"
78 | apiLevel = 30
79 | systemImageSource = "aosp-atd"
80 | require64Bit = true
81 | }
82 | }
83 | }
84 | }
85 |
86 | dependencies {
87 | coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'
88 | androidTestImplementation 'androidx.test.ext:junit:1.2.1'
89 | androidTestImplementation 'androidx.test:rules:1.6.1'
90 | }
91 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | -repackageclasses
2 | -allowaccessmodification
3 |
--------------------------------------------------------------------------------
/app/src/androidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/io/github/vvb2060/ndk/boringssl/test/BoringSSLTest.java:
--------------------------------------------------------------------------------
1 | package io.github.vvb2060.ndk.boringssl.test;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import android.content.Context;
6 | import android.os.Build;
7 | import android.util.Log;
8 |
9 | import androidx.test.ext.junit.runners.AndroidJUnit4;
10 | import androidx.test.platform.app.InstrumentationRegistry;
11 |
12 | import org.junit.Test;
13 | import org.junit.runner.RunWith;
14 |
15 | import java.io.IOException;
16 | import java.util.List;
17 |
18 | @RunWith(AndroidJUnit4.class)
19 | public class BoringSSLTest {
20 | private final static String TAG = BoringSSLTest.class.getSimpleName();
21 | private final static String ssl = "/libssl_test.so";
22 | private final static String crypto = "/libcrypto_test.so";
23 | private final static String separator = "!/lib/";
24 |
25 | private final Context context;
26 | private final String apkPath;
27 |
28 | public BoringSSLTest() throws IOException {
29 | context = InstrumentationRegistry.getInstrumentation().getTargetContext();
30 | apkPath = context.getApplicationInfo().sourceDir;
31 | MainActivity.copyTestFiles(context, apkPath);
32 | }
33 |
34 | private void startProcess(String... command) throws Exception {
35 | var ret = MainActivity.startProcess(context, List.of(command), (line) -> Log.v(TAG, line));
36 | assertEquals(0, ret);
37 | }
38 |
39 | @Test
40 | public void sslTest32Bit() throws Exception {
41 | if (Build.SUPPORTED_32_BIT_ABIS.length == 0) return;
42 | var path = apkPath + separator + Build.SUPPORTED_32_BIT_ABIS[0] + ssl;
43 | startProcess("linker", path);
44 | }
45 |
46 | @Test
47 | public void sslTest64Bit() throws Exception {
48 | if (Build.SUPPORTED_64_BIT_ABIS.length == 0) return;
49 | var path = apkPath + separator + Build.SUPPORTED_64_BIT_ABIS[0] + ssl;
50 | startProcess("linker64", path);
51 | }
52 |
53 | @Test
54 | public void cryptoTest32Bit() throws Exception {
55 | if (Build.SUPPORTED_32_BIT_ABIS.length == 0) return;
56 | var path = apkPath + separator + Build.SUPPORTED_32_BIT_ABIS[0] + crypto;
57 | startProcess("linker", path);
58 | }
59 |
60 | @Test
61 | public void cryptoTest64Bit() throws Exception {
62 | if (Build.SUPPORTED_64_BIT_ABIS.length == 0) return;
63 | var path = apkPath + separator + Build.SUPPORTED_64_BIT_ABIS[0] + crypto;
64 | startProcess("linker64", path);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/vvb2060/ndk/boringssl/test/MainActivity.java:
--------------------------------------------------------------------------------
1 | package io.github.vvb2060.ndk.boringssl.test;
2 |
3 | import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
4 | import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
5 |
6 | import android.annotation.TargetApi;
7 | import android.app.Activity;
8 | import android.content.Context;
9 | import android.graphics.Typeface;
10 | import android.os.Build;
11 | import android.os.Bundle;
12 | import android.os.Process;
13 | import android.text.InputType;
14 | import android.util.Log;
15 | import android.util.Pair;
16 | import android.view.KeyEvent;
17 | import android.view.View;
18 | import android.widget.EditText;
19 | import android.widget.LinearLayout;
20 | import android.widget.ScrollView;
21 | import android.widget.TextView;
22 |
23 | import java.io.BufferedReader;
24 | import java.io.File;
25 | import java.io.FileOutputStream;
26 | import java.io.IOException;
27 | import java.io.InputStreamReader;
28 | import java.util.LinkedList;
29 | import java.util.List;
30 | import java.util.StringTokenizer;
31 | import java.util.concurrent.ExecutorService;
32 | import java.util.concurrent.Executors;
33 | import java.util.concurrent.Future;
34 | import java.util.function.Consumer;
35 | import java.util.zip.ZipFile;
36 |
37 | public class MainActivity extends Activity {
38 | private final ExecutorService executor = Executors.newSingleThreadExecutor();
39 | private String apkPath;
40 | private ScrollView scrollView;
41 | private TextView textView;
42 | private EditText editText;
43 | private Future> future;
44 |
45 | @SuppressWarnings("SameParameterValue")
46 | private int dp2px(float dp) {
47 | float density = getResources().getDisplayMetrics().density;
48 | return (int) (dp * density + 0.5f);
49 | }
50 |
51 | private View buildView() {
52 | var rootView = new LinearLayout(this);
53 | rootView.setOrientation(LinearLayout.VERTICAL);
54 | rootView.setFitsSystemWindows(true);
55 |
56 | editText = new EditText(this);
57 | var editParams = new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
58 | editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
59 | editText.setHorizontallyScrolling(false);
60 | editText.setOnEditorActionListener((v, actionId, event) -> {
61 | if (event == null) return false;
62 | if (event.getAction() == KeyEvent.ACTION_DOWN &&
63 | event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
64 | var text = v.getText().toString();
65 | if (text.isEmpty()) {
66 | textView.setText("bssl crypto_test ssl_test");
67 | return true;
68 | }
69 | textView.setText("");
70 | future = executor.submit(() -> {
71 | var st = new StringTokenizer(text);
72 | var cmd = new LinkedList();
73 | while (st.hasMoreTokens()) {
74 | cmd.add(st.nextToken());
75 | }
76 | exec(cmd);
77 | });
78 | return true;
79 | }
80 | return false;
81 | });
82 | editText.setOnFocusChangeListener((v, hasFocus) -> {
83 | if (hasFocus && future != null) {
84 | future.cancel(true);
85 | }
86 | });
87 | rootView.addView(editText, editParams);
88 |
89 | scrollView = new ScrollView(this);
90 | var scrollParams = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT, 1);
91 | rootView.addView(scrollView, scrollParams);
92 |
93 | textView = new TextView(this);
94 | var textParams = new ScrollView.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
95 | var dp8 = dp2px(8);
96 | textView.setPadding(dp8, dp8, dp8, dp8);
97 | textView.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL));
98 | textView.setTextIsSelectable(true);
99 | textView.requestFocus();
100 | scrollView.addView(textView, textParams);
101 |
102 | return rootView;
103 | }
104 |
105 | private void append(String string) {
106 | scrollView.post(() -> {
107 | textView.append(string);
108 | textView.append("\n");
109 | scrollView.fullScroll(ScrollView.FOCUS_DOWN);
110 | });
111 | }
112 |
113 | public static int startProcess(Context context, List command, Consumer out) throws Exception {
114 | var pb = new ProcessBuilder(command).redirectErrorStream(true);
115 | var test = new File(context.getCodeCacheDir(), "test");
116 | pb.environment().put("BORINGSSL_TEST_DATA_ROOT", test.getAbsolutePath());
117 | pb.environment().put("TMPDIR", context.getCacheDir().getAbsolutePath());
118 | var process = pb.start();
119 | var reader = new InputStreamReader(process.getInputStream());
120 | try (var br = new BufferedReader(reader)) {
121 | String line = br.readLine();
122 | while (line != null) {
123 | out.accept(line);
124 | if (Thread.interrupted()) {
125 | process.destroy();
126 | out.accept("[ kill ]");
127 | break;
128 | }
129 | line = br.readLine();
130 | }
131 | }
132 | var value = process.waitFor();
133 | out.accept("[ exit " + value + " ]");
134 | return value;
135 | }
136 |
137 | private static Pair nameToPath(String name) {
138 | var abi = Build.SUPPORTED_ABIS[0];
139 | Boolean is64Bit = null;
140 | if (name.endsWith("32") && Build.SUPPORTED_32_BIT_ABIS.length != 0) {
141 | abi = Build.SUPPORTED_32_BIT_ABIS[0];
142 | name = name.substring(0, name.length() - 2);
143 | is64Bit = false;
144 | } else if (name.endsWith("64") && Build.SUPPORTED_64_BIT_ABIS.length != 0) {
145 | abi = Build.SUPPORTED_64_BIT_ABIS[0];
146 | name = name.substring(0, name.length() - 2);
147 | is64Bit = true;
148 | }
149 | var path = "lib/" + abi + "/lib" + name + ".so";
150 | return Pair.create(path, is64Bit);
151 | }
152 |
153 | @TargetApi(Build.VERSION_CODES.Q)
154 | private void execLinker(List command) {
155 | var pair = nameToPath(command.get(0));
156 | var path = apkPath + "!/" + pair.first;
157 | var is64Bit = pair.second;
158 | if (is64Bit == null) {
159 | is64Bit = Process.is64Bit();
160 | }
161 | try {
162 | append("[ exec " + path + " ]");
163 | command.set(0, path);
164 | command.add(0, is64Bit ? "linker64" : "linker");
165 | startProcess(this, command, this::append);
166 | } catch (Exception e) {
167 | append(Log.getStackTraceString(e));
168 | }
169 | }
170 |
171 | private boolean copyFile(File file) {
172 | if (file.canExecute()) return true;
173 | try (var apk = new ZipFile(apkPath)) {
174 | var so = apk.getEntry(nameToPath(file.getName()).first);
175 | assert so != null;
176 | try (var in = apk.getInputStream(so); var out = new FileOutputStream(file)) {
177 | var buffer = new byte[8192];
178 | for (var n = in.read(buffer); n >= 0; n = in.read(buffer))
179 | out.write(buffer, 0, n);
180 | }
181 | return file.setExecutable(true);
182 | } catch (IOException e) {
183 | append(Log.getStackTraceString(e));
184 | return false;
185 | }
186 | }
187 |
188 | private void execFile(List command) {
189 | var file = new File(getCodeCacheDir(), command.get(0));
190 | if (!copyFile(file)) return;
191 | try {
192 | append("[ exec " + file + " ]");
193 | command.set(0, file.toString());
194 | startProcess(this, command, this::append);
195 | } catch (Exception e) {
196 | append(Log.getStackTraceString(e));
197 | }
198 | }
199 |
200 | private void exec(List command) {
201 | if (command.isEmpty()) return;
202 | if (command.get(0).startsWith("crypto_test")) {
203 | try {
204 | copyTestFiles(this, apkPath);
205 | } catch (IOException e) {
206 | append(Log.getStackTraceString(e));
207 | }
208 | }
209 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
210 | execLinker(command);
211 | } else {
212 | execFile(command);
213 | }
214 | }
215 |
216 | public static void copyTestFiles(Context context, String apkPath) throws IOException {
217 | var dir = new File(context.getCodeCacheDir(), "test");
218 | if (dir.isDirectory()) return;
219 | try (var apk = new ZipFile(apkPath)) {
220 | for (var e = apk.entries(); e.hasMoreElements(); ) {
221 | var entry = e.nextElement();
222 | if (entry.isDirectory()) continue;
223 | if (!entry.getName().startsWith("assets/")) continue;
224 | var file = new File(dir, entry.getName().substring(7));
225 | file.getParentFile().mkdirs();
226 | try (var in = apk.getInputStream(entry);
227 | var out = new FileOutputStream(file)) {
228 | var buffer = new byte[8192];
229 | for (var n = in.read(buffer); n >= 0; n = in.read(buffer))
230 | out.write(buffer, 0, n);
231 | }
232 | }
233 | }
234 | }
235 |
236 | @Override
237 | protected void onCreate(Bundle savedInstanceState) {
238 | super.onCreate(savedInstanceState);
239 | setContentView(buildView());
240 | apkPath = getApplicationInfo().sourceDir;
241 | editText.setText("bssl");
242 | editText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
243 | }
244 |
245 | @Override
246 | protected void onDestroy() {
247 | super.onDestroy();
248 | executor.shutdownNow();
249 | }
250 | }
251 |
--------------------------------------------------------------------------------
/boringssl/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/boringssl/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'maven-publish'
4 | id 'signing'
5 | }
6 |
7 | def enableLTO = providers.gradleProperty("enableLTO")
8 |
9 | android {
10 | compileSdk = 35
11 | buildToolsVersion = '35.0.1'
12 | ndkVersion = '28.0.12674087'
13 | namespace = 'io.github.vvb2060.ndk.boringssl'
14 | defaultConfig {
15 | minSdk = 21
16 | targetSdk = 35
17 | externalNativeBuild {
18 | ndkBuild {
19 | arguments += [ "-j${Runtime.runtime.availableProcessors()}" ]
20 | if (enableLTO.present) arguments += [ "enableLTO=1" ]
21 | abiFilters += [ "x86", "x86_64", "armeabi-v7a", "arm64-v8a", "riscv64" ]
22 | }
23 | }
24 | }
25 |
26 | externalNativeBuild {
27 | ndkBuild.path 'src/main/native/BoringSSL.mk'
28 | }
29 |
30 | compileOptions {
31 | sourceCompatibility = JavaVersion.VERSION_21
32 | targetCompatibility = JavaVersion.VERSION_21
33 | }
34 |
35 | buildFeatures {
36 | buildConfig = false
37 | prefabPublishing = true
38 | }
39 |
40 | prefab {
41 | ssl_static {
42 | headers "src/main/native/src/include"
43 | }
44 | crypto_static {
45 | headers "src/main/native/src/include"
46 | }
47 | }
48 |
49 | publishing {
50 | singleVariant("release") {
51 | withSourcesJar()
52 | withJavadocJar()
53 | }
54 | }
55 | }
56 |
57 | publishing {
58 | publications {
59 | mavenJava(MavenPublication) {
60 | group 'io.github.vvb2060.ndk'
61 | artifactId 'boringssl'
62 | if (enableLTO.present) {
63 | version '20250114-lto-ndk28'
64 | } else {
65 | version '20250114'
66 | }
67 | afterEvaluate {
68 | from components.release
69 | }
70 | pom {
71 | name = 'boringssl'
72 | description = 'boringssl static library prefab for android.'
73 | url = 'https://github.com/vvb2060/BoringSSL_Android'
74 | licenses {
75 | license {
76 | name = 'OpenSSL'
77 | url = 'https://www.openssl.org/source/license.html'
78 | }
79 | license {
80 | name = 'ISC'
81 | url = 'https://github.com/google/boringssl/blob/master/LICENSE'
82 | }
83 | }
84 | developers {
85 | developer {
86 | name = 'vvb2060'
87 | url = 'https://github.com/vvb2060'
88 | }
89 | }
90 | scm {
91 | connection = 'scm:git:https://github.com/vvb2060/BoringSSL_Android.git'
92 | url = 'https://github.com/vvb2060/BoringSSL_Android'
93 | }
94 | }
95 | }
96 | }
97 | repositories {
98 | maven {
99 | name 'ossrh'
100 | url 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
101 | credentials(PasswordCredentials)
102 | }
103 | }
104 | }
105 |
106 | signing {
107 | def signingKey = findProperty("signingKey")
108 | def signingPassword = findProperty("signingPassword")
109 | def secretKeyRingFile = findProperty("signing.secretKeyRingFile")
110 |
111 | if (secretKeyRingFile != null && file(secretKeyRingFile).exists()) {
112 | sign publishing.publications
113 | } else if (signingKey != null) {
114 | useInMemoryPgpKeys(signingKey, signingPassword)
115 | sign publishing.publications
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/boringssl/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | gtest_path := $(LOCAL_PATH)/src/third_party/googletest
3 |
4 | include $(LOCAL_PATH)/sources.mk
5 |
6 | include $(CLEAR_VARS)
7 | LOCAL_MODULE := crypto_test
8 | LOCAL_STATIC_LIBRARIES := gtest_main crypto_static
9 | LOCAL_SRC_FILES := $(crypto_test_sources)
10 | LOCAL_SRC_FILES += $(test_support_sources)
11 | include $(LOCAL_PATH)/build-executable.mk
12 |
13 | include $(CLEAR_VARS)
14 | LOCAL_MODULE := ssl_test
15 | LOCAL_STATIC_LIBRARIES := gtest_main ssl_static
16 | LOCAL_SRC_FILES := $(ssl_test_sources)
17 | LOCAL_SRC_FILES += $(test_support_sources)
18 | include $(LOCAL_PATH)/build-executable.mk
19 |
20 | include $(CLEAR_VARS)
21 | LOCAL_MODULE := bssl
22 | LOCAL_STATIC_LIBRARIES := ssl_static
23 | LOCAL_SRC_FILES := $(tool_sources)
24 | include $(LOCAL_PATH)/build-executable.mk
25 |
26 | include $(CLEAR_VARS)
27 | LOCAL_MODULE := gtest_main
28 | LOCAL_SRC_FILES := $(gtest_path)/googletest/src/gtest-all.cc $(gtest_path)/googlemock/src/gmock-all.cc
29 | LOCAL_EXPORT_C_INCLUDES := $(gtest_path)/googletest/include $(gtest_path)/googlemock/include
30 | LOCAL_C_INCLUDES := $(LOCAL_EXPORT_C_INCLUDES) $(gtest_path)/googletest $(gtest_path)/googlemock
31 | include $(BUILD_STATIC_LIBRARY)
32 |
33 | include $(LOCAL_PATH)/BoringSSL.mk
34 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/Application.mk:
--------------------------------------------------------------------------------
1 | APP_CFLAGS := -Wall -Werror -Wno-unused-parameter -fvisibility=hidden -DOPENSSL_SMALL
2 | APP_CFLAGS += -Wno-builtin-macro-redefined -D__FILE__=__FILE_NAME__
3 | APP_LDFLAGS := -Wl,--icf=all
4 | APP_CONLYFLAGS := -std=c17
5 | APP_CPPFLAGS := -std=c++23
6 | APP_STL := c++_static
7 | APP_SHORT_COMMANDS := true
8 |
9 | ifeq ($(enableLTO),1)
10 | APP_CFLAGS += -flto
11 | APP_LDFLAGS += -flto
12 | endif
13 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/BoringSSL.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(LOCAL_PATH)/sources.mk
4 |
5 | include $(CLEAR_VARS)
6 | LOCAL_MODULE := crypto_static
7 | LOCAL_SRC_FILES := $(crypto_sources) $(crypto_sources_asm)
8 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/crypto $(LOCAL_PATH)/src/include
9 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/src/include
10 | include $(BUILD_STATIC_LIBRARY)
11 |
12 | include $(CLEAR_VARS)
13 | LOCAL_MODULE := ssl_static
14 | LOCAL_SRC_FILES := $(ssl_sources)
15 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/include
16 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/src/include
17 | LOCAL_STATIC_LIBRARIES := crypto_static
18 | include $(BUILD_STATIC_LIBRARY)
19 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/build-executable.mk:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2009 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | # this file is included from Android.mk files to build a target-specific
17 | # executable program
18 | #
19 |
20 | LOCAL_BUILD_SCRIPT := BUILD_EXECUTABLE
21 | LOCAL_MAKEFILE := $(local-makefile)
22 |
23 | $(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
24 | $(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
25 | $(call check-LOCAL_MODULE_FILENAME)
26 |
27 | $(call handle-module-filename,lib,$(TARGET_SONAME_EXTENSION))
28 | $(call handle-module-built)
29 |
30 | LOCAL_MODULE_CLASS := EXECUTABLE
31 | include $(BUILD_SYSTEM)/build-module.mk
32 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/patchs/cert_dir.patch:
--------------------------------------------------------------------------------
1 | Submodule boringssl/src/main/native/src contains modified content
2 | diff --git a/boringssl/src/main/native/src/crypto/x509/x509_def.cc b/boringssl/src/main/native/src/crypto/x509/x509_def.cc
3 | index 1721da5d9..f65698a3f 100644
4 | --- a/boringssl/src/main/native/src/crypto/x509/x509_def.cc
5 | +++ b/boringssl/src/main/native/src/crypto/x509/x509_def.cc
6 | @@ -75,7 +75,7 @@ const char *X509_get_default_private_dir(void) { return X509_PRIVATE_DIR; }
7 |
8 | const char *X509_get_default_cert_area(void) { return X509_CERT_AREA; }
9 |
10 | -const char *X509_get_default_cert_dir(void) { return X509_CERT_DIR; }
11 | +const char *X509_get_default_cert_dir(void) { return "/system/etc/security/cacerts"; }
12 |
13 | const char *X509_get_default_cert_file(void) { return X509_CERT_FILE; }
14 |
15 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/patchs/gen.patch:
--------------------------------------------------------------------------------
1 | Submodule boringssl/src/main/native/src contains modified content
2 | diff --git a/boringssl/src/main/native/src/util/generate_build_files.py b/boringssl/src/main/native/src/util/generate_build_files.py
3 | index 7f7232112..afa228b7a 100644
4 | --- a/boringssl/src/main/native/src/util/generate_build_files.py
5 | +++ b/boringssl/src/main/native/src/util/generate_build_files.py
6 | @@ -90,12 +90,21 @@ class Android(object):
7 | self.PrintDefaults(blueprint, 'libpki_sources', files['pki'])
8 |
9 | # Legacy Android.mk format, only used by Trusty in new branches
10 | - with open('sources.mk', 'w+') as makefile:
11 | + with open('sources.mk', 'w+', newline='') as makefile:
12 | makefile.write(self.header)
13 | makefile.write('\n')
14 | self.PrintVariableSection(makefile, 'crypto_sources', files['crypto'])
15 | self.PrintVariableSection(makefile, 'crypto_sources_asm',
16 | files['crypto_asm'])
17 | + self.PrintVariableSection(makefile, 'crypto_sources_nasm',
18 | + files['crypto_nasm'])
19 | + self.PrintVariableSection(makefile, 'ssl_sources', files['ssl'])
20 | + self.PrintVariableSection(makefile, 'tool_sources', files['tool'])
21 | + self.PrintVariableSection(makefile, 'test_support_sources',
22 | + files['test_support'])
23 | + self.PrintVariableSection(makefile, 'crypto_test_sources',
24 | + files['crypto_test'])
25 | + self.PrintVariableSection(makefile, 'ssl_test_sources', files['ssl_test'])
26 |
27 | def PrintDefaults(self, blueprint, name, files, asm_files=[], data=[]):
28 | """Print a cc_defaults section from a list of C files and optionally assembly outputs"""
29 |
--------------------------------------------------------------------------------
/boringssl/src/main/native/sources.mk:
--------------------------------------------------------------------------------
1 | # Copyright 2015 The BoringSSL Authors
2 | #
3 | # Permission to use, copy, modify, and/or distribute this software for any
4 | # purpose with or without fee is hereby granted, provided that the above
5 | # copyright notice and this permission notice appear in all copies.
6 | #
7 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 | # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 | # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 | # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 |
15 | # This file is created by generate_build_files.py. Do not edit manually.
16 |
17 | crypto_sources := \
18 | src/crypto/asn1/a_bitstr.cc\
19 | src/crypto/asn1/a_bool.cc\
20 | src/crypto/asn1/a_d2i_fp.cc\
21 | src/crypto/asn1/a_dup.cc\
22 | src/crypto/asn1/a_gentm.cc\
23 | src/crypto/asn1/a_i2d_fp.cc\
24 | src/crypto/asn1/a_int.cc\
25 | src/crypto/asn1/a_mbstr.cc\
26 | src/crypto/asn1/a_object.cc\
27 | src/crypto/asn1/a_octet.cc\
28 | src/crypto/asn1/a_strex.cc\
29 | src/crypto/asn1/a_strnid.cc\
30 | src/crypto/asn1/a_time.cc\
31 | src/crypto/asn1/a_type.cc\
32 | src/crypto/asn1/a_utctm.cc\
33 | src/crypto/asn1/asn1_lib.cc\
34 | src/crypto/asn1/asn1_par.cc\
35 | src/crypto/asn1/asn_pack.cc\
36 | src/crypto/asn1/f_int.cc\
37 | src/crypto/asn1/f_string.cc\
38 | src/crypto/asn1/posix_time.cc\
39 | src/crypto/asn1/tasn_dec.cc\
40 | src/crypto/asn1/tasn_enc.cc\
41 | src/crypto/asn1/tasn_fre.cc\
42 | src/crypto/asn1/tasn_new.cc\
43 | src/crypto/asn1/tasn_typ.cc\
44 | src/crypto/asn1/tasn_utl.cc\
45 | src/crypto/base64/base64.cc\
46 | src/crypto/bio/bio.cc\
47 | src/crypto/bio/bio_mem.cc\
48 | src/crypto/bio/connect.cc\
49 | src/crypto/bio/errno.cc\
50 | src/crypto/bio/fd.cc\
51 | src/crypto/bio/file.cc\
52 | src/crypto/bio/hexdump.cc\
53 | src/crypto/bio/pair.cc\
54 | src/crypto/bio/printf.cc\
55 | src/crypto/bio/socket.cc\
56 | src/crypto/bio/socket_helper.cc\
57 | src/crypto/blake2/blake2.cc\
58 | src/crypto/bn_extra/bn_asn1.cc\
59 | src/crypto/bn_extra/convert.cc\
60 | src/crypto/buf/buf.cc\
61 | src/crypto/bytestring/asn1_compat.cc\
62 | src/crypto/bytestring/ber.cc\
63 | src/crypto/bytestring/cbb.cc\
64 | src/crypto/bytestring/cbs.cc\
65 | src/crypto/bytestring/unicode.cc\
66 | src/crypto/chacha/chacha.cc\
67 | src/crypto/cipher_extra/cipher_extra.cc\
68 | src/crypto/cipher_extra/derive_key.cc\
69 | src/crypto/cipher_extra/e_aesctrhmac.cc\
70 | src/crypto/cipher_extra/e_aesgcmsiv.cc\
71 | src/crypto/cipher_extra/e_chacha20poly1305.cc\
72 | src/crypto/cipher_extra/e_des.cc\
73 | src/crypto/cipher_extra/e_null.cc\
74 | src/crypto/cipher_extra/e_rc2.cc\
75 | src/crypto/cipher_extra/e_rc4.cc\
76 | src/crypto/cipher_extra/e_tls.cc\
77 | src/crypto/cipher_extra/tls_cbc.cc\
78 | src/crypto/conf/conf.cc\
79 | src/crypto/cpu_aarch64_apple.cc\
80 | src/crypto/cpu_aarch64_fuchsia.cc\
81 | src/crypto/cpu_aarch64_linux.cc\
82 | src/crypto/cpu_aarch64_openbsd.cc\
83 | src/crypto/cpu_aarch64_sysreg.cc\
84 | src/crypto/cpu_aarch64_win.cc\
85 | src/crypto/cpu_arm_freebsd.cc\
86 | src/crypto/cpu_arm_linux.cc\
87 | src/crypto/cpu_intel.cc\
88 | src/crypto/crypto.cc\
89 | src/crypto/curve25519/curve25519.cc\
90 | src/crypto/curve25519/curve25519_64_adx.cc\
91 | src/crypto/curve25519/spake25519.cc\
92 | src/crypto/des/des.cc\
93 | src/crypto/dh_extra/dh_asn1.cc\
94 | src/crypto/dh_extra/params.cc\
95 | src/crypto/digest_extra/digest_extra.cc\
96 | src/crypto/dsa/dsa.cc\
97 | src/crypto/dsa/dsa_asn1.cc\
98 | src/crypto/ec_extra/ec_asn1.cc\
99 | src/crypto/ec_extra/ec_derive.cc\
100 | src/crypto/ec_extra/hash_to_curve.cc\
101 | src/crypto/ecdh_extra/ecdh_extra.cc\
102 | src/crypto/ecdsa_extra/ecdsa_asn1.cc\
103 | src/crypto/engine/engine.cc\
104 | src/crypto/err/err.cc\
105 | src/crypto/evp/evp.cc\
106 | src/crypto/evp/evp_asn1.cc\
107 | src/crypto/evp/evp_ctx.cc\
108 | src/crypto/evp/p_dh.cc\
109 | src/crypto/evp/p_dh_asn1.cc\
110 | src/crypto/evp/p_dsa_asn1.cc\
111 | src/crypto/evp/p_ec.cc\
112 | src/crypto/evp/p_ec_asn1.cc\
113 | src/crypto/evp/p_ed25519.cc\
114 | src/crypto/evp/p_ed25519_asn1.cc\
115 | src/crypto/evp/p_hkdf.cc\
116 | src/crypto/evp/p_rsa.cc\
117 | src/crypto/evp/p_rsa_asn1.cc\
118 | src/crypto/evp/p_x25519.cc\
119 | src/crypto/evp/p_x25519_asn1.cc\
120 | src/crypto/evp/pbkdf.cc\
121 | src/crypto/evp/print.cc\
122 | src/crypto/evp/scrypt.cc\
123 | src/crypto/evp/sign.cc\
124 | src/crypto/ex_data.cc\
125 | src/crypto/fipsmodule/bcm.cc\
126 | src/crypto/fipsmodule/fips_shared_support.cc\
127 | src/crypto/hpke/hpke.cc\
128 | src/crypto/hrss/hrss.cc\
129 | src/crypto/kyber/kyber.cc\
130 | src/crypto/lhash/lhash.cc\
131 | src/crypto/md4/md4.cc\
132 | src/crypto/md5/md5.cc\
133 | src/crypto/mem.cc\
134 | src/crypto/mldsa/mldsa.cc\
135 | src/crypto/mlkem/mlkem.cc\
136 | src/crypto/obj/obj.cc\
137 | src/crypto/obj/obj_xref.cc\
138 | src/crypto/pem/pem_all.cc\
139 | src/crypto/pem/pem_info.cc\
140 | src/crypto/pem/pem_lib.cc\
141 | src/crypto/pem/pem_oth.cc\
142 | src/crypto/pem/pem_pk8.cc\
143 | src/crypto/pem/pem_pkey.cc\
144 | src/crypto/pem/pem_x509.cc\
145 | src/crypto/pem/pem_xaux.cc\
146 | src/crypto/pkcs7/pkcs7.cc\
147 | src/crypto/pkcs7/pkcs7_x509.cc\
148 | src/crypto/pkcs8/p5_pbev2.cc\
149 | src/crypto/pkcs8/pkcs8.cc\
150 | src/crypto/pkcs8/pkcs8_x509.cc\
151 | src/crypto/poly1305/poly1305.cc\
152 | src/crypto/poly1305/poly1305_arm.cc\
153 | src/crypto/poly1305/poly1305_vec.cc\
154 | src/crypto/pool/pool.cc\
155 | src/crypto/rand_extra/deterministic.cc\
156 | src/crypto/rand_extra/fork_detect.cc\
157 | src/crypto/rand_extra/forkunsafe.cc\
158 | src/crypto/rand_extra/getentropy.cc\
159 | src/crypto/rand_extra/ios.cc\
160 | src/crypto/rand_extra/passive.cc\
161 | src/crypto/rand_extra/rand_extra.cc\
162 | src/crypto/rand_extra/trusty.cc\
163 | src/crypto/rand_extra/urandom.cc\
164 | src/crypto/rand_extra/windows.cc\
165 | src/crypto/rc4/rc4.cc\
166 | src/crypto/refcount.cc\
167 | src/crypto/rsa_extra/rsa_asn1.cc\
168 | src/crypto/rsa_extra/rsa_crypt.cc\
169 | src/crypto/rsa_extra/rsa_extra.cc\
170 | src/crypto/rsa_extra/rsa_print.cc\
171 | src/crypto/sha/sha1.cc\
172 | src/crypto/sha/sha256.cc\
173 | src/crypto/sha/sha512.cc\
174 | src/crypto/siphash/siphash.cc\
175 | src/crypto/slhdsa/slhdsa.cc\
176 | src/crypto/stack/stack.cc\
177 | src/crypto/thread.cc\
178 | src/crypto/thread_none.cc\
179 | src/crypto/thread_pthread.cc\
180 | src/crypto/thread_win.cc\
181 | src/crypto/trust_token/pmbtoken.cc\
182 | src/crypto/trust_token/trust_token.cc\
183 | src/crypto/trust_token/voprf.cc\
184 | src/crypto/x509/a_digest.cc\
185 | src/crypto/x509/a_sign.cc\
186 | src/crypto/x509/a_verify.cc\
187 | src/crypto/x509/algorithm.cc\
188 | src/crypto/x509/asn1_gen.cc\
189 | src/crypto/x509/by_dir.cc\
190 | src/crypto/x509/by_file.cc\
191 | src/crypto/x509/i2d_pr.cc\
192 | src/crypto/x509/name_print.cc\
193 | src/crypto/x509/policy.cc\
194 | src/crypto/x509/rsa_pss.cc\
195 | src/crypto/x509/t_crl.cc\
196 | src/crypto/x509/t_req.cc\
197 | src/crypto/x509/t_x509.cc\
198 | src/crypto/x509/t_x509a.cc\
199 | src/crypto/x509/v3_akey.cc\
200 | src/crypto/x509/v3_akeya.cc\
201 | src/crypto/x509/v3_alt.cc\
202 | src/crypto/x509/v3_bcons.cc\
203 | src/crypto/x509/v3_bitst.cc\
204 | src/crypto/x509/v3_conf.cc\
205 | src/crypto/x509/v3_cpols.cc\
206 | src/crypto/x509/v3_crld.cc\
207 | src/crypto/x509/v3_enum.cc\
208 | src/crypto/x509/v3_extku.cc\
209 | src/crypto/x509/v3_genn.cc\
210 | src/crypto/x509/v3_ia5.cc\
211 | src/crypto/x509/v3_info.cc\
212 | src/crypto/x509/v3_int.cc\
213 | src/crypto/x509/v3_lib.cc\
214 | src/crypto/x509/v3_ncons.cc\
215 | src/crypto/x509/v3_ocsp.cc\
216 | src/crypto/x509/v3_pcons.cc\
217 | src/crypto/x509/v3_pmaps.cc\
218 | src/crypto/x509/v3_prn.cc\
219 | src/crypto/x509/v3_purp.cc\
220 | src/crypto/x509/v3_skey.cc\
221 | src/crypto/x509/v3_utl.cc\
222 | src/crypto/x509/x509.cc\
223 | src/crypto/x509/x509_att.cc\
224 | src/crypto/x509/x509_cmp.cc\
225 | src/crypto/x509/x509_d2.cc\
226 | src/crypto/x509/x509_def.cc\
227 | src/crypto/x509/x509_ext.cc\
228 | src/crypto/x509/x509_lu.cc\
229 | src/crypto/x509/x509_obj.cc\
230 | src/crypto/x509/x509_req.cc\
231 | src/crypto/x509/x509_set.cc\
232 | src/crypto/x509/x509_trs.cc\
233 | src/crypto/x509/x509_txt.cc\
234 | src/crypto/x509/x509_v3.cc\
235 | src/crypto/x509/x509_vfy.cc\
236 | src/crypto/x509/x509_vpm.cc\
237 | src/crypto/x509/x509cset.cc\
238 | src/crypto/x509/x509name.cc\
239 | src/crypto/x509/x509rset.cc\
240 | src/crypto/x509/x509spki.cc\
241 | src/crypto/x509/x_algor.cc\
242 | src/crypto/x509/x_all.cc\
243 | src/crypto/x509/x_attrib.cc\
244 | src/crypto/x509/x_crl.cc\
245 | src/crypto/x509/x_exten.cc\
246 | src/crypto/x509/x_name.cc\
247 | src/crypto/x509/x_pubkey.cc\
248 | src/crypto/x509/x_req.cc\
249 | src/crypto/x509/x_sig.cc\
250 | src/crypto/x509/x_spki.cc\
251 | src/crypto/x509/x_val.cc\
252 | src/crypto/x509/x_x509.cc\
253 | src/crypto/x509/x_x509a.cc\
254 | src/gen/crypto/err_data.cc\
255 |
256 | crypto_sources_asm := \
257 | src/crypto/curve25519/asm/x25519-asm-arm.S\
258 | src/crypto/hrss/asm/poly_rq_mul.S\
259 | src/crypto/poly1305/poly1305_arm_asm.S\
260 | src/gen/bcm/aes-gcm-avx10-x86_64-apple.S\
261 | src/gen/bcm/aes-gcm-avx10-x86_64-linux.S\
262 | src/gen/bcm/aes-gcm-avx2-x86_64-apple.S\
263 | src/gen/bcm/aes-gcm-avx2-x86_64-linux.S\
264 | src/gen/bcm/aesni-gcm-x86_64-apple.S\
265 | src/gen/bcm/aesni-gcm-x86_64-linux.S\
266 | src/gen/bcm/aesni-x86-apple.S\
267 | src/gen/bcm/aesni-x86-linux.S\
268 | src/gen/bcm/aesni-x86_64-apple.S\
269 | src/gen/bcm/aesni-x86_64-linux.S\
270 | src/gen/bcm/aesv8-armv7-linux.S\
271 | src/gen/bcm/aesv8-armv8-apple.S\
272 | src/gen/bcm/aesv8-armv8-linux.S\
273 | src/gen/bcm/aesv8-armv8-win.S\
274 | src/gen/bcm/aesv8-gcm-armv8-apple.S\
275 | src/gen/bcm/aesv8-gcm-armv8-linux.S\
276 | src/gen/bcm/aesv8-gcm-armv8-win.S\
277 | src/gen/bcm/armv4-mont-linux.S\
278 | src/gen/bcm/armv8-mont-apple.S\
279 | src/gen/bcm/armv8-mont-linux.S\
280 | src/gen/bcm/armv8-mont-win.S\
281 | src/gen/bcm/bn-586-apple.S\
282 | src/gen/bcm/bn-586-linux.S\
283 | src/gen/bcm/bn-armv8-apple.S\
284 | src/gen/bcm/bn-armv8-linux.S\
285 | src/gen/bcm/bn-armv8-win.S\
286 | src/gen/bcm/bsaes-armv7-linux.S\
287 | src/gen/bcm/co-586-apple.S\
288 | src/gen/bcm/co-586-linux.S\
289 | src/gen/bcm/ghash-armv4-linux.S\
290 | src/gen/bcm/ghash-neon-armv8-apple.S\
291 | src/gen/bcm/ghash-neon-armv8-linux.S\
292 | src/gen/bcm/ghash-neon-armv8-win.S\
293 | src/gen/bcm/ghash-ssse3-x86-apple.S\
294 | src/gen/bcm/ghash-ssse3-x86-linux.S\
295 | src/gen/bcm/ghash-ssse3-x86_64-apple.S\
296 | src/gen/bcm/ghash-ssse3-x86_64-linux.S\
297 | src/gen/bcm/ghash-x86-apple.S\
298 | src/gen/bcm/ghash-x86-linux.S\
299 | src/gen/bcm/ghash-x86_64-apple.S\
300 | src/gen/bcm/ghash-x86_64-linux.S\
301 | src/gen/bcm/ghashv8-armv7-linux.S\
302 | src/gen/bcm/ghashv8-armv8-apple.S\
303 | src/gen/bcm/ghashv8-armv8-linux.S\
304 | src/gen/bcm/ghashv8-armv8-win.S\
305 | src/gen/bcm/p256-armv8-asm-apple.S\
306 | src/gen/bcm/p256-armv8-asm-linux.S\
307 | src/gen/bcm/p256-armv8-asm-win.S\
308 | src/gen/bcm/p256-x86_64-asm-apple.S\
309 | src/gen/bcm/p256-x86_64-asm-linux.S\
310 | src/gen/bcm/p256_beeu-armv8-asm-apple.S\
311 | src/gen/bcm/p256_beeu-armv8-asm-linux.S\
312 | src/gen/bcm/p256_beeu-armv8-asm-win.S\
313 | src/gen/bcm/p256_beeu-x86_64-asm-apple.S\
314 | src/gen/bcm/p256_beeu-x86_64-asm-linux.S\
315 | src/gen/bcm/rdrand-x86_64-apple.S\
316 | src/gen/bcm/rdrand-x86_64-linux.S\
317 | src/gen/bcm/rsaz-avx2-apple.S\
318 | src/gen/bcm/rsaz-avx2-linux.S\
319 | src/gen/bcm/sha1-586-apple.S\
320 | src/gen/bcm/sha1-586-linux.S\
321 | src/gen/bcm/sha1-armv4-large-linux.S\
322 | src/gen/bcm/sha1-armv8-apple.S\
323 | src/gen/bcm/sha1-armv8-linux.S\
324 | src/gen/bcm/sha1-armv8-win.S\
325 | src/gen/bcm/sha1-x86_64-apple.S\
326 | src/gen/bcm/sha1-x86_64-linux.S\
327 | src/gen/bcm/sha256-586-apple.S\
328 | src/gen/bcm/sha256-586-linux.S\
329 | src/gen/bcm/sha256-armv4-linux.S\
330 | src/gen/bcm/sha256-armv8-apple.S\
331 | src/gen/bcm/sha256-armv8-linux.S\
332 | src/gen/bcm/sha256-armv8-win.S\
333 | src/gen/bcm/sha256-x86_64-apple.S\
334 | src/gen/bcm/sha256-x86_64-linux.S\
335 | src/gen/bcm/sha512-586-apple.S\
336 | src/gen/bcm/sha512-586-linux.S\
337 | src/gen/bcm/sha512-armv4-linux.S\
338 | src/gen/bcm/sha512-armv8-apple.S\
339 | src/gen/bcm/sha512-armv8-linux.S\
340 | src/gen/bcm/sha512-armv8-win.S\
341 | src/gen/bcm/sha512-x86_64-apple.S\
342 | src/gen/bcm/sha512-x86_64-linux.S\
343 | src/gen/bcm/vpaes-armv7-linux.S\
344 | src/gen/bcm/vpaes-armv8-apple.S\
345 | src/gen/bcm/vpaes-armv8-linux.S\
346 | src/gen/bcm/vpaes-armv8-win.S\
347 | src/gen/bcm/vpaes-x86-apple.S\
348 | src/gen/bcm/vpaes-x86-linux.S\
349 | src/gen/bcm/vpaes-x86_64-apple.S\
350 | src/gen/bcm/vpaes-x86_64-linux.S\
351 | src/gen/bcm/x86-mont-apple.S\
352 | src/gen/bcm/x86-mont-linux.S\
353 | src/gen/bcm/x86_64-mont-apple.S\
354 | src/gen/bcm/x86_64-mont-linux.S\
355 | src/gen/bcm/x86_64-mont5-apple.S\
356 | src/gen/bcm/x86_64-mont5-linux.S\
357 | src/gen/crypto/aes128gcmsiv-x86_64-apple.S\
358 | src/gen/crypto/aes128gcmsiv-x86_64-linux.S\
359 | src/gen/crypto/chacha-armv4-linux.S\
360 | src/gen/crypto/chacha-armv8-apple.S\
361 | src/gen/crypto/chacha-armv8-linux.S\
362 | src/gen/crypto/chacha-armv8-win.S\
363 | src/gen/crypto/chacha-x86-apple.S\
364 | src/gen/crypto/chacha-x86-linux.S\
365 | src/gen/crypto/chacha-x86_64-apple.S\
366 | src/gen/crypto/chacha-x86_64-linux.S\
367 | src/gen/crypto/chacha20_poly1305_armv8-apple.S\
368 | src/gen/crypto/chacha20_poly1305_armv8-linux.S\
369 | src/gen/crypto/chacha20_poly1305_armv8-win.S\
370 | src/gen/crypto/chacha20_poly1305_x86_64-apple.S\
371 | src/gen/crypto/chacha20_poly1305_x86_64-linux.S\
372 | src/gen/crypto/md5-586-apple.S\
373 | src/gen/crypto/md5-586-linux.S\
374 | src/gen/crypto/md5-x86_64-apple.S\
375 | src/gen/crypto/md5-x86_64-linux.S\
376 | src/gen/test_support/trampoline-armv4-linux.S\
377 | src/gen/test_support/trampoline-armv8-apple.S\
378 | src/gen/test_support/trampoline-armv8-linux.S\
379 | src/gen/test_support/trampoline-armv8-win.S\
380 | src/gen/test_support/trampoline-x86-apple.S\
381 | src/gen/test_support/trampoline-x86-linux.S\
382 | src/gen/test_support/trampoline-x86_64-apple.S\
383 | src/gen/test_support/trampoline-x86_64-linux.S\
384 | src/third_party/fiat/asm/fiat_curve25519_adx_mul.S\
385 | src/third_party/fiat/asm/fiat_curve25519_adx_square.S\
386 | src/third_party/fiat/asm/fiat_p256_adx_mul.S\
387 | src/third_party/fiat/asm/fiat_p256_adx_sqr.S\
388 |
389 | crypto_sources_nasm := \
390 | src/gen/bcm/aes-gcm-avx10-x86_64-win.asm\
391 | src/gen/bcm/aes-gcm-avx2-x86_64-win.asm\
392 | src/gen/bcm/aesni-gcm-x86_64-win.asm\
393 | src/gen/bcm/aesni-x86-win.asm\
394 | src/gen/bcm/aesni-x86_64-win.asm\
395 | src/gen/bcm/bn-586-win.asm\
396 | src/gen/bcm/co-586-win.asm\
397 | src/gen/bcm/ghash-ssse3-x86-win.asm\
398 | src/gen/bcm/ghash-ssse3-x86_64-win.asm\
399 | src/gen/bcm/ghash-x86-win.asm\
400 | src/gen/bcm/ghash-x86_64-win.asm\
401 | src/gen/bcm/p256-x86_64-asm-win.asm\
402 | src/gen/bcm/p256_beeu-x86_64-asm-win.asm\
403 | src/gen/bcm/rdrand-x86_64-win.asm\
404 | src/gen/bcm/rsaz-avx2-win.asm\
405 | src/gen/bcm/sha1-586-win.asm\
406 | src/gen/bcm/sha1-x86_64-win.asm\
407 | src/gen/bcm/sha256-586-win.asm\
408 | src/gen/bcm/sha256-x86_64-win.asm\
409 | src/gen/bcm/sha512-586-win.asm\
410 | src/gen/bcm/sha512-x86_64-win.asm\
411 | src/gen/bcm/vpaes-x86-win.asm\
412 | src/gen/bcm/vpaes-x86_64-win.asm\
413 | src/gen/bcm/x86-mont-win.asm\
414 | src/gen/bcm/x86_64-mont-win.asm\
415 | src/gen/bcm/x86_64-mont5-win.asm\
416 | src/gen/crypto/aes128gcmsiv-x86_64-win.asm\
417 | src/gen/crypto/chacha-x86-win.asm\
418 | src/gen/crypto/chacha-x86_64-win.asm\
419 | src/gen/crypto/chacha20_poly1305_x86_64-win.asm\
420 | src/gen/crypto/md5-586-win.asm\
421 | src/gen/crypto/md5-x86_64-win.asm\
422 | src/gen/test_support/trampoline-x86-win.asm\
423 | src/gen/test_support/trampoline-x86_64-win.asm\
424 |
425 | ssl_sources := \
426 | src/ssl/bio_ssl.cc\
427 | src/ssl/d1_both.cc\
428 | src/ssl/d1_lib.cc\
429 | src/ssl/d1_pkt.cc\
430 | src/ssl/d1_srtp.cc\
431 | src/ssl/dtls_method.cc\
432 | src/ssl/dtls_record.cc\
433 | src/ssl/encrypted_client_hello.cc\
434 | src/ssl/extensions.cc\
435 | src/ssl/handoff.cc\
436 | src/ssl/handshake.cc\
437 | src/ssl/handshake_client.cc\
438 | src/ssl/handshake_server.cc\
439 | src/ssl/s3_both.cc\
440 | src/ssl/s3_lib.cc\
441 | src/ssl/s3_pkt.cc\
442 | src/ssl/ssl_aead_ctx.cc\
443 | src/ssl/ssl_asn1.cc\
444 | src/ssl/ssl_buffer.cc\
445 | src/ssl/ssl_cert.cc\
446 | src/ssl/ssl_cipher.cc\
447 | src/ssl/ssl_credential.cc\
448 | src/ssl/ssl_file.cc\
449 | src/ssl/ssl_key_share.cc\
450 | src/ssl/ssl_lib.cc\
451 | src/ssl/ssl_privkey.cc\
452 | src/ssl/ssl_session.cc\
453 | src/ssl/ssl_stat.cc\
454 | src/ssl/ssl_transcript.cc\
455 | src/ssl/ssl_versions.cc\
456 | src/ssl/ssl_x509.cc\
457 | src/ssl/t1_enc.cc\
458 | src/ssl/tls13_both.cc\
459 | src/ssl/tls13_client.cc\
460 | src/ssl/tls13_enc.cc\
461 | src/ssl/tls13_server.cc\
462 | src/ssl/tls_method.cc\
463 | src/ssl/tls_record.cc\
464 |
465 | tool_sources := \
466 | src/tool/args.cc\
467 | src/tool/ciphers.cc\
468 | src/tool/client.cc\
469 | src/tool/const.cc\
470 | src/tool/digest.cc\
471 | src/tool/fd.cc\
472 | src/tool/file.cc\
473 | src/tool/generate_ech.cc\
474 | src/tool/generate_ed25519.cc\
475 | src/tool/genrsa.cc\
476 | src/tool/pkcs12.cc\
477 | src/tool/rand.cc\
478 | src/tool/server.cc\
479 | src/tool/sign.cc\
480 | src/tool/speed.cc\
481 | src/tool/tool.cc\
482 | src/tool/transport_common.cc\
483 |
484 | test_support_sources := \
485 | src/crypto/test/abi_test.cc\
486 | src/crypto/test/file_test.cc\
487 | src/crypto/test/file_test_gtest.cc\
488 | src/crypto/test/file_util.cc\
489 | src/crypto/test/test_data.cc\
490 | src/crypto/test/test_util.cc\
491 | src/crypto/test/wycheproof_util.cc\
492 |
493 | crypto_test_sources := \
494 | src/crypto/abi_self_test.cc\
495 | src/crypto/asn1/asn1_test.cc\
496 | src/crypto/base64/base64_test.cc\
497 | src/crypto/bio/bio_test.cc\
498 | src/crypto/blake2/blake2_test.cc\
499 | src/crypto/buf/buf_test.cc\
500 | src/crypto/bytestring/bytestring_test.cc\
501 | src/crypto/chacha/chacha_test.cc\
502 | src/crypto/cipher_extra/aead_test.cc\
503 | src/crypto/cipher_extra/cipher_test.cc\
504 | src/crypto/compiler_test.cc\
505 | src/crypto/conf/conf_test.cc\
506 | src/crypto/constant_time_test.cc\
507 | src/crypto/cpu_arm_linux_test.cc\
508 | src/crypto/crypto_test.cc\
509 | src/crypto/curve25519/ed25519_test.cc\
510 | src/crypto/curve25519/spake25519_test.cc\
511 | src/crypto/curve25519/x25519_test.cc\
512 | src/crypto/dh_extra/dh_test.cc\
513 | src/crypto/digest_extra/digest_test.cc\
514 | src/crypto/dsa/dsa_test.cc\
515 | src/crypto/ecdh_extra/ecdh_test.cc\
516 | src/crypto/err/err_test.cc\
517 | src/crypto/evp/evp_extra_test.cc\
518 | src/crypto/evp/evp_test.cc\
519 | src/crypto/evp/pbkdf_test.cc\
520 | src/crypto/evp/scrypt_test.cc\
521 | src/crypto/fipsmodule/aes/aes_test.cc\
522 | src/crypto/fipsmodule/bn/bn_test.cc\
523 | src/crypto/fipsmodule/cmac/cmac_test.cc\
524 | src/crypto/fipsmodule/ec/ec_test.cc\
525 | src/crypto/fipsmodule/ec/p256-nistz_test.cc\
526 | src/crypto/fipsmodule/ec/p256_test.cc\
527 | src/crypto/fipsmodule/ecdsa/ecdsa_test.cc\
528 | src/crypto/fipsmodule/hkdf/hkdf_test.cc\
529 | src/crypto/fipsmodule/keccak/keccak_test.cc\
530 | src/crypto/fipsmodule/modes/gcm_test.cc\
531 | src/crypto/fipsmodule/rand/ctrdrbg_test.cc\
532 | src/crypto/fipsmodule/service_indicator/service_indicator_test.cc\
533 | src/crypto/fipsmodule/sha/sha_test.cc\
534 | src/crypto/hmac_extra/hmac_test.cc\
535 | src/crypto/hpke/hpke_test.cc\
536 | src/crypto/hrss/hrss_test.cc\
537 | src/crypto/impl_dispatch_test.cc\
538 | src/crypto/kyber/kyber_test.cc\
539 | src/crypto/lhash/lhash_test.cc\
540 | src/crypto/md5/md5_test.cc\
541 | src/crypto/mldsa/mldsa_test.cc\
542 | src/crypto/mlkem/mlkem_test.cc\
543 | src/crypto/obj/obj_test.cc\
544 | src/crypto/pem/pem_test.cc\
545 | src/crypto/pkcs7/pkcs7_test.cc\
546 | src/crypto/pkcs8/pkcs12_test.cc\
547 | src/crypto/pkcs8/pkcs8_test.cc\
548 | src/crypto/poly1305/poly1305_test.cc\
549 | src/crypto/pool/pool_test.cc\
550 | src/crypto/rand_extra/fork_detect_test.cc\
551 | src/crypto/rand_extra/getentropy_test.cc\
552 | src/crypto/rand_extra/rand_test.cc\
553 | src/crypto/refcount_test.cc\
554 | src/crypto/rsa_extra/rsa_test.cc\
555 | src/crypto/self_test.cc\
556 | src/crypto/siphash/siphash_test.cc\
557 | src/crypto/slhdsa/slhdsa_test.cc\
558 | src/crypto/stack/stack_test.cc\
559 | src/crypto/test/gtest_main.cc\
560 | src/crypto/thread_test.cc\
561 | src/crypto/trust_token/trust_token_test.cc\
562 | src/crypto/x509/tab_test.cc\
563 | src/crypto/x509/x509_test.cc\
564 | src/crypto/x509/x509_time_test.cc\
565 |
566 | ssl_test_sources := \
567 | src/crypto/test/gtest_main.cc\
568 | src/ssl/span_test.cc\
569 | src/ssl/ssl_c_test.c\
570 | src/ssl/ssl_internal_test.cc\
571 | src/ssl/ssl_test.cc\
572 |
573 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vvb2060/BoringSSL_Android/20b87e2e25a793531c9cd651c629c62976b42e2b/build.gradle
--------------------------------------------------------------------------------
/copy_test_files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ROOT=$PWD
4 | rm -vrf app/src/main/assets
5 | mkdir app/src/main/assets
6 | cd boringssl/src/main/native/src
7 | DATA=$(jq -r '.crypto_test.data[]' "gen/sources.json")
8 | for FILE in $DATA; do
9 | cp -v --parents "$FILE" "$ROOT/app/src/main/assets"
10 | done
11 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | android.useAndroidX=true
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vvb2060/BoringSSL_Android/20b87e2e25a793531c9cd651c629c62976b42e2b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90 | ' "$PWD" ) || exit
91 |
92 | # Use the maximum available, or set MAX_FD != -1 to use that value.
93 | MAX_FD=maximum
94 |
95 | warn () {
96 | echo "$*"
97 | } >&2
98 |
99 | die () {
100 | echo
101 | echo "$*"
102 | echo
103 | exit 1
104 | } >&2
105 |
106 | # OS specific support (must be 'true' or 'false').
107 | cygwin=false
108 | msys=false
109 | darwin=false
110 | nonstop=false
111 | case "$( uname )" in #(
112 | CYGWIN* ) cygwin=true ;; #(
113 | Darwin* ) darwin=true ;; #(
114 | MSYS* | MINGW* ) msys=true ;; #(
115 | NONSTOP* ) nonstop=true ;;
116 | esac
117 |
118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
119 |
120 |
121 | # Determine the Java command to use to start the JVM.
122 | if [ -n "$JAVA_HOME" ] ; then
123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124 | # IBM's JDK on AIX uses strange locations for the executables
125 | JAVACMD=$JAVA_HOME/jre/sh/java
126 | else
127 | JAVACMD=$JAVA_HOME/bin/java
128 | fi
129 | if [ ! -x "$JAVACMD" ] ; then
130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131 |
132 | Please set the JAVA_HOME variable in your environment to match the
133 | location of your Java installation."
134 | fi
135 | else
136 | JAVACMD=java
137 | if ! command -v java >/dev/null 2>&1
138 | then
139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140 |
141 | Please set the JAVA_HOME variable in your environment to match the
142 | location of your Java installation."
143 | fi
144 | fi
145 |
146 | # Increase the maximum file descriptors if we can.
147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148 | case $MAX_FD in #(
149 | max*)
150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151 | # shellcheck disable=SC2039,SC3045
152 | MAX_FD=$( ulimit -H -n ) ||
153 | warn "Could not query maximum file descriptor limit"
154 | esac
155 | case $MAX_FD in #(
156 | '' | soft) :;; #(
157 | *)
158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159 | # shellcheck disable=SC2039,SC3045
160 | ulimit -n "$MAX_FD" ||
161 | warn "Could not set maximum file descriptor limit to $MAX_FD"
162 | esac
163 | fi
164 |
165 | # Collect all arguments for the java command, stacking in reverse order:
166 | # * args from the command line
167 | # * the main class name
168 | # * -classpath
169 | # * -D...appname settings
170 | # * --module-path (only if needed)
171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
172 |
173 | # For Cygwin or MSYS, switch paths to Windows format before running java
174 | if "$cygwin" || "$msys" ; then
175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177 |
178 | JAVACMD=$( cygpath --unix "$JAVACMD" )
179 |
180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
181 | for arg do
182 | if
183 | case $arg in #(
184 | -*) false ;; # don't mess with options #(
185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186 | [ -e "$t" ] ;; #(
187 | *) false ;;
188 | esac
189 | then
190 | arg=$( cygpath --path --ignore --mixed "$arg" )
191 | fi
192 | # Roll the args list around exactly as many times as the number of
193 | # args, so each arg winds up back in the position where it started, but
194 | # possibly modified.
195 | #
196 | # NB: a `for` loop captures its iteration list before it begins, so
197 | # changing the positional parameters here affects neither the number of
198 | # iterations, nor the values presented in `arg`.
199 | shift # remove old arg
200 | set -- "$@" "$arg" # push replacement arg
201 | done
202 | fi
203 |
204 |
205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207 |
208 | # Collect all arguments for the java command:
209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210 | # and any embedded shellness will be escaped.
211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212 | # treated as '${Hostname}' itself on the command line.
213 |
214 | set -- \
215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
216 | -classpath "$CLASSPATH" \
217 | org.gradle.wrapper.GradleWrapperMain \
218 | "$@"
219 |
220 | # Stop when "xargs" is not available.
221 | if ! command -v xargs >/dev/null 2>&1
222 | then
223 | die "xargs is not available"
224 | fi
225 |
226 | # Use "xargs" to parse quoted args.
227 | #
228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
229 | #
230 | # In Bash we could simply go:
231 | #
232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
233 | # set -- "${ARGS[@]}" "$@"
234 | #
235 | # but POSIX shell has neither arrays nor command substitution, so instead we
236 | # post-process each arg (as a line of input to sed) to backslash-escape any
237 | # character that might be a shell metacharacter, then use eval to reverse
238 | # that process (while maintaining the separation between arguments), and wrap
239 | # the whole thing up as a single "set" statement.
240 | #
241 | # This will of course break if any of these variables contains a newline or
242 | # an unmatched quote.
243 | #
244 |
245 | eval "set -- $(
246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
247 | xargs -n1 |
248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
249 | tr '\n' ' '
250 | )" '"$@"'
251 |
252 | exec "$JAVACMD" "$@"
253 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | gradlePluginPortal()
4 | google()
5 | mavenCentral()
6 | }
7 | plugins {
8 | id 'com.android.application' version '8.8.0'
9 | id 'com.android.library' version '8.8.0'
10 | id 'org.jetbrains.kotlin.android' version '2.1.10'
11 | }
12 | }
13 | dependencyResolutionManagement {
14 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
15 | repositories {
16 | google()
17 | mavenLocal()
18 | mavenCentral()
19 | }
20 | }
21 | include ':boringssl'
22 | include ':app'
23 |
--------------------------------------------------------------------------------