0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 03:52:17 +02:00
Commit Graph

313 Commits

Author SHA1 Message Date
Harry
72aae8c00f
Remove SignalCoreKit dependency in libsignal 2024-06-26 09:44:22 -07:00
Alex Konradi
5b4570625b
Split types out of libsignal-bridge crate
Separate `libsignal-bridge` into two crates:
- `libsignal-bridge-types`, which contains types and methods for bridging,
  declares conversion traits, and implements those traits
- `libsignal-bridge`, which defines `extern "C"` functions that get exported
  into the app-language libraries

This will allow creating a second test-only crate, parallel to
`libsignal-bridge`, that can use the same types and macros for exporting
functions.
2024-06-21 16:39:14 -04:00
Jordan Rose
86c07ee86a bridge: Remove SignalFfiError enum
Now there's a trait, FfiError, which handles conversion to a string
and numeric code, and a helper struct SignalFfiError that mostly just
wraps `Box<dyn FfiError>`. This makes it easier to add new errors --
they only need to be added in two places (a trait impl and possibly
new error codes) instead of three.
2024-06-13 16:00:00 -07:00
Jordan Rose
4e2a7de574 Expose the 'Stopped' event to Swift and Node
Swift: ChatListener.chatServiceConnectionWasInterrupted(_:)
Node: ChatServiceListener.onConnectionInterrupted()
2024-06-13 15:54:21 -07:00
Jordan Rose
e3a1eb522a swift: Split ChatListener out to its own file
And add some more doc comments.
2024-06-13 15:54:21 -07:00
Jordan Rose
af4821846e Add a --debug-level-logs option to build_ffi.sh
This allows enabling debug- and trace-level logs even in a release
build. (This also means the job of filtering *out* those logs has been
moved up to build_ffi.sh, where previously it was specified in the
leaf crate's Cargo.toml.)
2024-06-13 12:08:31 -07:00
moiseev-signal
38a5f01f6f
net: Short circuit MultiRouteConnectionManager on fatal errors 2024-06-06 18:06:59 -07:00
Jordan Rose
8313a2cfbd Remove app-layer tests that rely on connection timeouts
This was previously done for Node in 62f347e866, while the Java and
Swift tests *did* pass but...very...slowly. Make them all consistent.
2024-05-30 13:28:07 -07:00
Jordan Rose
6bbe62b157 swift: Use non-fallible String->Data conversion, per swiftlint 2024-05-30 12:31:26 -07:00
Alex Konradi
31d6015522
backups: add shared message backup test cases 2024-05-24 15:59:44 -04:00
Jordan Rose
9a8429da46 net: Add AppExpired and DeviceDeregistered errors for ChatService
And check bridging for every high-level ChatServiceError like we do
with CdsiLookupErrors.
2024-05-23 10:27:28 -07:00
Jordan Rose
422b6098ed swift: Fix format string used for logging in tests 2024-05-22 13:10:39 -07:00
Jordan Rose
de252fd84d swift: Remove reference to deleted Logging.m 2024-05-22 13:10:39 -07:00
Jordan Rose
0cea81bb66 swift: ChatService.didReceiveIncomingMessage's sendAck is @escaping
...since acks of incoming messages are asynchronous (they don't happen
until the message is either fully processed or saved durably).
2024-05-22 13:10:39 -07:00
Jordan Rose
878d3d4332 bridge: Move Chat-related items into a submodule 2024-05-21 16:28:22 -07:00
Jordan Rose
a5fa231a1c bridge: Expose ChatService_InjectRawServerRequest for testing 2024-05-21 13:04:18 -07:00
Jordan Rose
a513d61a09 bridge: Expose ChatListener to Swift
(and lay groundwork for the other bridges)
2024-05-21 13:04:18 -07:00
moiseev-signal
70ba17491c
SVR3: Implement remove API 2024-05-21 10:33:33 -07:00
moiseev-signal
c55aa17a9f
SVR3: Propagate tries_remaining on restore failure 2024-05-20 15:49:59 -07:00
Jordan Rose
e1aa542bd5 ffi: Expose LibsignalLogger protocol rather than depending on DDLog
This drops the SignalCoreKit dependency for the CocoaPod, but does
mean clients will have to register their own logger explicitly.
2024-05-20 13:43:39 -07:00
moiseev-signal
bc5875b225
SVR3: Propagate tries_remaining upon successful restore 2024-05-20 08:54:46 -07:00
Jordan Rose
7dc63b99af ffi: Expose cancellation to Swift 2024-05-17 11:30:24 -07:00
Jordan Rose
6d3c192208 ffi: Wrap promise callbacks and contexts in a struct
...and pass that struct by reference.

This has some benefits and some drawbacks:

+ Type inference is (usually) more reliable; invokeAsyncFunction no
  longer needs a "returning:" parameter for disambiguation.

+ We can add more fields to the promise structs as needed.

+ We can use the same argument for input and output.

- Before, every promise that produced an OpaquePointer could share one
  protocol implementation on the Swift side. Now, they're separate.

- The manual type erasure code in the implementation of Completer has
  gotten worse.

- Using the same argument for input and output may be confusing.
2024-05-17 11:30:24 -07:00
Jordan Rose
99e337f552 bridge: Expose authenticated sends on ChatService 2024-05-15 15:48:47 -07:00
Jordan Rose
23894b2904 build_ffi.sh: Only set OPENSSL_SMALL when compiling for iOS
This interferes with ring, but on iOS we don't need ring, so we can
get away without setting it.
2024-05-15 11:14:34 -07:00
Jordan Rose
a2c271a8a0 build_ffi: Update error message for a missing cbindgen
- We moved passed cbindgen 0.16 a long time ago, oops
- It's always more reliable to build helper tools with stable
2024-05-14 16:54:09 -07:00
Jordan Rose
a09eb567f0 net: "Poison" the TCP connector if an invalid proxy is set
This ensures that if there's an error setting a proxy, the previous
settings won't continue to be used for new connections.

This only applies to the Java, Swift, and TypeScript layers; the Rust
layer's set_proxy isn't a fallible API in the first place today. The
Java API now explicitly throws a checked IOException instead of
IllegalArgumentException.
2024-05-08 16:18:03 -07:00
Jordan Rose
2b0e1e5538
bridge: Add cancellation to AsyncRuntime and TokioAsyncContext 2024-05-03 10:03:59 -07:00
Sergey Skrobotov
ab733bf00a libsignal-net: support for User-Agent header 2024-05-01 20:02:08 -07:00
Jordan Rose
cc12c6f3c8 Make ServiceId Ord/Comparable
ACIs are sorted before PNIs, then the UUIDs are sorted by their
(unsigned) bytes. This provides a total order, if a relatively
arbitrary one.
2024-05-01 10:34:21 -07:00
Alex Konradi
1fe47ce209
swift: let message backup stream factory fn throw (#713) 2024-04-30 15:24:23 -04:00
Jordan Rose
4854611b30 swift: Add an integration test for connecting via proxy
...along with a baseline test for connecting directly. This is only
enabled when LIBSIGNAL_TESTING_SIGNAL_PROXY is set in the environment.
2024-04-24 13:14:05 -07:00
Jordan Rose
01a8c350e8 swift: Use thin LTO even in debug builds
Some ring symbols aren't making it into libsignal_ffi.a otherwise. Not
totally sure why, but this makes the debug build more like the release
build anyway. It does slow down the build a bit, though, sorry.
2024-04-24 13:14:05 -07:00
Jordan Rose
23c0c6c200 swift: C functions with no arguments are declared '(void)', not '()'
C23 will make '()' allowed too, but until then...
2024-04-22 17:28:43 -07:00
Jordan Rose
9f53f3d1e7 BackupAuthCredential: verify the redemption time on receive
This is passed both within the credential response and outside it, so
it's important to make sure the two times match.
2024-04-19 13:41:59 -07:00
ravi-signal
9204831745
Use an enum for BackupAuthCredential's level 2024-04-19 11:46:49 -07:00
Jordan Rose
3d2471cc8b Make LIBSIGNAL_TESTING_ env vars available to Android and iOS tests
And adjust the existing ENCLAVE_SECRET tests and examples to use this
(including Rust and Node's).

This also requires adding an AndroidManifest.xml that notes the tests
might use the network.
2024-04-17 16:06:46 -07:00
Jordan Rose
bbeb0bb85e swift: Remove redundant explicit local variable type, per swiftformat 2024-04-16 15:22:51 -07:00
Sergey Skrobotov
3864f33b4d libsignal-net: dropping DebugInfo.connectionReused field 2024-04-16 10:20:00 -07:00
Alex Konradi
6114bb7962
Use the first bytes of a backup as the AES IV
Treat the first 16 bytes of the stream as the IV for the AES block cipher. This 
is incompatible with the previous scheme, where the IV was derived from the 
master key.
2024-04-15 16:37:46 -04:00
Alex Konradi
f72f33d3ee
Remove code that handles auth cred with ACI as PNI
These functions are unused in client and server code.
2024-04-11 17:08:18 -04:00
Jordan Rose
6b7c072fe2 swift: Fix PreKeyBundle accessors
getPreKeyId was returning an incorrect value, and the Kyber fields
were missing altogether. None of this affected security of the iOS app
because the iOS app only constructed PreKeyBundles for libsignal to
process, and never read any of these fields. If it did, it would have
failed to establish a session due to the incorrect pre-key ID.

Caught by @dtimoshenko99; thank you!
2024-04-09 16:04:59 -07:00
Alex Konradi
06c1780a14
Hold server zkparams as pointers 2024-04-09 16:13:22 -04:00
Jordan Rose
53ba4c28c4 Swift: Add missing error cases
And set up a script to catch them in the future.
2024-04-04 12:57:26 -07:00
Alex Konradi
79bab1ce78
Expose TLS proxy in app libraries
Co-authored-by: Sergey Skrobotov <sergey@signal.org>
2024-04-02 16:22:18 -04:00
Jordan Rose
96fce497db
Bridge unauthenticated connection to Swift
- Remove From<http::header::ToStrError> for ChatServiceError
- bridge: Response -> ChatResponse, DebugInfo -> ChatServiceDebugInfo
2024-04-01 09:24:46 -07:00
Alex Konradi
10a6d8b744
Remove enclave operation timeout arguments
The enclave interactions have internal progress monitoring in the form of 
websocket PING/PONG frames, so the timeout parameters aren't necessary for 
broken connection detection.
2024-03-29 18:13:40 -04:00
Alex Konradi
94432e2e32
Handle all CDSI server error codes
Match against all the error codes the documentation says the server can 
produce. Map these to error types in the app languages.
2024-03-26 16:41:12 -04:00
Alex Konradi
08513b208c
Determine ResultType from bridged fn signature
Examine the Rust signature to determine what the FFI output type should be. 
This lets us remove all usages of #[bridge_fn_void] since #[bridge_fn] now 
correctly detects the return type.
2024-03-26 15:56:53 -04:00
Alex Konradi
e87a1cba14
Handle "invalid token" response to CDSI request 2024-03-25 14:13:14 -04:00