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

277 Commits

Author SHA1 Message Date
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
Alex Konradi
ed19489470
Improve CDSI errors
Add bridging tests for all the CDSI error types, and diversify the types of 
exceptions that can be thrown from Java code.
2024-03-25 13:39:06 -04:00
Alex Konradi
26ebd007ab
Split up NetError type
Split up the NetError type into errors for specific services (CDSI, SVR3, 
Chat). Return these from their respective bridged functions.
2024-03-20 15:54:59 -04:00
Jordan Rose
5a05c936a7 GroupSendEndorsementsResponse: Weaken performance claims in docs
Right now the benefits of receiving GroupSendEndorsementsResponse
using member ciphertexts are balanced by the increased cost of
deserializing the full ciphertexts instead of just the part we need.
We can improve things here if needed, but for now let's just not claim
that the ciphertext approach is "significantly" better than the
alternative.
2024-03-18 09:59:16 -07:00
Jordan Rose
fca9196201 GroupSendEndorsements: don't fall over in the face of 1-person groups
Previously we'd attempt to create a combination of zero endorsements
for the everybody-but-me credential, and panic (throw an error). Now
we correctly create an endorsement that represents zero people, which
is better than returning some dummy value because it behaves
reasonably if endorsements from multiple groups are combined wholesale
(not something we plan to do, but something that shouldn't have weird
edge cases if we end up needing to).
2024-03-18 09:59:16 -07:00
Jordan Rose
37e68943d6 Add GroupSendEndorsement.toFullToken(...) convenience method
If apps want to cache these tokens, they should prefer to cache the
non-"full" version because it won't redundantly contain the
expiration, but if they don't, dealing with two token types is
unnecessary complexity.
2024-03-18 09:59:16 -07:00
Alex Konradi
3aa3c583bf Move CDSI code to libsignal-bridge::net::cdsi
Move the implementation of the CDSI service into its own module to provide
better scoping. Move the CdsiError that is used only for bridging out of
libsignal-net and into the bridging crate.
2024-03-18 09:57:16 -04:00
Jordan Rose
d2f7ba244b swift: Match debug/release when building benchmarks
Benchmarks should normally be run in the release configuration, but CI
just wants to make sure they still work by running them with a debug
libsignal_ffi.a. Instead of making that a fallback, make it
configuration-dependent, so you can't ever accidentally test the wrong
thing.
2024-03-15 09:58:02 -07:00
Jordan Rose
8ed2dc1195 Remove GroupSendCredential
Long live GroupSendEndorsements!
2024-03-14 12:31:30 -07:00
Jordan Rose
256f4742c7 bridge: Add tests for bridging arrays of bytestrings 2024-03-13 12:22:46 -07:00
Jordan Rose
f1fb1302b7 swift: Add a Benchmarks package for local profiling 2024-03-12 17:03:45 -07:00
Jordan Rose
a7f13d114e Swift: Add GroupSendEndorsement 2024-03-12 17:03:45 -07:00
Jordan Rose
8fb6cc31cf bridge: Make a combined endorsement for GroupSendEndorsementsResponse
Specifically, make this on the Rust side bridge layer, and tack it on
to the end of per-member endorsements for the app side to peel off
later, rather than the app layer calling back down to Rust to compute
it. This saves a fair amount of marshalling work.
2024-03-12 14:54:04 -07:00
Alex Konradi
60f066dbac
Remove AuthCredential
This hasn't been used in client code for some time.
2024-03-11 16:43:23 -04:00
Jordan Rose
cdef8228a2 bridge: Expose GroupSendEndorsement APIs 2024-03-11 13:41:48 -07:00
Jordan Rose
cdbbfdbd96 bridge: Add ArgTypeInfo for Vec<&[u8]>
This *could* be &[&[u8]], but that would complicate the
implementations, all of which use Vec internally anyway.
2024-03-11 13:41:48 -07:00
Jordan Rose
2bbca60eb5 bridge: Add ResultTypeInfo for Box<[Vec<u8>]>
Not actually distinct from Vec<Vec<u8>>, but works better with the
jni_result_type and ffi_result_type macros because `[Vec<u8>]` is a
single grouped token tree. Generalizes the string array helpers to
support bytestrings too.
2024-03-11 13:41:48 -07:00
Alex Konradi
f4f478fd06
Add authentication credential implemented with zkc
Add a new version of the existing auth credential used for groups, but 
implemented with the zkcredential crate instead of hand-written proofs. Expose 
issuance point for the server, and extend existing client methods to support it 
and the existing formats transparently.
2024-03-08 15:38:23 -05:00
Jordan Rose
1c8fd06486 zkgroup: Implement GroupSendEndorsements
This involves a family of new types that will be used for issuing and
verifying these endorsements.

