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

2058 Commits

Author SHA1 Message Date
Alex Konradi
31c19ae8af
Add justfile with a few recipes
Co-authored-by: moiseev-signal <122060238+moiseev-signal@users.noreply.github.com>
2024-03-25 15:09:33 -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
6e4d636fef
Improve CDSI rate limit response handling
Handle the case where the CDS server rejects the HTTP UPGRADE request with a 
429 status and includes a Retry-After header by mapping it to the same 
RateLimited error variant. Test that and the existing 
websocket-close-message-based functionality.
2024-03-25 13:09:21 -04:00
Max Moiseev
5fc7f228b9 attest: Organize .proto definitions 2024-03-25 09:38:24 -07:00
Max Moiseev
eb556579f5 attest: Fix the Clock safe field type 2024-03-25 09:38:24 -07:00
Sergey Skrobotov
d7a4b8c817 libsignal-net: ChatService jni bridge 2024-03-21 13:19:27 -07:00
Alex Konradi
23764a50e8
Use @CalledFromNative to prevent stripping
Add an annotation, CalledFromNative, and directives in the proguard file that 
recognize it and prevent items it's attached to from being stripped during code 
minification. Use it in place of some existing rules, and add it to methods 
that were already being called from native code.
2024-03-21 14:10:23 -04:00
Alex Konradi
5ef3a7504d
Import latest message backup proto definition 2024-03-21 14:07:20 -04:00
Jordan Rose
a4561d0b78 attest: Move CertChain and Expireable out of dcap 2024-03-21 11:07:06 -07:00
Jordan Rose
57298c73d0 attest: Remove some unnecessary 'pub'
For PcrMap and tpm2::Error, re-export them from the tpm2snp module, so
we don't have to expose all of tpm2.
2024-03-21 11:07:06 -07:00
Jordan Rose
7865f1cafe attest: Move tpm2snp submodules out to their own files 2024-03-21 11:07:06 -07:00
Alex Konradi
41897ff45e Remove ProfileKeyCredentialPresentationV1
This is no longer constructed in clients, and the last usage of the "structurally
valid" entry points was recently removed.
2024-03-20 17:32:00 -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
Alex Konradi
59b5ca0def
Narrow the errors returned by bridged HTTP fns
Use AsType<X, String> to convert HTTP method, and header names and values in 
the bridging preamble so they can be used infallibly within the function 
bodies. Keep the Result<> output for HttpRequest_new so that it can return an 
InvalidUri error which, when bridged in Java, will produce a checked exception.
2024-03-20 14:36:38 -04:00
Jordan Rose
d9f6c0ee3c Bump to version v0.42.0 2024-03-19 16:47:08 -07:00
moiseev-signal
66809f0ed2
SVR3: Implement AMD SEV SNP with TPM2 attestation
Co-authored-by: Jordan Rose <jrose@signal.org>
2024-03-19 16:20:33 -07:00
Jordan Rose
9e15106ee2 crates_code_size: "Fix" empty-labeled item in report
Some lines just have "src/foo.rs" in their debug info, for unclear
reasons. We could collect them into an "unknown crates" bucket, but
that isn't very useful either. This tweak just prevents them from
being collected into a line with no label.
2024-03-18 11:58:25 -07:00
Matthias Ahouansou
ba25c228c9 bridge: only use cpufeatures on iOS 2024-03-18 11:10:42 -07:00
Alex Konradi
89795fa2a9
Update .gitattributes and .gitignore
Treat .binproto and .binproto.encrypted files in all directories, as binary, 
not just the root.
2024-03-18 13:00:31 -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
Jordan Rose
fa24a77dee attest: Use strum::EnumCount instead of variant_count
No real difference, but strum is a more popular crate that we use
elsewhere, might as well not have both.
2024-03-18 09:22:17 -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
Alex Konradi
37042dd2fa
libsignal-net cleanup
Remove unused code and reduce visibility where it doesn't break existing usages.
2024-03-15 09:52:21 -04:00
Jordan Rose
1e635f1fa3 zkcredential: Keep compressed *and* decompressed endorsements around
This saves work for callers that need both, which includes
GroupSendEndorsement: after receiving and validating the endorsements,
they need to get serialized and sent back up to the app layer to put
in its database (compressed), but we also generate an extra
"everyone-but-me" endorsement from the results (decompressed).

This saves quite a bit of time in the app-layer benchmarks, since they
include the cost of serialization.
2024-03-14 13:32:26 -07:00
Jordan Rose
8ed2dc1195 Remove GroupSendCredential
Long live GroupSendEndorsements!
2024-03-14 12:31:30 -07:00
Jordan Rose
0c940626fb Java: Use strong types for array-of-bytestrings
The choice between byte[] and ByteBuffer is non-obvious, so it's worth
generating Native.java with a little more fidelity.
2024-03-13 12:22:46 -07:00
Jordan Rose
256f4742c7 bridge: Add tests for bridging arrays of bytestrings 2024-03-13 12:22:46 -07:00
Alex Konradi
6b253b5ddb Continue the size check if GH response is invalid
Continue the rest of the check_code_size.py script if the GH tool invoked by the
script fails or produces unexpected results.
2024-03-13 12:52:42 -04: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
2cc9aae468 Node: Add benchmarks for GroupSendEndorsement 2024-03-12 17:03:45 -07:00
Jordan Rose
3c236356d6 Node: 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
Jordan Rose
bd23dfe195 Java: Add an UNCHECKED_AND_UNCLONED mode for GroupSendEndorsements
...since we sometimes create them in bulk from data coming right out
of libsignal_jni, and for a large enough group the cost of that can be
significant. If data coming from libsignal_jni is wrong, we have
bigger problems! (And we'll also get AssertionErrors when the bad
endorsements used, saying they should have been validated ahead of
time. So it won't go completely unnoticed.)
2024-03-12 14:54:04 -07:00
Jordan Rose
17d8737fac Java: Regression test a 1000-person GroupSendEndorsementsResponse 2024-03-12 14:54:04 -07:00
Jordan Rose
93237adc56 Android: Add benchmarks for GroupSendEndorsement
These show quite a bit of overhead over running the Rust benchmarks
directly. Something to look into!
2024-03-12 14:54:04 -07:00
Jordan Rose
54727562fc Android: mark benchmark tests as profilable 2024-03-12 14:54:04 -07:00
Alex Konradi
68f13f4ae6
Unify SVR3 & CDSI connection code
Move common code into a single place.
2024-03-12 17:12:38 -04:00
Jordan Rose
7e3965f01b
Update Rust dependencies
- `cargo update`, except clap and assert_cmd, which bumped their MSRV
- net: Update hyper and hyper-body-util off of RCs
- attest: Update asn1
2024-03-11 17:42:57 -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
2aa3c34088 java: Implement GroupEndorsement APIs 2024-03-11 13:41:48 -07: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
Jordan Rose
ce93eebd11 bridge: Add IntoParallelIterator for ServiceIdSequence
This will be used by GroupSendEndorsementsResponse::receive_with_service_ids.
2024-03-11 13:41:48 -07:00
Jordan Rose
29312dbbdc bridge: Move ServiceIdSequence to its own file
And while here, simplify the implementation to a form that lends
itself to being a rayon IntoParallelIterator as well (next commit).

(I've named the module `sequences` because I think we might want to
generalize this in the future, but I didn't end up using that in this
series.)
2024-03-11 13:41:48 -07:00