├── .github └── workflows │ ├── build.yml │ └── semgrep.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── SECURITY.md └── apprelay ├── Cargo.lock ├── Cargo.toml ├── apprelay.h ├── build.rs └── src ├── android.rs ├── error_ffi.rs └── lib.rs /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build & (optionally) publish artifacts 2 | 3 | on: 4 | pull_request: {} 5 | push: 6 | branches: [main, master] 7 | tags: ["v*"] 8 | 9 | jobs: 10 | build-android-libraries: 11 | name: Build android libraries 12 | runs-on: ubuntu-latest 13 | # Map a step output to a job output 14 | outputs: 15 | jni_hashes: ${{ steps.vars.outputs.jni_libs_sha }} 16 | jni_all_hashes: ${{ steps.vars.outputs.all_jni_libs_sha }} 17 | 18 | steps: 19 | - name: Save logcat output 20 | uses: actions/upload-artifact@v4 21 | if: failure() 22 | with: 23 | name: logcat 24 | path: artifacts/logcat.log 25 | - name: checkout 26 | uses: actions/checkout@v4 27 | 28 | - name: rust toolchain setup 29 | uses: dtolnay/rust-toolchain@stable 30 | with: 31 | targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android 32 | 33 | - name: install cargo ndk 34 | run: cargo install cargo-ndk 35 | 36 | - name: build all targets 37 | run: | 38 | export ANDROID_NDK_HOME="$ANDROID_NDK_LATEST_HOME" 39 | export ANDROID_NDK_ROOT="$ANDROID_NDK_LATEST_HOME" 40 | cargo ndk-env 41 | cargo ndk \ 42 | -t armeabi-v7a \ 43 | -t arm64-v8a \ 44 | -t x86 \ 45 | -t x86_64 \ 46 | -o ./target/jniLibs build --profile release-space-optimized || true 47 | rm -r ./target/jniLibs || true 48 | mkdir -p ./target/jniLibs/{armeabi-v7a,arm64-v8a,x86,x86_64} 49 | cp ./target/armv7-linux-androideabi/release-space-optimized/libapprelay.so ./target/jniLibs/armeabi-v7a/libapprelay.so 50 | cp ./target/aarch64-linux-android/release-space-optimized/libapprelay.so ./target/jniLibs/arm64-v8a/libapprelay.so 51 | cp ./target/i686-linux-android/release-space-optimized/libapprelay.so ./target/jniLibs/x86/libapprelay.so 52 | cp ./target/x86_64-linux-android/release-space-optimized/libapprelay.so ./target/jniLibs/x86_64/libapprelay.so 53 | 54 | - name: Create tarball 55 | if: startsWith(github.ref, 'refs/tags/v') 56 | run: | 57 | cd ./target/jniLibs 58 | tar -czvf jniLibs.tar.gz * 59 | 60 | - name: Set checksum var 61 | if: startsWith(github.ref, 'refs/tags/v') 62 | id: vars 63 | run: | 64 | echo "jni_libs_sha=$(sha256sum target/jniLibs/jniLibs.tar.gz)" >> "$GITHUB_OUTPUT" 65 | # https://github.com/orgs/community/discussions/26288#discussioncomment-3251220 66 | sums="$(sha256sum ./target/jniLibs/**/*.so)" 67 | sums="${sums//'%'/'%25'}" 68 | sums="${sums//$'\n'/'%0A'}" 69 | sums="${sums//$'\r'/'%0D'}" 70 | 71 | echo "all_jni_libs_sha=$sums" >> "$GITHUB_OUTPUT" 72 | 73 | # android 74 | - name: Upload android libs 75 | if: startsWith(github.ref, 'refs/tags/v') 76 | uses: actions/upload-artifact@v4 77 | with: 78 | name: android-jni 79 | path: target/jniLibs/jniLibs.tar.gz 80 | 81 | build-ios-libraries: 82 | name: Build ios libraries 83 | runs-on: macos-latest 84 | outputs: 85 | hashes: ${{ steps.vars.outputs.ios_sha }} 86 | 87 | steps: 88 | - name: Save logcat output 89 | uses: actions/upload-artifact@v4 90 | if: failure() 91 | with: 92 | name: logcat 93 | path: artifacts/logcat.log 94 | - name: checkout 95 | uses: actions/checkout@v4 96 | - name: rust toolchain setup 97 | uses: dtolnay/rust-toolchain@stable 98 | 99 | - name: ensure we have xcode installed 100 | run: xcrun --show-sdk-build-version 101 | 102 | - name: build all targets 103 | run: | 104 | declare -a arches=("x86_64-apple-ios" "aarch64-apple-ios" "x86_64-apple-ios" "aarch64-apple-ios-sim" ) 105 | for i in "${arches[@]}" 106 | do 107 | rustup target add $i 108 | echo "building for arch $i" 109 | cargo build --target $i \ 110 | --no-default-features \ 111 | --profile release-space-optimized 112 | dir="./target/ios_libs/$i" 113 | mkdir -p "$dir" 114 | ls -al ./target/$i/release-space-optimized/ 115 | cp ./target/$i/release-space-optimized/libapprelay.{dylib,so,a} "$dir" || true 116 | done 117 | 118 | - name: package 119 | run: | 120 | mkdir include 121 | cp apprelay/apprelay.h include 122 | xcodebuild -create-xcframework \ 123 | -library target/aarch64-apple-ios/release-space-optimized/libapprelay.a -headers include \ 124 | -library target/aarch64-apple-ios-sim/release-space-optimized/libapprelay.a -headers include \ 125 | -output LibAppRelay.xcframework 126 | lipo -create target/aarch64-apple-ios-sim/release-space-optimized/libapprelay.a \ 127 | target/x86_64-apple-ios/release-space-optimized/libapprelay.a \ 128 | -output LibAppRelay.xcframework/ios-arm64-simulator/libapprelay.a 129 | zip -vr LibAppRelay.xcframework.zip LibAppRelay.xcframework 130 | 131 | - name: Set checksum var 132 | if: startsWith(github.ref, 'refs/tags/v') 133 | id: vars 134 | run: echo "ios_sha=$(shasum -a 256 LibAppRelay.xcframework.zip)" >> "$GITHUB_OUTPUT" 135 | 136 | - name: Upload iOS xcframework 137 | if: startsWith(github.ref, 'refs/tags/v') 138 | uses: actions/upload-artifact@v4 139 | with: 140 | name: ios-xc 141 | path: LibAppRelay.xcframework.zip 142 | 143 | publish: 144 | if: startsWith(github.ref, 'refs/tags/v') 145 | needs: [build-android-libraries, build-ios-libraries] 146 | runs-on: ubuntu-latest 147 | 148 | steps: 149 | - uses: actions/download-artifact@v4 # android lib 150 | with: 151 | name: android-jni 152 | path: . 153 | 154 | - uses: actions/download-artifact@v4 # iOS lib 155 | with: 156 | name: ios-xc 157 | path: . 158 | 159 | - name: Upload android asset to release 160 | uses: svenstaro/upload-release-action@v2 161 | with: 162 | repo_token: ${{ secrets.GITHUB_TOKEN }} 163 | file: jniLibs.tar.gz 164 | asset_name: jniLibs.tar.gz 165 | tag: ${{ github.ref }} 166 | 167 | - name: Upload iOS asset to release 168 | uses: svenstaro/upload-release-action@v2 169 | with: 170 | repo_token: ${{ secrets.GITHUB_TOKEN }} 171 | file: LibAppRelay.xcframework.zip 172 | asset_name: LibAppRelay.xcframework.zip 173 | tag: ${{ github.ref }} 174 | 175 | hashes: 176 | name: Collect Asset Hashes 177 | if: startsWith(github.ref, 'refs/tags/v') 178 | needs: [build-android-libraries, build-ios-libraries] 179 | runs-on: ubuntu-latest 180 | 181 | steps: 182 | - name: Generate hashes 183 | run: | 184 | echo "${{ needs.build-ios-libraries.outputs.hashes }}" >> hashes.txt 185 | echo "${{ needs.build-android-libraries.outputs.jni_hashes }}" >> hashes.txt 186 | echo "${{ needs.build-android-libraries.outputs.jni_all_hashes }}" >> hashes.txt 187 | 188 | - name: Upload asset hashes 189 | uses: svenstaro/upload-release-action@v2 190 | with: 191 | repo_token: ${{ secrets.GITHUB_TOKEN }} 192 | file: hashes.txt 193 | asset_name: hashes.txt 194 | tag: ${{ github.ref }} 195 | -------------------------------------------------------------------------------- /.github/workflows/semgrep.yml: -------------------------------------------------------------------------------- 1 | 2 | on: 3 | pull_request: {} 4 | workflow_dispatch: {} 5 | push: 6 | branches: 7 | - main 8 | - master 9 | schedule: 10 | - cron: '0 0 * * *' 11 | name: Semgrep config 12 | jobs: 13 | semgrep: 14 | name: semgrep/ci 15 | runs-on: ubuntu-20.04 16 | env: 17 | SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 18 | SEMGREP_URL: https://cloudflare.semgrep.dev 19 | SEMGREP_APP_URL: https://cloudflare.semgrep.dev 20 | SEMGREP_VERSION_CHECK_URL: https://cloudflare.semgrep.dev/api/check-version 21 | container: 22 | image: returntocorp/semgrep 23 | steps: 24 | - uses: actions/checkout@v3 25 | - run: semgrep ci 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aead" 7 | version = "0.4.3" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" 10 | dependencies = [ 11 | "generic-array", 12 | "rand_core 0.6.4", 13 | ] 14 | 15 | [[package]] 16 | name = "aead" 17 | version = "0.5.2" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" 20 | dependencies = [ 21 | "crypto-common", 22 | "generic-array", 23 | ] 24 | 25 | [[package]] 26 | name = "aes" 27 | version = "0.7.5" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" 30 | dependencies = [ 31 | "cfg-if", 32 | "cipher 0.3.0", 33 | "cpufeatures 0.2.7", 34 | "opaque-debug", 35 | ] 36 | 37 | [[package]] 38 | name = "aes" 39 | version = "0.8.2" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" 42 | dependencies = [ 43 | "cfg-if", 44 | "cipher 0.4.4", 45 | "cpufeatures 0.2.7", 46 | ] 47 | 48 | [[package]] 49 | name = "aes-gcm" 50 | version = "0.9.4" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" 53 | dependencies = [ 54 | "aead 0.4.3", 55 | "aes 0.7.5", 56 | "cipher 0.3.0", 57 | "ctr 0.8.0", 58 | "ghash 0.4.4", 59 | "subtle", 60 | ] 61 | 62 | [[package]] 63 | name = "aes-gcm" 64 | version = "0.10.1" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" 67 | dependencies = [ 68 | "aead 0.5.2", 69 | "aes 0.8.2", 70 | "cipher 0.4.4", 71 | "ctr 0.9.2", 72 | "ghash 0.5.0", 73 | "subtle", 74 | ] 75 | 76 | [[package]] 77 | name = "aho-corasick" 78 | version = "1.0.1" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" 81 | dependencies = [ 82 | "memchr", 83 | ] 84 | 85 | [[package]] 86 | name = "ansi_term" 87 | version = "0.12.1" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 90 | dependencies = [ 91 | "winapi", 92 | ] 93 | 94 | [[package]] 95 | name = "apprelay" 96 | version = "0.1.0" 97 | dependencies = [ 98 | "bytes", 99 | "cbindgen", 100 | "env_logger", 101 | "jni", 102 | "libc", 103 | "log", 104 | "ohttp", 105 | "thiserror", 106 | ] 107 | 108 | [[package]] 109 | name = "atty" 110 | version = "0.2.14" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 113 | dependencies = [ 114 | "hermit-abi 0.1.19", 115 | "libc", 116 | "winapi", 117 | ] 118 | 119 | [[package]] 120 | name = "autocfg" 121 | version = "1.1.0" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 124 | 125 | [[package]] 126 | name = "bitflags" 127 | version = "1.3.2" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 130 | 131 | [[package]] 132 | name = "block-buffer" 133 | version = "0.9.0" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 136 | dependencies = [ 137 | "generic-array", 138 | ] 139 | 140 | [[package]] 141 | name = "block-buffer" 142 | version = "0.10.4" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 145 | dependencies = [ 146 | "generic-array", 147 | ] 148 | 149 | [[package]] 150 | name = "byteorder" 151 | version = "1.4.3" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 154 | 155 | [[package]] 156 | name = "bytes" 157 | version = "1.4.0" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 160 | 161 | [[package]] 162 | name = "cbindgen" 163 | version = "0.17.0" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | checksum = "744fcfb4c9f64d649756fd972afec5120641eaa8b2ff86a4ae981f68648780b8" 166 | dependencies = [ 167 | "clap", 168 | "heck", 169 | "indexmap", 170 | "log", 171 | "proc-macro2", 172 | "quote", 173 | "serde", 174 | "serde_json", 175 | "syn 1.0.109", 176 | "tempfile", 177 | "toml", 178 | ] 179 | 180 | [[package]] 181 | name = "cc" 182 | version = "1.0.79" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 185 | 186 | [[package]] 187 | name = "cesu8" 188 | version = "1.1.0" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" 191 | 192 | [[package]] 193 | name = "cfg-if" 194 | version = "1.0.0" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 197 | 198 | [[package]] 199 | name = "chacha20" 200 | version = "0.7.1" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | checksum = "fee7ad89dc1128635074c268ee661f90c3f7e83d9fd12910608c36b47d6c3412" 203 | dependencies = [ 204 | "cfg-if", 205 | "cipher 0.3.0", 206 | "cpufeatures 0.1.5", 207 | "zeroize", 208 | ] 209 | 210 | [[package]] 211 | name = "chacha20" 212 | version = "0.9.1" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" 215 | dependencies = [ 216 | "cfg-if", 217 | "cipher 0.4.4", 218 | "cpufeatures 0.2.7", 219 | ] 220 | 221 | [[package]] 222 | name = "chacha20poly1305" 223 | version = "0.8.0" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "1580317203210c517b6d44794abfbe600698276db18127e37ad3e69bf5e848e5" 226 | dependencies = [ 227 | "aead 0.4.3", 228 | "chacha20 0.7.1", 229 | "cipher 0.3.0", 230 | "poly1305 0.7.2", 231 | "zeroize", 232 | ] 233 | 234 | [[package]] 235 | name = "chacha20poly1305" 236 | version = "0.10.1" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" 239 | dependencies = [ 240 | "aead 0.5.2", 241 | "chacha20 0.9.1", 242 | "cipher 0.4.4", 243 | "poly1305 0.8.0", 244 | "zeroize", 245 | ] 246 | 247 | [[package]] 248 | name = "cipher" 249 | version = "0.3.0" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" 252 | dependencies = [ 253 | "generic-array", 254 | ] 255 | 256 | [[package]] 257 | name = "cipher" 258 | version = "0.4.4" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" 261 | dependencies = [ 262 | "crypto-common", 263 | "inout", 264 | "zeroize", 265 | ] 266 | 267 | [[package]] 268 | name = "clap" 269 | version = "2.34.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 272 | dependencies = [ 273 | "ansi_term", 274 | "atty", 275 | "bitflags", 276 | "strsim", 277 | "textwrap", 278 | "unicode-width", 279 | "vec_map", 280 | ] 281 | 282 | [[package]] 283 | name = "combine" 284 | version = "4.6.6" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" 287 | dependencies = [ 288 | "bytes", 289 | "memchr", 290 | ] 291 | 292 | [[package]] 293 | name = "cpufeatures" 294 | version = "0.1.5" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" 297 | dependencies = [ 298 | "libc", 299 | ] 300 | 301 | [[package]] 302 | name = "cpufeatures" 303 | version = "0.2.7" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" 306 | dependencies = [ 307 | "libc", 308 | ] 309 | 310 | [[package]] 311 | name = "crypto-common" 312 | version = "0.1.6" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 315 | dependencies = [ 316 | "generic-array", 317 | "rand_core 0.6.4", 318 | "typenum", 319 | ] 320 | 321 | [[package]] 322 | name = "crypto-mac" 323 | version = "0.11.1" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" 326 | dependencies = [ 327 | "generic-array", 328 | "subtle", 329 | ] 330 | 331 | [[package]] 332 | name = "ctr" 333 | version = "0.8.0" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" 336 | dependencies = [ 337 | "cipher 0.3.0", 338 | ] 339 | 340 | [[package]] 341 | name = "ctr" 342 | version = "0.9.2" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" 345 | dependencies = [ 346 | "cipher 0.4.4", 347 | ] 348 | 349 | [[package]] 350 | name = "curve25519-dalek" 351 | version = "3.2.0" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" 354 | dependencies = [ 355 | "byteorder", 356 | "digest 0.9.0", 357 | "rand_core 0.5.1", 358 | "subtle", 359 | "zeroize", 360 | ] 361 | 362 | [[package]] 363 | name = "digest" 364 | version = "0.9.0" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 367 | dependencies = [ 368 | "generic-array", 369 | ] 370 | 371 | [[package]] 372 | name = "digest" 373 | version = "0.10.6" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" 376 | dependencies = [ 377 | "block-buffer 0.10.4", 378 | "crypto-common", 379 | "subtle", 380 | ] 381 | 382 | [[package]] 383 | name = "env_logger" 384 | version = "0.9.3" 385 | source = "registry+https://github.com/rust-lang/crates.io-index" 386 | checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" 387 | dependencies = [ 388 | "atty", 389 | "humantime", 390 | "log", 391 | "regex", 392 | "termcolor", 393 | ] 394 | 395 | [[package]] 396 | name = "errno" 397 | version = "0.3.1" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 400 | dependencies = [ 401 | "errno-dragonfly", 402 | "libc", 403 | "windows-sys 0.48.0", 404 | ] 405 | 406 | [[package]] 407 | name = "errno-dragonfly" 408 | version = "0.1.2" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 411 | dependencies = [ 412 | "cc", 413 | "libc", 414 | ] 415 | 416 | [[package]] 417 | name = "fastrand" 418 | version = "1.9.0" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 421 | dependencies = [ 422 | "instant", 423 | ] 424 | 425 | [[package]] 426 | name = "generic-array" 427 | version = "0.14.7" 428 | source = "registry+https://github.com/rust-lang/crates.io-index" 429 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 430 | dependencies = [ 431 | "typenum", 432 | "version_check", 433 | ] 434 | 435 | [[package]] 436 | name = "getrandom" 437 | version = "0.2.9" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" 440 | dependencies = [ 441 | "cfg-if", 442 | "libc", 443 | "wasi", 444 | ] 445 | 446 | [[package]] 447 | name = "ghash" 448 | version = "0.4.4" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" 451 | dependencies = [ 452 | "opaque-debug", 453 | "polyval 0.5.3", 454 | ] 455 | 456 | [[package]] 457 | name = "ghash" 458 | version = "0.5.0" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" 461 | dependencies = [ 462 | "opaque-debug", 463 | "polyval 0.6.0", 464 | ] 465 | 466 | [[package]] 467 | name = "hashbrown" 468 | version = "0.12.3" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 471 | 472 | [[package]] 473 | name = "heck" 474 | version = "0.3.3" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 477 | dependencies = [ 478 | "unicode-segmentation", 479 | ] 480 | 481 | [[package]] 482 | name = "hermit-abi" 483 | version = "0.1.19" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 486 | dependencies = [ 487 | "libc", 488 | ] 489 | 490 | [[package]] 491 | name = "hermit-abi" 492 | version = "0.3.1" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 495 | 496 | [[package]] 497 | name = "hex" 498 | version = "0.4.3" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 501 | 502 | [[package]] 503 | name = "hkdf" 504 | version = "0.11.0" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "01706d578d5c281058480e673ae4086a9f4710d8df1ad80a5b03e39ece5f886b" 507 | dependencies = [ 508 | "digest 0.9.0", 509 | "hmac 0.11.0", 510 | ] 511 | 512 | [[package]] 513 | name = "hkdf" 514 | version = "0.12.3" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" 517 | dependencies = [ 518 | "hmac 0.12.1", 519 | ] 520 | 521 | [[package]] 522 | name = "hmac" 523 | version = "0.11.0" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" 526 | dependencies = [ 527 | "crypto-mac", 528 | "digest 0.9.0", 529 | ] 530 | 531 | [[package]] 532 | name = "hmac" 533 | version = "0.12.1" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 536 | dependencies = [ 537 | "digest 0.10.6", 538 | ] 539 | 540 | [[package]] 541 | name = "hpke" 542 | version = "0.10.0" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | checksum = "cf39e5461bfdc6ad0fbc97067519fcaf96a7a2e67f24cc0eb8a1e7c0c45af792" 545 | dependencies = [ 546 | "aead 0.5.2", 547 | "aes-gcm 0.10.1", 548 | "byteorder", 549 | "chacha20poly1305 0.10.1", 550 | "digest 0.10.6", 551 | "generic-array", 552 | "hkdf 0.12.3", 553 | "hmac 0.12.1", 554 | "rand_core 0.6.4", 555 | "sha2 0.10.6", 556 | "subtle", 557 | "x25519-dalek", 558 | "zeroize", 559 | ] 560 | 561 | [[package]] 562 | name = "hpke" 563 | version = "0.10.0" 564 | source = "git+https://github.com/bwesterb/rust-hpke?rev=71efb5cb88d8798ccd1aea09a2c6bf003b0f7f72#71efb5cb88d8798ccd1aea09a2c6bf003b0f7f72" 565 | dependencies = [ 566 | "aead 0.5.2", 567 | "aes-gcm 0.10.1", 568 | "byteorder", 569 | "chacha20poly1305 0.10.1", 570 | "digest 0.10.6", 571 | "generic-array", 572 | "hkdf 0.12.3", 573 | "hmac 0.12.1", 574 | "pqc_kyber", 575 | "rand_core 0.6.4", 576 | "sha2 0.10.6", 577 | "subtle", 578 | "x25519-dalek", 579 | "zeroize", 580 | ] 581 | 582 | [[package]] 583 | name = "humantime" 584 | version = "2.1.0" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 587 | 588 | [[package]] 589 | name = "indexmap" 590 | version = "1.9.3" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 593 | dependencies = [ 594 | "autocfg", 595 | "hashbrown", 596 | ] 597 | 598 | [[package]] 599 | name = "inout" 600 | version = "0.1.3" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" 603 | dependencies = [ 604 | "generic-array", 605 | ] 606 | 607 | [[package]] 608 | name = "instant" 609 | version = "0.1.12" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 612 | dependencies = [ 613 | "cfg-if", 614 | ] 615 | 616 | [[package]] 617 | name = "io-lifetimes" 618 | version = "1.0.10" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" 621 | dependencies = [ 622 | "hermit-abi 0.3.1", 623 | "libc", 624 | "windows-sys 0.48.0", 625 | ] 626 | 627 | [[package]] 628 | name = "itoa" 629 | version = "1.0.6" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 632 | 633 | [[package]] 634 | name = "jni" 635 | version = "0.19.0" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" 638 | dependencies = [ 639 | "cesu8", 640 | "combine", 641 | "jni-sys", 642 | "log", 643 | "thiserror", 644 | "walkdir", 645 | ] 646 | 647 | [[package]] 648 | name = "jni-sys" 649 | version = "0.3.0" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" 652 | 653 | [[package]] 654 | name = "lazy_static" 655 | version = "1.4.0" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 658 | 659 | [[package]] 660 | name = "libc" 661 | version = "0.2.144" 662 | source = "registry+https://github.com/rust-lang/crates.io-index" 663 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" 664 | 665 | [[package]] 666 | name = "linux-raw-sys" 667 | version = "0.3.7" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" 670 | 671 | [[package]] 672 | name = "log" 673 | version = "0.4.17" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 676 | dependencies = [ 677 | "cfg-if", 678 | ] 679 | 680 | [[package]] 681 | name = "memchr" 682 | version = "2.5.0" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 685 | 686 | [[package]] 687 | name = "ohttp" 688 | version = "0.4.0" 689 | source = "git+https://github.com/martinthomson/ohttp#117afed1533f589a3a994e5cb10bcfa02c574e03" 690 | dependencies = [ 691 | "aead 0.4.3", 692 | "aes-gcm 0.9.4", 693 | "byteorder", 694 | "chacha20poly1305 0.8.0", 695 | "hex", 696 | "hkdf 0.11.0", 697 | "hpke 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 698 | "hpke 0.10.0 (git+https://github.com/bwesterb/rust-hpke?rev=71efb5cb88d8798ccd1aea09a2c6bf003b0f7f72)", 699 | "lazy_static", 700 | "log", 701 | "rand", 702 | "serde", 703 | "serde_derive", 704 | "sha2 0.9.9", 705 | "thiserror", 706 | "toml", 707 | ] 708 | 709 | [[package]] 710 | name = "opaque-debug" 711 | version = "0.3.0" 712 | source = "registry+https://github.com/rust-lang/crates.io-index" 713 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 714 | 715 | [[package]] 716 | name = "poly1305" 717 | version = "0.7.2" 718 | source = "registry+https://github.com/rust-lang/crates.io-index" 719 | checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" 720 | dependencies = [ 721 | "cpufeatures 0.2.7", 722 | "opaque-debug", 723 | "universal-hash 0.4.1", 724 | ] 725 | 726 | [[package]] 727 | name = "poly1305" 728 | version = "0.8.0" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" 731 | dependencies = [ 732 | "cpufeatures 0.2.7", 733 | "opaque-debug", 734 | "universal-hash 0.5.0", 735 | ] 736 | 737 | [[package]] 738 | name = "polyval" 739 | version = "0.5.3" 740 | source = "registry+https://github.com/rust-lang/crates.io-index" 741 | checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" 742 | dependencies = [ 743 | "cfg-if", 744 | "cpufeatures 0.2.7", 745 | "opaque-debug", 746 | "universal-hash 0.4.1", 747 | ] 748 | 749 | [[package]] 750 | name = "polyval" 751 | version = "0.6.0" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" 754 | dependencies = [ 755 | "cfg-if", 756 | "cpufeatures 0.2.7", 757 | "opaque-debug", 758 | "universal-hash 0.5.0", 759 | ] 760 | 761 | [[package]] 762 | name = "ppv-lite86" 763 | version = "0.2.17" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 766 | 767 | [[package]] 768 | name = "pqc_kyber" 769 | version = "0.5.0" 770 | source = "git+https://github.com/bwesterb/argyle-kyber#6cabc50ddf2a36fdaf50ee1c932009ce6f2754ea" 771 | dependencies = [ 772 | "rand_core 0.6.4", 773 | ] 774 | 775 | [[package]] 776 | name = "proc-macro2" 777 | version = "1.0.58" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" 780 | dependencies = [ 781 | "unicode-ident", 782 | ] 783 | 784 | [[package]] 785 | name = "quote" 786 | version = "1.0.27" 787 | source = "registry+https://github.com/rust-lang/crates.io-index" 788 | checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" 789 | dependencies = [ 790 | "proc-macro2", 791 | ] 792 | 793 | [[package]] 794 | name = "rand" 795 | version = "0.8.5" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 798 | dependencies = [ 799 | "libc", 800 | "rand_chacha", 801 | "rand_core 0.6.4", 802 | ] 803 | 804 | [[package]] 805 | name = "rand_chacha" 806 | version = "0.3.1" 807 | source = "registry+https://github.com/rust-lang/crates.io-index" 808 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 809 | dependencies = [ 810 | "ppv-lite86", 811 | "rand_core 0.6.4", 812 | ] 813 | 814 | [[package]] 815 | name = "rand_core" 816 | version = "0.5.1" 817 | source = "registry+https://github.com/rust-lang/crates.io-index" 818 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 819 | 820 | [[package]] 821 | name = "rand_core" 822 | version = "0.6.4" 823 | source = "registry+https://github.com/rust-lang/crates.io-index" 824 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 825 | dependencies = [ 826 | "getrandom", 827 | ] 828 | 829 | [[package]] 830 | name = "redox_syscall" 831 | version = "0.3.5" 832 | source = "registry+https://github.com/rust-lang/crates.io-index" 833 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 834 | dependencies = [ 835 | "bitflags", 836 | ] 837 | 838 | [[package]] 839 | name = "regex" 840 | version = "1.8.1" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" 843 | dependencies = [ 844 | "aho-corasick", 845 | "memchr", 846 | "regex-syntax", 847 | ] 848 | 849 | [[package]] 850 | name = "regex-syntax" 851 | version = "0.7.1" 852 | source = "registry+https://github.com/rust-lang/crates.io-index" 853 | checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" 854 | 855 | [[package]] 856 | name = "rustix" 857 | version = "0.37.27" 858 | source = "registry+https://github.com/rust-lang/crates.io-index" 859 | checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" 860 | dependencies = [ 861 | "bitflags", 862 | "errno", 863 | "io-lifetimes", 864 | "libc", 865 | "linux-raw-sys", 866 | "windows-sys 0.48.0", 867 | ] 868 | 869 | [[package]] 870 | name = "ryu" 871 | version = "1.0.13" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 874 | 875 | [[package]] 876 | name = "same-file" 877 | version = "1.0.6" 878 | source = "registry+https://github.com/rust-lang/crates.io-index" 879 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 880 | dependencies = [ 881 | "winapi-util", 882 | ] 883 | 884 | [[package]] 885 | name = "serde" 886 | version = "1.0.163" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" 889 | dependencies = [ 890 | "serde_derive", 891 | ] 892 | 893 | [[package]] 894 | name = "serde_derive" 895 | version = "1.0.163" 896 | source = "registry+https://github.com/rust-lang/crates.io-index" 897 | checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" 898 | dependencies = [ 899 | "proc-macro2", 900 | "quote", 901 | "syn 2.0.16", 902 | ] 903 | 904 | [[package]] 905 | name = "serde_json" 906 | version = "1.0.96" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" 909 | dependencies = [ 910 | "itoa", 911 | "ryu", 912 | "serde", 913 | ] 914 | 915 | [[package]] 916 | name = "sha2" 917 | version = "0.9.9" 918 | source = "registry+https://github.com/rust-lang/crates.io-index" 919 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 920 | dependencies = [ 921 | "block-buffer 0.9.0", 922 | "cfg-if", 923 | "cpufeatures 0.2.7", 924 | "digest 0.9.0", 925 | "opaque-debug", 926 | ] 927 | 928 | [[package]] 929 | name = "sha2" 930 | version = "0.10.6" 931 | source = "registry+https://github.com/rust-lang/crates.io-index" 932 | checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" 933 | dependencies = [ 934 | "cfg-if", 935 | "cpufeatures 0.2.7", 936 | "digest 0.10.6", 937 | ] 938 | 939 | [[package]] 940 | name = "strsim" 941 | version = "0.8.0" 942 | source = "registry+https://github.com/rust-lang/crates.io-index" 943 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 944 | 945 | [[package]] 946 | name = "subtle" 947 | version = "2.4.1" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 950 | 951 | [[package]] 952 | name = "syn" 953 | version = "1.0.109" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 956 | dependencies = [ 957 | "proc-macro2", 958 | "quote", 959 | "unicode-ident", 960 | ] 961 | 962 | [[package]] 963 | name = "syn" 964 | version = "2.0.16" 965 | source = "registry+https://github.com/rust-lang/crates.io-index" 966 | checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" 967 | dependencies = [ 968 | "proc-macro2", 969 | "quote", 970 | "unicode-ident", 971 | ] 972 | 973 | [[package]] 974 | name = "tempfile" 975 | version = "3.5.0" 976 | source = "registry+https://github.com/rust-lang/crates.io-index" 977 | checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" 978 | dependencies = [ 979 | "cfg-if", 980 | "fastrand", 981 | "redox_syscall", 982 | "rustix", 983 | "windows-sys 0.45.0", 984 | ] 985 | 986 | [[package]] 987 | name = "termcolor" 988 | version = "1.2.0" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 991 | dependencies = [ 992 | "winapi-util", 993 | ] 994 | 995 | [[package]] 996 | name = "textwrap" 997 | version = "0.11.0" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 1000 | dependencies = [ 1001 | "unicode-width", 1002 | ] 1003 | 1004 | [[package]] 1005 | name = "thiserror" 1006 | version = "1.0.40" 1007 | source = "registry+https://github.com/rust-lang/crates.io-index" 1008 | checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" 1009 | dependencies = [ 1010 | "thiserror-impl", 1011 | ] 1012 | 1013 | [[package]] 1014 | name = "thiserror-impl" 1015 | version = "1.0.40" 1016 | source = "registry+https://github.com/rust-lang/crates.io-index" 1017 | checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" 1018 | dependencies = [ 1019 | "proc-macro2", 1020 | "quote", 1021 | "syn 2.0.16", 1022 | ] 1023 | 1024 | [[package]] 1025 | name = "toml" 1026 | version = "0.5.11" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 1029 | dependencies = [ 1030 | "serde", 1031 | ] 1032 | 1033 | [[package]] 1034 | name = "typenum" 1035 | version = "1.16.0" 1036 | source = "registry+https://github.com/rust-lang/crates.io-index" 1037 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1038 | 1039 | [[package]] 1040 | name = "unicode-ident" 1041 | version = "1.0.8" 1042 | source = "registry+https://github.com/rust-lang/crates.io-index" 1043 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 1044 | 1045 | [[package]] 1046 | name = "unicode-segmentation" 1047 | version = "1.10.1" 1048 | source = "registry+https://github.com/rust-lang/crates.io-index" 1049 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" 1050 | 1051 | [[package]] 1052 | name = "unicode-width" 1053 | version = "0.1.10" 1054 | source = "registry+https://github.com/rust-lang/crates.io-index" 1055 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 1056 | 1057 | [[package]] 1058 | name = "universal-hash" 1059 | version = "0.4.1" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" 1062 | dependencies = [ 1063 | "generic-array", 1064 | "subtle", 1065 | ] 1066 | 1067 | [[package]] 1068 | name = "universal-hash" 1069 | version = "0.5.0" 1070 | source = "registry+https://github.com/rust-lang/crates.io-index" 1071 | checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" 1072 | dependencies = [ 1073 | "crypto-common", 1074 | "subtle", 1075 | ] 1076 | 1077 | [[package]] 1078 | name = "vec_map" 1079 | version = "0.8.2" 1080 | source = "registry+https://github.com/rust-lang/crates.io-index" 1081 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 1082 | 1083 | [[package]] 1084 | name = "version_check" 1085 | version = "0.9.4" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1088 | 1089 | [[package]] 1090 | name = "walkdir" 1091 | version = "2.3.3" 1092 | source = "registry+https://github.com/rust-lang/crates.io-index" 1093 | checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" 1094 | dependencies = [ 1095 | "same-file", 1096 | "winapi-util", 1097 | ] 1098 | 1099 | [[package]] 1100 | name = "wasi" 1101 | version = "0.11.0+wasi-snapshot-preview1" 1102 | source = "registry+https://github.com/rust-lang/crates.io-index" 1103 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1104 | 1105 | [[package]] 1106 | name = "winapi" 1107 | version = "0.3.9" 1108 | source = "registry+https://github.com/rust-lang/crates.io-index" 1109 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1110 | dependencies = [ 1111 | "winapi-i686-pc-windows-gnu", 1112 | "winapi-x86_64-pc-windows-gnu", 1113 | ] 1114 | 1115 | [[package]] 1116 | name = "winapi-i686-pc-windows-gnu" 1117 | version = "0.4.0" 1118 | source = "registry+https://github.com/rust-lang/crates.io-index" 1119 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1120 | 1121 | [[package]] 1122 | name = "winapi-util" 1123 | version = "0.1.5" 1124 | source = "registry+https://github.com/rust-lang/crates.io-index" 1125 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1126 | dependencies = [ 1127 | "winapi", 1128 | ] 1129 | 1130 | [[package]] 1131 | name = "winapi-x86_64-pc-windows-gnu" 1132 | version = "0.4.0" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1135 | 1136 | [[package]] 1137 | name = "windows-sys" 1138 | version = "0.45.0" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1141 | dependencies = [ 1142 | "windows-targets 0.42.2", 1143 | ] 1144 | 1145 | [[package]] 1146 | name = "windows-sys" 1147 | version = "0.48.0" 1148 | source = "registry+https://github.com/rust-lang/crates.io-index" 1149 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1150 | dependencies = [ 1151 | "windows-targets 0.48.0", 1152 | ] 1153 | 1154 | [[package]] 1155 | name = "windows-targets" 1156 | version = "0.42.2" 1157 | source = "registry+https://github.com/rust-lang/crates.io-index" 1158 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1159 | dependencies = [ 1160 | "windows_aarch64_gnullvm 0.42.2", 1161 | "windows_aarch64_msvc 0.42.2", 1162 | "windows_i686_gnu 0.42.2", 1163 | "windows_i686_msvc 0.42.2", 1164 | "windows_x86_64_gnu 0.42.2", 1165 | "windows_x86_64_gnullvm 0.42.2", 1166 | "windows_x86_64_msvc 0.42.2", 1167 | ] 1168 | 1169 | [[package]] 1170 | name = "windows-targets" 1171 | version = "0.48.0" 1172 | source = "registry+https://github.com/rust-lang/crates.io-index" 1173 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1174 | dependencies = [ 1175 | "windows_aarch64_gnullvm 0.48.0", 1176 | "windows_aarch64_msvc 0.48.0", 1177 | "windows_i686_gnu 0.48.0", 1178 | "windows_i686_msvc 0.48.0", 1179 | "windows_x86_64_gnu 0.48.0", 1180 | "windows_x86_64_gnullvm 0.48.0", 1181 | "windows_x86_64_msvc 0.48.0", 1182 | ] 1183 | 1184 | [[package]] 1185 | name = "windows_aarch64_gnullvm" 1186 | version = "0.42.2" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1189 | 1190 | [[package]] 1191 | name = "windows_aarch64_gnullvm" 1192 | version = "0.48.0" 1193 | source = "registry+https://github.com/rust-lang/crates.io-index" 1194 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1195 | 1196 | [[package]] 1197 | name = "windows_aarch64_msvc" 1198 | version = "0.42.2" 1199 | source = "registry+https://github.com/rust-lang/crates.io-index" 1200 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1201 | 1202 | [[package]] 1203 | name = "windows_aarch64_msvc" 1204 | version = "0.48.0" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1207 | 1208 | [[package]] 1209 | name = "windows_i686_gnu" 1210 | version = "0.42.2" 1211 | source = "registry+https://github.com/rust-lang/crates.io-index" 1212 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1213 | 1214 | [[package]] 1215 | name = "windows_i686_gnu" 1216 | version = "0.48.0" 1217 | source = "registry+https://github.com/rust-lang/crates.io-index" 1218 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1219 | 1220 | [[package]] 1221 | name = "windows_i686_msvc" 1222 | version = "0.42.2" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1225 | 1226 | [[package]] 1227 | name = "windows_i686_msvc" 1228 | version = "0.48.0" 1229 | source = "registry+https://github.com/rust-lang/crates.io-index" 1230 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1231 | 1232 | [[package]] 1233 | name = "windows_x86_64_gnu" 1234 | version = "0.42.2" 1235 | source = "registry+https://github.com/rust-lang/crates.io-index" 1236 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1237 | 1238 | [[package]] 1239 | name = "windows_x86_64_gnu" 1240 | version = "0.48.0" 1241 | source = "registry+https://github.com/rust-lang/crates.io-index" 1242 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1243 | 1244 | [[package]] 1245 | name = "windows_x86_64_gnullvm" 1246 | version = "0.42.2" 1247 | source = "registry+https://github.com/rust-lang/crates.io-index" 1248 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1249 | 1250 | [[package]] 1251 | name = "windows_x86_64_gnullvm" 1252 | version = "0.48.0" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1255 | 1256 | [[package]] 1257 | name = "windows_x86_64_msvc" 1258 | version = "0.42.2" 1259 | source = "registry+https://github.com/rust-lang/crates.io-index" 1260 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1261 | 1262 | [[package]] 1263 | name = "windows_x86_64_msvc" 1264 | version = "0.48.0" 1265 | source = "registry+https://github.com/rust-lang/crates.io-index" 1266 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1267 | 1268 | [[package]] 1269 | name = "x25519-dalek" 1270 | version = "2.0.0-pre.1" 1271 | source = "registry+https://github.com/rust-lang/crates.io-index" 1272 | checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" 1273 | dependencies = [ 1274 | "curve25519-dalek", 1275 | "rand_core 0.6.4", 1276 | "zeroize", 1277 | ] 1278 | 1279 | [[package]] 1280 | name = "zeroize" 1281 | version = "1.6.0" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" 1284 | dependencies = [ 1285 | "zeroize_derive", 1286 | ] 1287 | 1288 | [[package]] 1289 | name = "zeroize_derive" 1290 | version = "1.4.2" 1291 | source = "registry+https://github.com/rust-lang/crates.io-index" 1292 | checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" 1293 | dependencies = [ 1294 | "proc-macro2", 1295 | "quote", 1296 | "syn 2.0.16", 1297 | ] 1298 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | 2 | [workspace] 3 | resolver = "2" 4 | 5 | members = ["apprelay"] 6 | 7 | [profile.release-space-optimized] 8 | inherits = "release" 9 | strip = true # Automatically strip symbols from the binary. 10 | opt-level = "z" # Optimize for size. 11 | lto = true # Enable link time optimization 12 | codegen-units = 1 # Reduce parallel code generation units 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Cloudflare Inc. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sample Privacy Gateway Client Library 2 | 3 | This project contains a sample library that exposes [OHTTP](https://datatracker.ietf.org/doc/html/draft-ietf-ohai-ohttp-02) client-side interfaces for iOS and macOS. It is compatible with the sample [relay](https://github.com/cloudflare/privacy-gateway-relay) and corresponding [server](https://github.com/cloudflare/privacy-gateway-server-go). 4 | 5 | ## Build instructions 6 | 7 | Prior to building for any platform, [download and install Rust](https://rustup.rs) - we recommend at least `rustc 1.56.0 (09c42c458 2021-10-18)` or greater. 8 | 9 | Running `cargo build --release` will build the library for the current platform, and library files will appear in `./target/release/` 10 | 11 | ## Releasing new versions 12 | 13 | New versions and their corresponding artifacts are done by creating a [new release](https://github.com/cloudflare/app-relay-client-library/releases/new) with version number starting from letter `v` ie `v1.0.0`. A GitHub action will upload relevant release artifacts to release page. 14 | 15 | ## iOS Build Instructions 16 | 17 | To build the library for iOS: 18 | 19 | ```sh 20 | # Ensure you have the XCode SDK installed and available on your PATH: 21 | ➜ xcrun --show-sdk-build-version 22 | 21A344 23 | 24 | # Install the iOS and macOS cross-compilation targets in your Rust toolchain 25 | ➜ rustup target add aarch64-apple-ios 26 | info: component 'rust-std' for target 'aarch64-apple-ios' is up to date 27 | 28 | # Install the iOS and macOS cross-compilation targets in your Rust toolchain 29 | ➜ rustup target add x86_64-apple-darwin 30 | info: component 'rust-std' for target 'x86_64-apple-darwin' is up to date 31 | ``` 32 | 33 | With the pre-requisites installed, run `cargo build` in `--release` mode: 34 | 35 | ```sh 36 | ➜ cargo build --target aarch64-apple-ios --release 37 | ``` 38 | 39 | Library files will appear in `./target/aarch64-apple-ios/release`. SystemConfiguration.framework (part of the XCode SDK) is required for iOS and macOS apps. 40 | 41 | ## macOS Build Instructions 42 | 43 | To build for macOS, run the following: 44 | 45 | ```sh 46 | ➜ cargo build --target x86_64-apple-darwin --release 47 | ``` 48 | 49 | As with iOS, link with SystemConfiguration.framework when building your macOS app. 50 | 51 | 52 | ## Android Build Instructions 53 | 54 | To build for android devices you must first download the appropriate binary 55 | distribution of standard library for valid target platform. This can be done using rustup: 56 | 57 | ```sh 58 | ➜ rustup target add armv7-linux-androideabi 59 | # there are other targets that might be appropriate 60 | ➜ rustup show | grep android 61 | ``` 62 | 63 | To setup compilation for android you will also need to tell cargo 64 | about other compilation tools especialy linker. 65 | Follow [NDK](https://developer.android.com/ndk) installation instructions. 66 | Then configure cargo with linker and archiver: 67 | 68 | ```sh 69 | # set valid paths! 70 | ➜ export ANDROID_HOME=/Users/$USER/Library/Android/sdk 71 | ➜ export NDK_HOME=$ANDROID_HOME/ndk/25.0.8775105 72 | 73 | ➜ mkdir ~/.cargo 74 | ➜ cat << EOF > ~/.cargo/config 75 | [target.armv7-linux-androideabi] 76 | ar = "$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" 77 | linker = "$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi24-clang++" 78 | EOF 79 | 80 | ➜ cargo build --target armv7-linux-androideabi 81 | ``` 82 | 83 | This should work but currently ends with error due to [bug](https://github.com/rust-lang/rust/pull/85806): 84 | 85 | ``` 86 | = note: ld: error: unable to find library -lgcc 87 | clang-14: error: linker command failed with exit code 1 (use -v to see invocation) 88 | ``` 89 | 90 | Ndk project has a workaround applied so should work out of the box: 91 | 92 | ```sh 93 | ➜ cargo install cargo-ndk 94 | ➜ rustup target add \ 95 | aarch64-linux-android \ 96 | armv7-linux-androideabi \ 97 | ➜ cargo ndk \ 98 | -t armeabi-v7a \ 99 | -t arm64-v8a \ 100 | -o ./target/jniLibs build --release 101 | ``` 102 | 103 | To use from java create 'OHttpNativeWrapper.java' with contents (the class name and the package are important because of JNI conventions) 104 | 105 | ```java 106 | package org.platform; 107 | 108 | class OHttpNativeWrapper { 109 | 110 | static { 111 | System.loadLibrary("apprelay"); 112 | } 113 | 114 | private static native long encapsulateRequest(byte[] config, byte[] msg); 115 | 116 | private static native byte[] getEncapsulatedRequest(long ctx_ptr); 117 | 118 | private static native void dropRequestContext(long ctx_ptr); 119 | 120 | private static native byte[] decapsulateResponse(long ctx_ptr, byte[] encapsulated_response); 121 | 122 | public static native String lastErrorMessage(); 123 | 124 | public static native void init(); 125 | 126 | public static native void drop(long ctx_ptr); 127 | } 128 | ``` 129 | 130 | And pass library using VM arguments: 131 | 132 | ``` 133 | # lib directory should contain libapprelay.so 134 | -Djava.library.path="lib/" 135 | ``` 136 | 137 | ## Building size optimized binaries 138 | 139 | To build binaries with a smaller disk footprint you can use the `release-space-optimized` profile: 140 | 141 | ```sh 142 | # for iOS 143 | ➜ cargo build \ 144 | --target aarch64-apple-ios \ 145 | --no-default-features \ 146 | --profile release-space-optimized 147 | 148 | # for Android this will fail using ndk but the binaries will be located 149 | # in different directory. See https://github.com/bbqsrc/cargo-ndk/issues/73 150 | ➜ cargo ndk \ 151 | -t armeabi-v7a \ 152 | -t arm64-v8a \ 153 | -o ./target/jniLibs build --profile release-space-optimized 154 | ``` 155 | 156 | For more background about the parameters set for this profile read [this repo](https://github.com/johnthagen/min-sized-rust). 157 | 158 | ## Logging in runtime 159 | 160 | The library uses crate `env_logger` configured to log to stdout. To enable logging set environment variable: 161 | 162 | ``` 163 | RUST_LOG=debug 164 | ``` 165 | 166 | And in your application be sure to call function `initialize_logging` for C API or `init` for JNI. 167 | Initialization function can be called only once. 168 | 169 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Vulnerabilities 2 | 3 | Please see [this page](https://www.cloudflare.com/.well-known/security.txt) for information on how to report a vulnerability to Cloudflare. Thanks! 4 | -------------------------------------------------------------------------------- /apprelay/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aead" 7 | version = "0.4.3" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" 10 | dependencies = [ 11 | "generic-array", 12 | "rand_core 0.6.3", 13 | ] 14 | 15 | [[package]] 16 | name = "aes" 17 | version = "0.7.5" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" 20 | dependencies = [ 21 | "cfg-if", 22 | "cipher", 23 | "cpufeatures 0.2.2", 24 | "opaque-debug", 25 | ] 26 | 27 | [[package]] 28 | name = "aes-gcm" 29 | version = "0.9.4" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" 32 | dependencies = [ 33 | "aead", 34 | "aes", 35 | "cipher", 36 | "ctr", 37 | "ghash", 38 | "subtle", 39 | ] 40 | 41 | [[package]] 42 | name = "ansi_term" 43 | version = "0.12.1" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 46 | dependencies = [ 47 | "winapi", 48 | ] 49 | 50 | [[package]] 51 | name = "apprelay" 52 | version = "0.1.0" 53 | dependencies = [ 54 | "base64", 55 | "bhttp", 56 | "bytes", 57 | "cbindgen", 58 | "futures", 59 | "hex", 60 | "jni", 61 | "libc", 62 | "nix", 63 | "ohttp", 64 | "serde_json", 65 | ] 66 | 67 | [[package]] 68 | name = "atty" 69 | version = "0.2.14" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 72 | dependencies = [ 73 | "hermit-abi", 74 | "libc", 75 | "winapi", 76 | ] 77 | 78 | [[package]] 79 | name = "autocfg" 80 | version = "1.1.0" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 83 | 84 | [[package]] 85 | name = "base64" 86 | version = "0.13.0" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 89 | 90 | [[package]] 91 | name = "bhttp" 92 | version = "0.1.0" 93 | source = "git+https://github.com/martinthomson/ohttp#5b031fd20e8376110c3ff0a446b0e9c4d78fe761" 94 | dependencies = [ 95 | "url", 96 | ] 97 | 98 | [[package]] 99 | name = "bindgen" 100 | version = "0.56.0" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" 103 | dependencies = [ 104 | "bitflags", 105 | "cexpr", 106 | "clang-sys", 107 | "lazy_static", 108 | "lazycell", 109 | "peeking_take_while", 110 | "proc-macro2", 111 | "quote", 112 | "regex", 113 | "rustc-hash", 114 | "shlex", 115 | ] 116 | 117 | [[package]] 118 | name = "bitflags" 119 | version = "1.3.2" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 122 | 123 | [[package]] 124 | name = "block-buffer" 125 | version = "0.9.0" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 128 | dependencies = [ 129 | "generic-array", 130 | ] 131 | 132 | [[package]] 133 | name = "byteorder" 134 | version = "1.4.3" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 137 | 138 | [[package]] 139 | name = "bytes" 140 | version = "1.2.1" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" 143 | 144 | [[package]] 145 | name = "cbindgen" 146 | version = "0.17.0" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "744fcfb4c9f64d649756fd972afec5120641eaa8b2ff86a4ae981f68648780b8" 149 | dependencies = [ 150 | "clap", 151 | "heck", 152 | "indexmap", 153 | "log", 154 | "proc-macro2", 155 | "quote", 156 | "serde", 157 | "serde_json", 158 | "syn", 159 | "tempfile", 160 | "toml", 161 | ] 162 | 163 | [[package]] 164 | name = "cc" 165 | version = "1.0.73" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 168 | 169 | [[package]] 170 | name = "cesu8" 171 | version = "1.1.0" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" 174 | 175 | [[package]] 176 | name = "cexpr" 177 | version = "0.4.0" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" 180 | dependencies = [ 181 | "nom", 182 | ] 183 | 184 | [[package]] 185 | name = "cfg-if" 186 | version = "1.0.0" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 189 | 190 | [[package]] 191 | name = "chacha20" 192 | version = "0.7.1" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "fee7ad89dc1128635074c268ee661f90c3f7e83d9fd12910608c36b47d6c3412" 195 | dependencies = [ 196 | "cfg-if", 197 | "cipher", 198 | "cpufeatures 0.1.5", 199 | "zeroize", 200 | ] 201 | 202 | [[package]] 203 | name = "chacha20poly1305" 204 | version = "0.8.0" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "1580317203210c517b6d44794abfbe600698276db18127e37ad3e69bf5e848e5" 207 | dependencies = [ 208 | "aead", 209 | "chacha20", 210 | "cipher", 211 | "poly1305", 212 | "zeroize", 213 | ] 214 | 215 | [[package]] 216 | name = "cipher" 217 | version = "0.3.0" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" 220 | dependencies = [ 221 | "generic-array", 222 | ] 223 | 224 | [[package]] 225 | name = "clang-sys" 226 | version = "1.3.3" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" 229 | dependencies = [ 230 | "glob", 231 | "libc", 232 | "libloading", 233 | ] 234 | 235 | [[package]] 236 | name = "clap" 237 | version = "2.34.0" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 240 | dependencies = [ 241 | "ansi_term", 242 | "atty", 243 | "bitflags", 244 | "strsim", 245 | "textwrap", 246 | "unicode-width", 247 | "vec_map", 248 | ] 249 | 250 | [[package]] 251 | name = "combine" 252 | version = "4.6.4" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" 255 | dependencies = [ 256 | "bytes", 257 | "memchr", 258 | ] 259 | 260 | [[package]] 261 | name = "cpufeatures" 262 | version = "0.1.5" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" 265 | dependencies = [ 266 | "libc", 267 | ] 268 | 269 | [[package]] 270 | name = "cpufeatures" 271 | version = "0.2.2" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" 274 | dependencies = [ 275 | "libc", 276 | ] 277 | 278 | [[package]] 279 | name = "crypto-mac" 280 | version = "0.11.1" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" 283 | dependencies = [ 284 | "generic-array", 285 | "subtle", 286 | ] 287 | 288 | [[package]] 289 | name = "ctr" 290 | version = "0.8.0" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" 293 | dependencies = [ 294 | "cipher", 295 | ] 296 | 297 | [[package]] 298 | name = "curve25519-dalek" 299 | version = "3.2.0" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" 302 | dependencies = [ 303 | "byteorder", 304 | "digest", 305 | "rand_core 0.5.1", 306 | "subtle", 307 | "zeroize", 308 | ] 309 | 310 | [[package]] 311 | name = "digest" 312 | version = "0.9.0" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 315 | dependencies = [ 316 | "generic-array", 317 | ] 318 | 319 | [[package]] 320 | name = "env_logger" 321 | version = "0.8.4" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" 324 | dependencies = [ 325 | "log", 326 | ] 327 | 328 | [[package]] 329 | name = "fastrand" 330 | version = "1.8.0" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" 333 | dependencies = [ 334 | "instant", 335 | ] 336 | 337 | [[package]] 338 | name = "form_urlencoded" 339 | version = "1.0.1" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 342 | dependencies = [ 343 | "matches", 344 | "percent-encoding", 345 | ] 346 | 347 | [[package]] 348 | name = "futures" 349 | version = "0.3.21" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" 352 | dependencies = [ 353 | "futures-channel", 354 | "futures-core", 355 | "futures-executor", 356 | "futures-io", 357 | "futures-sink", 358 | "futures-task", 359 | "futures-util", 360 | ] 361 | 362 | [[package]] 363 | name = "futures-channel" 364 | version = "0.3.21" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" 367 | dependencies = [ 368 | "futures-core", 369 | "futures-sink", 370 | ] 371 | 372 | [[package]] 373 | name = "futures-core" 374 | version = "0.3.21" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" 377 | 378 | [[package]] 379 | name = "futures-executor" 380 | version = "0.3.21" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" 383 | dependencies = [ 384 | "futures-core", 385 | "futures-task", 386 | "futures-util", 387 | ] 388 | 389 | [[package]] 390 | name = "futures-io" 391 | version = "0.3.21" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" 394 | 395 | [[package]] 396 | name = "futures-macro" 397 | version = "0.3.21" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" 400 | dependencies = [ 401 | "proc-macro2", 402 | "quote", 403 | "syn", 404 | ] 405 | 406 | [[package]] 407 | name = "futures-sink" 408 | version = "0.3.21" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" 411 | 412 | [[package]] 413 | name = "futures-task" 414 | version = "0.3.21" 415 | source = "registry+https://github.com/rust-lang/crates.io-index" 416 | checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" 417 | 418 | [[package]] 419 | name = "futures-util" 420 | version = "0.3.21" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" 423 | dependencies = [ 424 | "futures-channel", 425 | "futures-core", 426 | "futures-io", 427 | "futures-macro", 428 | "futures-sink", 429 | "futures-task", 430 | "memchr", 431 | "pin-project-lite", 432 | "pin-utils", 433 | "slab", 434 | ] 435 | 436 | [[package]] 437 | name = "generic-array" 438 | version = "0.14.6" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" 441 | dependencies = [ 442 | "typenum", 443 | "version_check", 444 | ] 445 | 446 | [[package]] 447 | name = "getrandom" 448 | version = "0.2.7" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" 451 | dependencies = [ 452 | "cfg-if", 453 | "libc", 454 | "wasi", 455 | ] 456 | 457 | [[package]] 458 | name = "ghash" 459 | version = "0.4.4" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" 462 | dependencies = [ 463 | "opaque-debug", 464 | "polyval", 465 | ] 466 | 467 | [[package]] 468 | name = "glob" 469 | version = "0.3.0" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 472 | 473 | [[package]] 474 | name = "hashbrown" 475 | version = "0.12.3" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 478 | 479 | [[package]] 480 | name = "heck" 481 | version = "0.3.3" 482 | source = "registry+https://github.com/rust-lang/crates.io-index" 483 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 484 | dependencies = [ 485 | "unicode-segmentation", 486 | ] 487 | 488 | [[package]] 489 | name = "hermit-abi" 490 | version = "0.1.19" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 493 | dependencies = [ 494 | "libc", 495 | ] 496 | 497 | [[package]] 498 | name = "hex" 499 | version = "0.4.3" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 502 | 503 | [[package]] 504 | name = "hkdf" 505 | version = "0.11.0" 506 | source = "registry+https://github.com/rust-lang/crates.io-index" 507 | checksum = "01706d578d5c281058480e673ae4086a9f4710d8df1ad80a5b03e39ece5f886b" 508 | dependencies = [ 509 | "digest", 510 | "hmac", 511 | ] 512 | 513 | [[package]] 514 | name = "hmac" 515 | version = "0.11.0" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" 518 | dependencies = [ 519 | "crypto-mac", 520 | "digest", 521 | ] 522 | 523 | [[package]] 524 | name = "hpke" 525 | version = "0.7.1" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "2b27779b5c326e3afe887e806ab04ac34922a9a723ee3fae62170b3f7ad33380" 528 | dependencies = [ 529 | "aead", 530 | "aes-gcm", 531 | "byteorder", 532 | "chacha20poly1305", 533 | "digest", 534 | "generic-array", 535 | "hkdf", 536 | "rand_core 0.6.3", 537 | "sha2", 538 | "subtle", 539 | "x25519-dalek", 540 | "zeroize", 541 | ] 542 | 543 | [[package]] 544 | name = "idna" 545 | version = "0.2.3" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 548 | dependencies = [ 549 | "matches", 550 | "unicode-bidi", 551 | "unicode-normalization", 552 | ] 553 | 554 | [[package]] 555 | name = "indexmap" 556 | version = "1.9.1" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" 559 | dependencies = [ 560 | "autocfg", 561 | "hashbrown", 562 | ] 563 | 564 | [[package]] 565 | name = "instant" 566 | version = "0.1.12" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 569 | dependencies = [ 570 | "cfg-if", 571 | ] 572 | 573 | [[package]] 574 | name = "itoa" 575 | version = "1.0.2" 576 | source = "registry+https://github.com/rust-lang/crates.io-index" 577 | checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" 578 | 579 | [[package]] 580 | name = "jni" 581 | version = "0.19.0" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" 584 | dependencies = [ 585 | "cesu8", 586 | "combine", 587 | "jni-sys", 588 | "log", 589 | "thiserror", 590 | "walkdir", 591 | ] 592 | 593 | [[package]] 594 | name = "jni-sys" 595 | version = "0.3.0" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" 598 | 599 | [[package]] 600 | name = "lazy_static" 601 | version = "1.4.0" 602 | source = "registry+https://github.com/rust-lang/crates.io-index" 603 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 604 | 605 | [[package]] 606 | name = "lazycell" 607 | version = "1.3.0" 608 | source = "registry+https://github.com/rust-lang/crates.io-index" 609 | checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 610 | 611 | [[package]] 612 | name = "libc" 613 | version = "0.2.126" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" 616 | 617 | [[package]] 618 | name = "libloading" 619 | version = "0.7.3" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" 622 | dependencies = [ 623 | "cfg-if", 624 | "winapi", 625 | ] 626 | 627 | [[package]] 628 | name = "log" 629 | version = "0.4.17" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 632 | dependencies = [ 633 | "cfg-if", 634 | ] 635 | 636 | [[package]] 637 | name = "matches" 638 | version = "0.1.9" 639 | source = "registry+https://github.com/rust-lang/crates.io-index" 640 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 641 | 642 | [[package]] 643 | name = "memchr" 644 | version = "2.5.0" 645 | source = "registry+https://github.com/rust-lang/crates.io-index" 646 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 647 | 648 | [[package]] 649 | name = "memoffset" 650 | version = "0.6.5" 651 | source = "registry+https://github.com/rust-lang/crates.io-index" 652 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" 653 | dependencies = [ 654 | "autocfg", 655 | ] 656 | 657 | [[package]] 658 | name = "nix" 659 | version = "0.23.1" 660 | source = "registry+https://github.com/rust-lang/crates.io-index" 661 | checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" 662 | dependencies = [ 663 | "bitflags", 664 | "cc", 665 | "cfg-if", 666 | "libc", 667 | "memoffset", 668 | ] 669 | 670 | [[package]] 671 | name = "nom" 672 | version = "5.1.2" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" 675 | dependencies = [ 676 | "memchr", 677 | "version_check", 678 | ] 679 | 680 | [[package]] 681 | name = "ohttp" 682 | version = "0.1.0" 683 | source = "git+https://github.com/martinthomson/ohttp#5b031fd20e8376110c3ff0a446b0e9c4d78fe761" 684 | dependencies = [ 685 | "aead", 686 | "aes-gcm", 687 | "bindgen", 688 | "chacha20poly1305", 689 | "env_logger", 690 | "hex", 691 | "hkdf", 692 | "hpke", 693 | "lazy_static", 694 | "log", 695 | "rand", 696 | "serde", 697 | "serde_derive", 698 | "sha2", 699 | "toml", 700 | ] 701 | 702 | [[package]] 703 | name = "opaque-debug" 704 | version = "0.3.0" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 707 | 708 | [[package]] 709 | name = "peeking_take_while" 710 | version = "0.1.2" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" 713 | 714 | [[package]] 715 | name = "percent-encoding" 716 | version = "2.1.0" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 719 | 720 | [[package]] 721 | name = "pin-project-lite" 722 | version = "0.2.9" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 725 | 726 | [[package]] 727 | name = "pin-utils" 728 | version = "0.1.0" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 731 | 732 | [[package]] 733 | name = "poly1305" 734 | version = "0.7.2" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" 737 | dependencies = [ 738 | "cpufeatures 0.2.2", 739 | "opaque-debug", 740 | "universal-hash", 741 | ] 742 | 743 | [[package]] 744 | name = "polyval" 745 | version = "0.5.3" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" 748 | dependencies = [ 749 | "cfg-if", 750 | "cpufeatures 0.2.2", 751 | "opaque-debug", 752 | "universal-hash", 753 | ] 754 | 755 | [[package]] 756 | name = "ppv-lite86" 757 | version = "0.2.16" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 760 | 761 | [[package]] 762 | name = "proc-macro2" 763 | version = "1.0.43" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" 766 | dependencies = [ 767 | "unicode-ident", 768 | ] 769 | 770 | [[package]] 771 | name = "quote" 772 | version = "1.0.21" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 775 | dependencies = [ 776 | "proc-macro2", 777 | ] 778 | 779 | [[package]] 780 | name = "rand" 781 | version = "0.8.5" 782 | source = "registry+https://github.com/rust-lang/crates.io-index" 783 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 784 | dependencies = [ 785 | "libc", 786 | "rand_chacha", 787 | "rand_core 0.6.3", 788 | ] 789 | 790 | [[package]] 791 | name = "rand_chacha" 792 | version = "0.3.1" 793 | source = "registry+https://github.com/rust-lang/crates.io-index" 794 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 795 | dependencies = [ 796 | "ppv-lite86", 797 | "rand_core 0.6.3", 798 | ] 799 | 800 | [[package]] 801 | name = "rand_core" 802 | version = "0.5.1" 803 | source = "registry+https://github.com/rust-lang/crates.io-index" 804 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 805 | 806 | [[package]] 807 | name = "rand_core" 808 | version = "0.6.3" 809 | source = "registry+https://github.com/rust-lang/crates.io-index" 810 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 811 | dependencies = [ 812 | "getrandom", 813 | ] 814 | 815 | [[package]] 816 | name = "redox_syscall" 817 | version = "0.2.16" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 820 | dependencies = [ 821 | "bitflags", 822 | ] 823 | 824 | [[package]] 825 | name = "regex" 826 | version = "1.6.0" 827 | source = "registry+https://github.com/rust-lang/crates.io-index" 828 | checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" 829 | dependencies = [ 830 | "regex-syntax", 831 | ] 832 | 833 | [[package]] 834 | name = "regex-syntax" 835 | version = "0.6.27" 836 | source = "registry+https://github.com/rust-lang/crates.io-index" 837 | checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" 838 | 839 | [[package]] 840 | name = "remove_dir_all" 841 | version = "0.5.3" 842 | source = "registry+https://github.com/rust-lang/crates.io-index" 843 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 844 | dependencies = [ 845 | "winapi", 846 | ] 847 | 848 | [[package]] 849 | name = "rustc-hash" 850 | version = "1.1.0" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 853 | 854 | [[package]] 855 | name = "ryu" 856 | version = "1.0.11" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" 859 | 860 | [[package]] 861 | name = "same-file" 862 | version = "1.0.6" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 865 | dependencies = [ 866 | "winapi-util", 867 | ] 868 | 869 | [[package]] 870 | name = "serde" 871 | version = "1.0.141" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "7af873f2c95b99fcb0bd0fe622a43e29514658873c8ceba88c4cb88833a22500" 874 | dependencies = [ 875 | "serde_derive", 876 | ] 877 | 878 | [[package]] 879 | name = "serde_derive" 880 | version = "1.0.141" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "75743a150d003dd863b51dc809bcad0d73f2102c53632f1e954e738192a3413f" 883 | dependencies = [ 884 | "proc-macro2", 885 | "quote", 886 | "syn", 887 | ] 888 | 889 | [[package]] 890 | name = "serde_json" 891 | version = "1.0.82" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" 894 | dependencies = [ 895 | "itoa", 896 | "ryu", 897 | "serde", 898 | ] 899 | 900 | [[package]] 901 | name = "sha2" 902 | version = "0.9.9" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 905 | dependencies = [ 906 | "block-buffer", 907 | "cfg-if", 908 | "cpufeatures 0.2.2", 909 | "digest", 910 | "opaque-debug", 911 | ] 912 | 913 | [[package]] 914 | name = "shlex" 915 | version = "0.1.1" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" 918 | 919 | [[package]] 920 | name = "slab" 921 | version = "0.4.7" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" 924 | dependencies = [ 925 | "autocfg", 926 | ] 927 | 928 | [[package]] 929 | name = "strsim" 930 | version = "0.8.0" 931 | source = "registry+https://github.com/rust-lang/crates.io-index" 932 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 933 | 934 | [[package]] 935 | name = "subtle" 936 | version = "2.4.1" 937 | source = "registry+https://github.com/rust-lang/crates.io-index" 938 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 939 | 940 | [[package]] 941 | name = "syn" 942 | version = "1.0.99" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" 945 | dependencies = [ 946 | "proc-macro2", 947 | "quote", 948 | "unicode-ident", 949 | ] 950 | 951 | [[package]] 952 | name = "synstructure" 953 | version = "0.12.6" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" 956 | dependencies = [ 957 | "proc-macro2", 958 | "quote", 959 | "syn", 960 | "unicode-xid", 961 | ] 962 | 963 | [[package]] 964 | name = "tempfile" 965 | version = "3.3.0" 966 | source = "registry+https://github.com/rust-lang/crates.io-index" 967 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" 968 | dependencies = [ 969 | "cfg-if", 970 | "fastrand", 971 | "libc", 972 | "redox_syscall", 973 | "remove_dir_all", 974 | "winapi", 975 | ] 976 | 977 | [[package]] 978 | name = "textwrap" 979 | version = "0.11.0" 980 | source = "registry+https://github.com/rust-lang/crates.io-index" 981 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 982 | dependencies = [ 983 | "unicode-width", 984 | ] 985 | 986 | [[package]] 987 | name = "thiserror" 988 | version = "1.0.32" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" 991 | dependencies = [ 992 | "thiserror-impl", 993 | ] 994 | 995 | [[package]] 996 | name = "thiserror-impl" 997 | version = "1.0.32" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" 1000 | dependencies = [ 1001 | "proc-macro2", 1002 | "quote", 1003 | "syn", 1004 | ] 1005 | 1006 | [[package]] 1007 | name = "tinyvec" 1008 | version = "1.6.0" 1009 | source = "registry+https://github.com/rust-lang/crates.io-index" 1010 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1011 | dependencies = [ 1012 | "tinyvec_macros", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "tinyvec_macros" 1017 | version = "0.1.0" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1020 | 1021 | [[package]] 1022 | name = "toml" 1023 | version = "0.5.9" 1024 | source = "registry+https://github.com/rust-lang/crates.io-index" 1025 | checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" 1026 | dependencies = [ 1027 | "serde", 1028 | ] 1029 | 1030 | [[package]] 1031 | name = "typenum" 1032 | version = "1.15.0" 1033 | source = "registry+https://github.com/rust-lang/crates.io-index" 1034 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 1035 | 1036 | [[package]] 1037 | name = "unicode-bidi" 1038 | version = "0.3.8" 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" 1040 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 1041 | 1042 | [[package]] 1043 | name = "unicode-ident" 1044 | version = "1.0.2" 1045 | source = "registry+https://github.com/rust-lang/crates.io-index" 1046 | checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" 1047 | 1048 | [[package]] 1049 | name = "unicode-normalization" 1050 | version = "0.1.21" 1051 | source = "registry+https://github.com/rust-lang/crates.io-index" 1052 | checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" 1053 | dependencies = [ 1054 | "tinyvec", 1055 | ] 1056 | 1057 | [[package]] 1058 | name = "unicode-segmentation" 1059 | version = "1.9.0" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" 1062 | 1063 | [[package]] 1064 | name = "unicode-width" 1065 | version = "0.1.9" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 1068 | 1069 | [[package]] 1070 | name = "unicode-xid" 1071 | version = "0.2.3" 1072 | source = "registry+https://github.com/rust-lang/crates.io-index" 1073 | checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" 1074 | 1075 | [[package]] 1076 | name = "universal-hash" 1077 | version = "0.4.1" 1078 | source = "registry+https://github.com/rust-lang/crates.io-index" 1079 | checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" 1080 | dependencies = [ 1081 | "generic-array", 1082 | "subtle", 1083 | ] 1084 | 1085 | [[package]] 1086 | name = "url" 1087 | version = "2.2.2" 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" 1089 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 1090 | dependencies = [ 1091 | "form_urlencoded", 1092 | "idna", 1093 | "matches", 1094 | "percent-encoding", 1095 | ] 1096 | 1097 | [[package]] 1098 | name = "vec_map" 1099 | version = "0.8.2" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 1102 | 1103 | [[package]] 1104 | name = "version_check" 1105 | version = "0.9.4" 1106 | source = "registry+https://github.com/rust-lang/crates.io-index" 1107 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1108 | 1109 | [[package]] 1110 | name = "walkdir" 1111 | version = "2.3.2" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" 1114 | dependencies = [ 1115 | "same-file", 1116 | "winapi", 1117 | "winapi-util", 1118 | ] 1119 | 1120 | [[package]] 1121 | name = "wasi" 1122 | version = "0.11.0+wasi-snapshot-preview1" 1123 | source = "registry+https://github.com/rust-lang/crates.io-index" 1124 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1125 | 1126 | [[package]] 1127 | name = "winapi" 1128 | version = "0.3.9" 1129 | source = "registry+https://github.com/rust-lang/crates.io-index" 1130 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1131 | dependencies = [ 1132 | "winapi-i686-pc-windows-gnu", 1133 | "winapi-x86_64-pc-windows-gnu", 1134 | ] 1135 | 1136 | [[package]] 1137 | name = "winapi-i686-pc-windows-gnu" 1138 | version = "0.4.0" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1141 | 1142 | [[package]] 1143 | name = "winapi-util" 1144 | version = "0.1.5" 1145 | source = "registry+https://github.com/rust-lang/crates.io-index" 1146 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1147 | dependencies = [ 1148 | "winapi", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "winapi-x86_64-pc-windows-gnu" 1153 | version = "0.4.0" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1156 | 1157 | [[package]] 1158 | name = "x25519-dalek" 1159 | version = "1.1.1" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" 1162 | dependencies = [ 1163 | "curve25519-dalek", 1164 | "rand_core 0.5.1", 1165 | "zeroize", 1166 | ] 1167 | 1168 | [[package]] 1169 | name = "zeroize" 1170 | version = "1.5.7" 1171 | source = "registry+https://github.com/rust-lang/crates.io-index" 1172 | checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" 1173 | dependencies = [ 1174 | "zeroize_derive", 1175 | ] 1176 | 1177 | [[package]] 1178 | name = "zeroize_derive" 1179 | version = "1.3.2" 1180 | source = "registry+https://github.com/rust-lang/crates.io-index" 1181 | checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" 1182 | dependencies = [ 1183 | "proc-macro2", 1184 | "quote", 1185 | "syn", 1186 | "synstructure", 1187 | ] 1188 | -------------------------------------------------------------------------------- /apprelay/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "apprelay" 3 | version = "0.1.0" 4 | authors = ["Chris Wood "] 5 | edition = "2021" 6 | 7 | [dependencies] 8 | bytes = "1.2.0" 9 | ohttp = { git = "https://github.com/martinthomson/ohttp", features = ["pq", "rust-hpke", "client"], default-features = false } 10 | libc = "0.2" 11 | 12 | thiserror = "1.0.32" 13 | log = "0.4.17" 14 | 15 | env_logger = "0.9.0" 16 | 17 | [dependencies.jni] 18 | version = "0.19.0" 19 | optional = true 20 | 21 | [features] 22 | default = ["java"] 23 | 24 | java = ["jni"] 25 | 26 | 27 | [build-dependencies] 28 | cbindgen = "0.17" 29 | 30 | [lib] 31 | crate-type = ["staticlib", "cdylib"] 32 | -------------------------------------------------------------------------------- /apprelay/apprelay.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | typedef struct RequestContext RequestContext; 8 | 9 | typedef struct ResponseContext ResponseContext; 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif // __cplusplus 14 | 15 | // Return a pointer to encapsulated request 16 | // 17 | // # Safety 18 | // Dereferences a pointer to `RequestContext` passed by the caller. 19 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 20 | // 21 | // 22 | uint8_t *request_context_message_ffi(struct RequestContext *context); 23 | 24 | // Return the size in bytes of the encapsulated request. 25 | // 26 | // # Safety 27 | // Dereferences a pointer to `RequestContext` passed by the caller. 28 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 29 | // 30 | // 31 | size_t request_context_message_len_ffi(struct RequestContext *context); 32 | 33 | // Frees up context memory. Be sure to call this in cases: 34 | // - after encapsulating the HTTP request was not performed 35 | // - the response has not been returned or is not successful 36 | // 37 | // # Safety 38 | // Dereferences a pointer to `RequestContext` passed by the caller. 39 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 40 | // 41 | // 42 | void request_context_message_drop_ffi(struct RequestContext *context); 43 | 44 | // Return a pointer to the decapsulated response. 45 | // 46 | // # Safety 47 | // Dereferences a pointer to `RequestContext` passed by the caller. 48 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 49 | // 50 | // 51 | uint8_t *response_context_message_ffi(struct ResponseContext *context); 52 | 53 | // Return size in bytes of the decapsulated response. 54 | // 55 | // # Safety 56 | // Dereferences a pointer to `RequestContext` passed by the caller. 57 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 58 | // 59 | // 60 | size_t response_context_message_len_ffi(struct ResponseContext *context); 61 | 62 | // Encapsulates the provided `encoded_msg` using `encoded_config_list` and returns 63 | // a context used for decapsulating the corresponding response. 64 | // 65 | // This function will return a NULL pointer if: 66 | // - creating the request context fails due to input errors. 67 | // - encapsulation fails. 68 | // 69 | // # Safety 70 | // Dereferences a pointer to `RequestContext` passed by the caller. 71 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 72 | // 73 | // 74 | struct RequestContext *encapsulate_request_ffi(const uint8_t *encoded_config_list_ptr, 75 | size_t encoded_config_list_len, 76 | const uint8_t *encoded_msg_ptr, 77 | size_t encoded_msg_len); 78 | 79 | // Decapsulates the provided `encapsulated_response` using `context`. 80 | // 81 | // This function will return a NULL pointer if decapsulation fails. 82 | // 83 | // # Safety 84 | // Dereferences a pointer to `RequestContext` passed by the caller. 85 | // Be sure that the context has not been yet freed and that you are using a valid pointer. 86 | // 87 | // 88 | struct ResponseContext *decapsulate_response_ffi(struct RequestContext *context, 89 | const uint8_t *encapsulated_response_ptr, 90 | size_t encapsulated_response_len); 91 | 92 | void initialize_logging(void); 93 | 94 | // Return the number of bytes in the last error message. 95 | // Does not include any trailing null terminators. 96 | int last_error_length(void); 97 | 98 | // Write the most recent error UTF-8 encoded message into a provided buffer 99 | // 100 | // If there are no recent errors then this returns 0. -1 is returned if there is an error but something bad happened: 101 | // - provided `buffer` is too small 102 | // - or a provided `buffer` is a null pointer 103 | // 104 | // Otherwise the function returns the number of bytes written to the buffer. 105 | // 106 | // # Safety 107 | // The invariants are described here [`from_raw_parts_mut`](std::slice::from_raw_parts_mut#safety) 108 | int last_error_message(char *buffer, 109 | int length); 110 | 111 | #ifdef __cplusplus 112 | } // extern "C" 113 | #endif // __cplusplus 114 | -------------------------------------------------------------------------------- /apprelay/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Cloudflare, Inc. All rights reserved. 2 | // SPDX-License-Identifier: BSD-3-Clause 3 | 4 | use cbindgen::Config; 5 | use std::env; 6 | 7 | fn main() { 8 | // cbindgen crashes on stable release due to macro expansion 9 | let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); 10 | 11 | let config = Config { 12 | language: cbindgen::Language::C, 13 | documentation_style: cbindgen::DocumentationStyle::C99, 14 | cpp_compat: true, 15 | usize_is_size_t: true, 16 | parse: cbindgen::ParseConfig { 17 | parse_deps: false, 18 | include: Some(vec!["apprelay".to_owned()]), 19 | ..Default::default() 20 | }, 21 | ..Default::default() 22 | }; 23 | 24 | cbindgen::generate_with_config(&crate_dir, config) 25 | .expect("Could not generate header") 26 | .write_to_file("apprelay.h"); 27 | } 28 | -------------------------------------------------------------------------------- /apprelay/src/android.rs: -------------------------------------------------------------------------------- 1 | use std::ptr::null_mut; 2 | 3 | use jni::JNIEnv; 4 | 5 | use jni::objects::JClass; 6 | 7 | use jni::sys::{jbyteArray, jlong, jstring}; 8 | 9 | use crate::error_ffi::update_last_error; 10 | use crate::{null_safe_ptr, safe_unwrap, ClientError, RequestContext}; 11 | 12 | /// Return most recent error as a Java `String`. 13 | /// 14 | /// If the are no recent errors than this returns a NULL pointer. 15 | #[no_mangle] 16 | pub extern "system" fn Java_org_platform_OHttpNativeWrapper_lastErrorMessage( 17 | env: JNIEnv, 18 | _class: JClass, 19 | ) -> jstring { 20 | let err = crate::error_ffi::take_last_error(); 21 | match err.map(|e| env.new_string(e.to_string())) { 22 | Some(Ok(jstr)) => jstr.into_inner(), 23 | _ => std::ptr::null_mut() as _, 24 | } 25 | } 26 | 27 | /// Initialize logging 28 | #[no_mangle] 29 | pub extern "system" fn Java_org_platform_OHttpNativeWrapper_init(_env: JNIEnv, _class: JClass) { 30 | crate::error_ffi::initialize_logging(); 31 | } 32 | 33 | /// Encapsulates a request using the provided configuration. 34 | /// 35 | /// Returns a pointer to encapsulation context, and returns -1 upon failure. 36 | #[no_mangle] 37 | pub extern "system" fn Java_org_platform_OHttpNativeWrapper_encapsulateRequest( 38 | env: JNIEnv, 39 | _class: JClass, 40 | config: jbyteArray, 41 | msg: jbyteArray, 42 | ) -> jlong { 43 | // check for null references passed 44 | null_safe_ptr!(config, -1, ()); 45 | null_safe_ptr!(msg, -1, ()); 46 | 47 | // First, we have to get the byte[] out of java. 48 | let config = crate::safe_unwrap!(env.convert_byte_array(config), -1, ClientError::JniProblem); 49 | let msg = crate::safe_unwrap!(env.convert_byte_array(msg), -1, ClientError::JniProblem); 50 | 51 | unsafe { 52 | let encapsulated = 53 | crate::encapsulate_request_ffi(config.as_ptr(), config.len(), msg.as_ptr(), msg.len()); 54 | if encapsulated.is_null() { 55 | -1 56 | } else { 57 | encapsulated as jlong 58 | } 59 | } 60 | } 61 | 62 | /// Accesses the encapsulation result for given context. 63 | /// 64 | /// Returns an array containing an encapsulation request, 65 | /// or -1 upon failure. 66 | /// 67 | /// # Safety 68 | /// Dereferences a pointer to `RequestContext` passed by the caller. 69 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 70 | /// 71 | /// 72 | #[no_mangle] 73 | pub unsafe extern "system" fn Java_org_platform_OHttpNativeWrapper_getEncapsulatedRequest( 74 | env: JNIEnv, 75 | _class: JClass, 76 | context_ptr: jlong, 77 | ) -> jbyteArray { 78 | let context = &mut *(context_ptr as *mut RequestContext); 79 | safe_unwrap!( 80 | env.byte_array_from_slice(&context.encapsulated_request[..]), 81 | null_mut(), 82 | ClientError::JniProblem 83 | ) 84 | } 85 | 86 | /// Frees up context memory. Be sure to call this in cases: 87 | /// - after encapsulating the HTTP request was not performed 88 | /// - the response has not been returned or is not successful 89 | /// 90 | /// # Safety 91 | /// Dereferences a pointer to `RequestContext` passed by the caller. 92 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 93 | /// 94 | /// 95 | #[no_mangle] 96 | pub unsafe extern "system" fn Java_org_platform_OHttpNativeWrapper_drop( 97 | _env: JNIEnv, 98 | _class: JClass, 99 | context_ptr: jlong, 100 | ) { 101 | let _context = Box::from_raw(context_ptr as *mut RequestContext); 102 | } 103 | 104 | /// Decapsulates the provided response `encapsulated_response` using 105 | /// requests config obtain by dereferencing `context_ptr` 106 | /// 107 | /// Returns an array containing the decapsulated response. 108 | /// 109 | /// If this function fails due JNI problems or decapsulation it returns a NULL pointer. 110 | /// 111 | /// # Safety 112 | /// Dereferences a pointer to `RequestContext` passed by the caller. 113 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 114 | /// 115 | /// 116 | #[no_mangle] 117 | pub unsafe extern "system" fn Java_org_platform_OHttpNativeWrapper_decapsulateResponse( 118 | env: JNIEnv, 119 | _class: JClass, 120 | context_ptr: jlong, 121 | encapsulated_response: jbyteArray, 122 | ) -> jbyteArray { 123 | let context = Box::from_raw(context_ptr as *mut RequestContext); 124 | let encapsulated_response = crate::safe_unwrap!( 125 | env.convert_byte_array(encapsulated_response), 126 | null_mut(), 127 | ClientError::JniProblem 128 | ); 129 | let response = safe_unwrap!( 130 | context.response_context.decapsulate(&encapsulated_response), 131 | null_mut(), 132 | ClientError::DecapsulationFailed 133 | ); 134 | safe_unwrap!( 135 | env.byte_array_from_slice(&response[..]), 136 | null_mut(), 137 | ClientError::JniProblem 138 | ) 139 | } 140 | -------------------------------------------------------------------------------- /apprelay/src/error_ffi.rs: -------------------------------------------------------------------------------- 1 | use std::{cell::RefCell, error::Error, slice}; 2 | 3 | use libc::{c_char, c_int}; 4 | use log::{debug, error}; 5 | 6 | use env_logger::{Builder, Target}; 7 | 8 | thread_local! { 9 | static LAST_ERROR: RefCell>> = RefCell::new(None); 10 | } 11 | 12 | #[no_mangle] 13 | pub extern "C" fn initialize_logging() { 14 | let mut builder = Builder::from_default_env(); 15 | builder.target(Target::Stdout); 16 | 17 | builder.init(); 18 | debug!("Logger initialized"); 19 | } 20 | 21 | /// Update the last error, clearing the old one. 22 | pub fn update_last_error(err: E) { 23 | error!("Setting last error {err}"); 24 | { 25 | let mut cause = err.source(); 26 | while let Some(parent_err) = cause { 27 | error!("Caused by: {parent_err}"); 28 | cause = parent_err.source(); 29 | } 30 | } 31 | LAST_ERROR.with(|prev| { 32 | *prev.borrow_mut() = Some(Box::new(err)); 33 | }); 34 | } 35 | 36 | /// Retrieve the most recent error, clearing it in the process. 37 | pub fn take_last_error() -> Option> { 38 | LAST_ERROR.with(|prev| prev.borrow_mut().take()) 39 | } 40 | 41 | /// Return the number of bytes in the last error message. 42 | /// Does not include any trailing null terminators. 43 | #[no_mangle] 44 | pub extern "C" fn last_error_length() -> libc::c_int { 45 | LAST_ERROR.with(|prev| match *prev.borrow() { 46 | Some(ref err) => err.to_string().len() as libc::c_int, 47 | None => 0, 48 | }) 49 | } 50 | 51 | /// Write the most recent error UTF-8 encoded message into a provided buffer 52 | /// 53 | /// If there are no recent errors then this returns 0. -1 is returned if there is an error but something bad happened: 54 | /// - provided `buffer` is too small 55 | /// - or a provided `buffer` is a null pointer 56 | /// 57 | /// Otherwise the function returns the number of bytes written to the buffer. 58 | /// 59 | /// # Safety 60 | /// The invariants are described here [`from_raw_parts_mut`](std::slice::from_raw_parts_mut#safety) 61 | #[no_mangle] 62 | pub unsafe extern "C" fn last_error_message(buffer: *mut c_char, length: c_int) -> c_int { 63 | if buffer.is_null() { 64 | error!("Null pointer passed into last_error_message() as the buffer"); 65 | return -1; 66 | } 67 | 68 | let last_error = match take_last_error() { 69 | Some(err) => err, 70 | None => return 0, 71 | }; 72 | 73 | let error_message = last_error.to_string(); 74 | 75 | let buffer = slice::from_raw_parts_mut(buffer as *mut u8, length as usize); 76 | 77 | if error_message.len() >= buffer.len() { 78 | error!("Buffer providded for writing last message is to small!"); 79 | error!( 80 | "Expected at least {} bytes but got {}", 81 | error_message.len() + 1, 82 | buffer.len() 83 | ); 84 | return -1; 85 | } 86 | 87 | std::ptr::copy_nonoverlapping( 88 | error_message.as_ptr(), 89 | buffer.as_mut_ptr(), 90 | error_message.len(), 91 | ); 92 | 93 | // Add a trailling null terminator 94 | buffer[error_message.len()] = 0; 95 | error_message.len() as c_int 96 | } 97 | -------------------------------------------------------------------------------- /apprelay/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Cloudflare, Inc. All rights reserved. 2 | // SPDX-License-Identifier: BSD-3-Clause 3 | 4 | #![allow(clippy::unused_unit)] 5 | 6 | use error_ffi::update_last_error; 7 | use ohttp::{ClientRequest, ClientResponse}; 8 | use std::any::Any; 9 | use std::ptr::null_mut; 10 | use std::{ptr, slice}; 11 | 12 | use std::panic::catch_unwind; 13 | 14 | use thiserror::Error; 15 | 16 | #[derive(Error, Debug)] 17 | pub enum ClientError { 18 | #[error("Failed to create request context")] 19 | RequestContextInitialization(#[source] ohttp::Error), 20 | #[error("Failed to encapsulate request")] 21 | EncapsulationFailed(#[source] ohttp::Error), 22 | #[error("Failed to decapsulate request")] 23 | DecapsulationFailed(#[source] ohttp::Error), 24 | 25 | #[error("Invalid argument `{0}` passed")] 26 | InvalidArgument(String), 27 | 28 | #[error("Panic unwinded at {0:?}")] 29 | SafePanic(Box), 30 | 31 | #[cfg(feature = "java")] 32 | #[error("Unexpected JNI issue")] 33 | JniProblem(#[source] jni::errors::Error), 34 | } 35 | 36 | #[cfg(feature = "java")] 37 | pub mod android; 38 | 39 | pub mod error_ffi; 40 | 41 | pub struct RequestContext { 42 | encapsulated_request: Vec, 43 | response_context: ClientResponse, 44 | } 45 | 46 | #[macro_export] 47 | macro_rules! null_safe_ptr { 48 | ($ptr:ident, $null_expr:expr, $deref:expr) => { 49 | if $ptr.is_null() { 50 | update_last_error(ClientError::InvalidArgument(format!( 51 | "Passed null pointer argument {}", 52 | stringify!(ident) 53 | ))); 54 | return $null_expr; 55 | } else { 56 | $deref 57 | } 58 | }; 59 | } 60 | 61 | macro_rules! catch_panics { 62 | ($possibly_panic:expr, $error_ret:expr) => { 63 | match catch_unwind(|| $possibly_panic) { 64 | Ok(ctx) => ctx, 65 | Err(err) => { 66 | let err = ClientError::SafePanic(err); 67 | update_last_error(err); 68 | $error_ret 69 | } 70 | } 71 | }; 72 | } 73 | 74 | #[macro_export] 75 | macro_rules! safe_unwrap { 76 | ($possibly_err:expr, $error_ret:expr, $err_context:expr) => { 77 | match $possibly_err { 78 | Ok(ret) => ret, 79 | Err(err) => { 80 | let err = $err_context(err); 81 | update_last_error(err); 82 | return $error_ret; 83 | } 84 | } 85 | }; 86 | } 87 | 88 | /// Return a pointer to encapsulated request 89 | /// 90 | /// # Safety 91 | /// Dereferences a pointer to `RequestContext` passed by the caller. 92 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 93 | /// 94 | /// 95 | #[no_mangle] 96 | pub unsafe extern "C" fn request_context_message_ffi(context: *mut RequestContext) -> *mut u8 { 97 | null_safe_ptr!( 98 | context, 99 | ptr::null_mut(), 100 | (*(*Box::into_raw(Box::new(context)))) 101 | .encapsulated_request 102 | .as_mut_ptr() as *mut u8 103 | ) 104 | } 105 | 106 | /// Return the size in bytes of the encapsulated request. 107 | /// 108 | /// # Safety 109 | /// Dereferences a pointer to `RequestContext` passed by the caller. 110 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 111 | /// 112 | /// 113 | #[no_mangle] 114 | pub unsafe extern "C" fn request_context_message_len_ffi( 115 | context: *mut RequestContext, 116 | ) -> libc::size_t { 117 | null_safe_ptr!( 118 | context, 119 | 0, 120 | (*(*Box::into_raw(Box::new(context)))) 121 | .encapsulated_request 122 | .len() 123 | ) 124 | } 125 | 126 | /// Frees up context memory. Be sure to call this in cases: 127 | /// - after encapsulating the HTTP request was not performed 128 | /// - the response has not been returned or is not successful 129 | /// 130 | /// # Safety 131 | /// Dereferences a pointer to `RequestContext` passed by the caller. 132 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 133 | /// 134 | /// 135 | #[no_mangle] 136 | pub unsafe extern "C" fn request_context_message_drop_ffi(context: *mut RequestContext) { 137 | null_safe_ptr!(context, (), { 138 | let _context = Box::from_raw(context); 139 | }) 140 | } 141 | 142 | pub struct ResponseContext { 143 | response: Vec, 144 | } 145 | 146 | /// Return a pointer to the decapsulated response. 147 | /// 148 | /// # Safety 149 | /// Dereferences a pointer to `RequestContext` passed by the caller. 150 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 151 | /// 152 | /// 153 | #[no_mangle] 154 | pub unsafe extern "C" fn response_context_message_ffi(context: *mut ResponseContext) -> *mut u8 { 155 | null_safe_ptr!( 156 | context, 157 | ptr::null_mut(), 158 | (*(*Box::into_raw(Box::new(context)))).response.as_mut_ptr() as *mut u8 159 | ) 160 | } 161 | 162 | /// Return size in bytes of the decapsulated response. 163 | /// 164 | /// # Safety 165 | /// Dereferences a pointer to `RequestContext` passed by the caller. 166 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 167 | /// 168 | /// 169 | #[no_mangle] 170 | pub unsafe extern "C" fn response_context_message_len_ffi( 171 | context: *mut ResponseContext, 172 | ) -> libc::size_t { 173 | null_safe_ptr!( 174 | context, 175 | 0, 176 | (*(*Box::into_raw(Box::new(context)))).response.len() 177 | ) 178 | } 179 | 180 | /// Encapsulates the provided `encoded_msg` using `encoded_config_list` and returns 181 | /// a context used for decapsulating the corresponding response. 182 | /// 183 | /// This function will return a NULL pointer if: 184 | /// - creating the request context fails due to input errors. 185 | /// - encapsulation fails. 186 | /// 187 | /// # Safety 188 | /// Dereferences a pointer to `RequestContext` passed by the caller. 189 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 190 | /// 191 | /// 192 | #[no_mangle] 193 | pub unsafe extern "C" fn encapsulate_request_ffi( 194 | encoded_config_list_ptr: *const u8, 195 | encoded_config_list_len: libc::size_t, 196 | encoded_msg_ptr: *const u8, 197 | encoded_msg_len: libc::size_t, 198 | ) -> *mut RequestContext { 199 | let encoded_config_list_ptr = 200 | null_safe_ptr!(encoded_config_list_ptr, ptr::null_mut(), encoded_config_list_ptr); 201 | let encoded_msg_ptr = null_safe_ptr!(encoded_msg_ptr, ptr::null_mut(), encoded_msg_ptr); 202 | 203 | let encoded_config_list: &[u8] = 204 | slice::from_raw_parts_mut(encoded_config_list_ptr as *mut u8, encoded_config_list_len as usize); 205 | let encoded_msg: &[u8] = 206 | slice::from_raw_parts_mut(encoded_msg_ptr as *mut u8, encoded_msg_len as usize); 207 | 208 | catch_panics!( 209 | { 210 | let client = safe_unwrap!( 211 | { ClientRequest::from_encoded_config_list(encoded_config_list) }, 212 | ptr::null_mut(), 213 | ClientError::RequestContextInitialization 214 | ); 215 | 216 | let (enc_request, client_response) = safe_unwrap!( 217 | client.encapsulate(encoded_msg), 218 | ptr::null_mut(), 219 | ClientError::EncapsulationFailed 220 | ); 221 | 222 | let ctx = Box::new(RequestContext { 223 | encapsulated_request: enc_request, 224 | response_context: client_response, 225 | }); 226 | Box::into_raw(ctx) 227 | }, 228 | ptr::null_mut() 229 | ) 230 | } 231 | 232 | /// Decapsulates the provided `encapsulated_response` using `context`. 233 | /// 234 | /// This function will return a NULL pointer if decapsulation fails. 235 | /// 236 | /// # Safety 237 | /// Dereferences a pointer to `RequestContext` passed by the caller. 238 | /// Be sure that the context has not been yet freed and that you are using a valid pointer. 239 | /// 240 | /// 241 | #[no_mangle] 242 | pub unsafe extern "C" fn decapsulate_response_ffi( 243 | context: *mut RequestContext, 244 | encapsulated_response_ptr: *const u8, 245 | encapsulated_response_len: libc::size_t, 246 | ) -> *mut ResponseContext { 247 | let context = null_safe_ptr!( 248 | context, 249 | null_mut(), 250 | Box::from_raw(context) 251 | ); 252 | 253 | let encapsulated_response_ptr = null_safe_ptr!( 254 | encapsulated_response_ptr, 255 | ptr::null_mut(), 256 | encapsulated_response_ptr 257 | ); 258 | 259 | let encapsulated_response: &[u8] = slice::from_raw_parts_mut( 260 | encapsulated_response_ptr as *mut u8, 261 | encapsulated_response_len as usize, 262 | ); 263 | 264 | catch_panics!( 265 | { 266 | let response = safe_unwrap!( 267 | context.response_context.decapsulate(encapsulated_response), 268 | ptr::null_mut(), 269 | ClientError::DecapsulationFailed 270 | ); 271 | Box::into_raw(Box::new(ResponseContext { response })) 272 | }, 273 | ptr::null_mut() 274 | ) 275 | } 276 | --------------------------------------------------------------------------------