This is a breaking change for zkgroup: it adds a new key to
ServerSecretParams and ServerPublicParams.
2024-03-06 12:22:38 -08:00
Jon Chambers
1d2d9d9254
Retire old SVR2 enclaves
Co-authored-by: Alex Konradi <akonradi@signal.org>
2024-03-01 15:05:07 -05:00
Alex Konradi
274b680ef4
Expose message backup purpose as an argument
Add a flag to the CLI validation tool and an argument to the bridged validation 
functions so users can specify whether a provided message backup should be 
validated according to the rules for device-to-device transfers or backups 
intended for remote storage.
2024-03-01 09:53:00 -05:00
moiseev-signal
d7d2576ae6
SVR3: FFI bridge 2024-02-29 18:22:59 -08:00
Sergey Skrobotov
ec49a9774b libsignal-net: ChatService node bridge 2024-02-27 11:07:57 -08:00
moiseev-signal
58f43107ab
Enforce Swift code formatting 2024-02-23 09:56:38 -08:00
moiseev-signal
6f783269db
SVR3: JNI bridge 2024-02-22 12:22:10 -08:00
Alex Konradi
5b5b85e715
Expose CDSI lookup via FFI 2024-02-22 10:31:01 -05:00
Alex Konradi
0676a89c90
Build Swift docs in CI
Fix existing documentation issues. Prevent backsliding on documentation by 
requiring cross-links to be correct for CI checks to pass.
2024-02-16 17:14:03 -05:00
Alex Konradi
ac538311e9
Use failOnError instead of try! in Swift
Replace existing usages of try! with the failOnError helper. Add guidance to 
the coding guidelines doc.
2024-02-16 14:31:34 -05:00
Alex Konradi
8959e64ed1
Build TESTING_ functions for Android test
Run tests that call native TESTING_ functions on Android. This requires 
building a separate version of libsignal_jni.so with the testing functions 
included. The test code is still omitted from the published artifacts.
2024-02-15 16:53:05 -05:00
Alex Konradi
d08adf19bb
Return username candidates as string array
Use the string bridging code introduced previously to provide string arrays to 
client directly instead of joining and splitting. This eliminates the use of a 
magic ',' character as a delimiter.
2024-02-06 09:46:06 -05:00
Alex Konradi
a628f0ec67 Fix Swift string array bridging slice bug
The Swift helper invokeFnReturningStringArray was using the wrong
indices when slicing up the concatenated strings to produce individual
values. Instead of advancing the base pointer by the N bytes read for a
given string, the base pointer was adjusted to point to LEN - N. This
wasn't detected by the bridging test case since it passed two strings
over, both of length three. For two strings with the same length, the
buggy and corrected code have the same behavior!

This patch adjusts the test case to include strings of different
lengths and fixes the now-revealed bug.
2024-02-05 17:00:47 -05:00
Alex Konradi
580913d225
Re-throw input stream errors in Swift and Java
Re-raise errors produced by an input stream after bubbling them through Rust 
code. This makes the interface less magic and avoids unnecessary 
stringification of error values.
2024-02-02 15:14:27 -05:00
Alex Konradi
7bacdd089a
Bridge message backup to Swift
Present a similar API to the Java client library.
2024-01-30 16:38:54 -05:00
Alex Konradi
c70b66dc8c
Bridge message backup validator to Java
Provide a simple API for validating message backups read from InputStream 
instances.
2024-01-26 13:33:36 -05:00
Jordan Rose
1f8701213b
zkgroup: Add GroupSendCredentialResponse::receive_with_ciphertexts
If a client already has the members of a group as ciphertexts, it's
more efficient to receive a GroupSendCredential that way, because then
they get to skip the conversion from ServiceId to UidStruct. If they
don't, however, the existing entry point is going to be both more
convenient and faster.

For Swift and Java, this is an overload of the existing receive()
method; for TypeScript, it's receiveWithCiphertexts.
2024-01-22 12:34:34 -08:00
Jordan Rose
b31ca0781c Remove length parameter for webpsan
The way images are displayed on Android makes it annoying to provide,
and the implementation of webpsan doesn't actually need it.
2024-01-18 12:36:31 -08:00
Jordan Rose
70a9662acd usernames: Expose Username.fromParts to app languages 2024-01-10 12:26:19 -08:00