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

1729 Commits

Author SHA1 Message Date
Jordan Rose
0f83996da2 zkcredential: Add add_attribute_without_verified_key
This omits the public key of an encrypted attribute from a
presentation proof, meaning the verifying server will see that the
attribute has been "correctly" encrypted, but cannot verify which key
was used to perform that encryption.
2023-10-16 13:12:12 -07:00
Jordan Rose
5287799117 Remove unnecessary references to boring-sys 2023-10-16 11:37:26 -07:00
Jordan Rose
afaf508742 Update boring crate 2023-10-16 11:37:26 -07:00
Jordan Rose
ab9d59ff43 Enable subtle's core_hint_black_box (over using its own black_box)
This is applied at the "bridge" level; individual Rust crates don't
need to be making this decision.
2023-10-13 14:13:35 -07:00
Jordan Rose
d551d0912e verify_duplicate_crates: Run specifically on the mobile targets
Previously this ran only for the host target, which fortunately
matched the mobile results for our development platforms and CI.
2023-10-13 14:13:23 -07:00
Jordan Rose
7e746f19cf zkcredential: Add KeyPair::inverse_of
This will be used for credentials issued on ciphertexts and presented
on plaintexts.
2023-10-13 12:33:04 -07:00
Jordan Rose
cb9bbfeed4 Add concrete KeyPair+PublicKey to zkcredential; use them in zkgroup
Previously, zkcredential declared traits 'KeyPair' and 'PublicKey',
which could be implemented to provide custom encryption keys for the
homomorphic encryption used in credentials. However, those keys still
had to be consistent with the proofs generated by zkcredential, and
they ended up looking the same for every attribute type...except in
their decryption.

Now, clients like zkgroup implement a 'Domain' trait to provide the
generator points and type safety for a key, and can reuse
zkcredential's KeyPair, PublicKey, and Ciphertext types. The 'decrypt'
operation still has to be provided on a per-type basis, unfortunately.

The code size and performance impact is below the noise threshold.

This commit CHANGES THE SERDE REPRESENTATION for zkgroup KeyPairs,
including those embedded in types like GroupSecretParams.
Serializations using bincode, including Signal's, will not see any
change, but serializing using another serde implementation will result
in different structure in the KeyPair type.
2023-10-13 12:33:04 -07:00
Jordan Rose
55a1958a15 Test various error and panic scenarios for bridge_fn and bridge_io 2023-10-12 12:23:22 -07:00
Jordan Rose
adbc27ac66 bridge_io: Fix JNI bridging for non-Copy arguments
Tests in later commit
2023-10-12 12:23:22 -07:00
Jordan Rose
179ea8879d CI: Have mypy check for compatibility with Python 3.8 (up from 3.6) 2023-10-10 12:34:30 -07:00
Jordan Rose
17d97859ec bridge: Implement bridge_io for Swift
On the Rust side, this expects a typical C callback function with a
"context" parameter. On the Swift side, we pass a manually-refcounted
object as that "context" which can be used to complete a
CheckedContinuation, bridging into the language 'async' functionality.

The main obstacle to this approach is that Swift does not allow C
function pointers to be used in generic ways, due to its run-time
generics model. AsyncUtils.swift describes the workarounds needed to
deal with this.
2023-10-10 11:52:45 -07:00
Jordan Rose
b40b99d894 bridge: Update linkme to fix a latent Windows issue 2023-10-10 09:45:23 -07:00
Jordan Rose
dbee361705 bridge: Split off JNI futures.rs, like the FFI and Node implementations 2023-10-06 15:19:41 -07:00
Jordan Rose
933f558887 protocol: Log unacknowledged sessions' creation timestamps on encrypt 2023-10-06 09:36:18 -07:00
Jordan Rose
25ca7cc1f7 bridge: Implement bridge_io for Node/Neon
bridge_fn already supported async functions for Node, by running them
on the Node microtask queue using the work in the signal_neon_futures
crate. This PR fits that into the AsyncRuntime trait added for
bridge_io, allowing async bridge_fn and async bridge_io to share code
and the same basic structure when compiling for Node.
2023-10-05 10:07:26 -07:00
Jordan Rose
cbe47b84f4 bridge: Parameterize AsyncRuntime by the Future type it has to execute
This will come in handy when bringing the existing Node async function
support into the AsyncRuntime model: these async operations do *not*
require Send, because they are executed synchronously with JavaScript
operations on the Node microtask queue. This differs from the
"concurrent" async we plan to use with bridge_io, which *will* require
Send on its Futures.
2023-10-05 10:07:26 -07:00
Jordan Rose
697133d9d5 protocol: Don't log about archiving when promoting a session state
When archiving the current session, we log at the Info level if there
wasn't actually a session to archive. However, session handling code
elsewhere can promote an archived session back to current; doing so
implicitly archives the current session. If there was no current
session, this would still log even though the "archive" was an
implementation detail. Now, only the publicly-exposed API will log;
promotions will not.

Additionally, don't bother explicitly archiving the current session
when we receive a pre-key message; we use "promote" to install the new
session, which as discussed will archive automatically.
2023-10-05 09:38:37 -07:00
Jordan Rose
63efc8bf4d bridge_io: Add an explicit parameter for the async runtime
This will let us (a) avoid hardcoding any particular async runtime in
the libsignal-bridge macros, and (b) separate the platform-specific
stuff from the async runtime. libsignal_bridge now has an AsyncRuntime
trait whose only requirement is "run a self-contained Future".
2023-10-05 09:37:55 -07:00
Jordan Rose
7219104cc9 build_ffi.sh: Avoid setting RUSTFLAGS when not cross-compiling
RUSTFLAGS (correctly) goes into the incremental build hash used by
Cargo and by extension rust-analyzer, and having your IDE and build
script disagree results in a fresh build every time.
2023-10-05 09:37:29 -07:00
Jordan Rose
028c5c3f2a protocol: Put Kyber768 support behind a feature flag
This is only used for testing; leaving it out saves 20KB of code size.
2023-10-05 09:37:13 -07:00
Jordan Rose
e8c82fe4b7 build_jni.sh: Allow building just one Android slice at a time 2023-10-04 16:02:45 -07:00
Jordan Rose
3160d93196 node: Mark that CMake is a build-dependency, not a target dependency 2023-10-04 09:46:50 -07:00
akonradi-signal
80ce525e69
Hold Cow<'static, str> in poksho structs
Replace the String values with Cow<'static, str> which lets us hold references
to static strings without copying them onto the heap. Since most added values
are static, this should save on heap usage and runtime cost.
2023-10-03 16:18:04 -04:00
Jordan Rose
ae47f039fa bridge: Add a bridge_io macro that expects a runtime
For now, the "runtime" is spawning a thread that then uses
now_or_never, but eventually this will be a persistent tokio runtime
of some kind.

Also for now, this is only implemented for Java. Swift and Node
support coming soon.
2023-10-02 14:08:10 -07:00
Jordan Rose
ec0c32f3c6 bridge: Make ffi::ArgTypeInfo::load_from not able to fail
This requires a bit of reorganization in SimpleArgTypeInfo, following
a similar pattern in the JNI and Node bridges, but simplifies the use
of ArgTypeInfo in general, including the generated code for
`bridge_fn`.
2023-09-29 13:18:54 -07:00
Jordan Rose
6f4d1e16c0
bridge: Reorganize bridge_fn macro implementations
- Factor out common utilities
- Simplify error handling using syn::Result
- Stop using unzip to produce two collections at once
- Add more explanatory comments
- Remove features on libsignal-bridge-macros

Co-authored-by: Alex Konradi <akonradi@signal.org>
2023-09-29 12:29:46 -07:00
Jordan Rose
5fde77a631 Don't include the Future testing APIs when building for Android 2023-09-27 06:48:21 -07:00
Jordan Rose
a15fffd058 Java: Teach gen_java_decl about Futures for type-safety. 2023-09-27 06:48:21 -07:00
Jordan Rose
2c295f68c9 Java: Implement completing Java Futures from Rust 2023-09-27 06:48:21 -07:00
Jordan Rose
dab8a18959 Java: Add a StderrLogger for testing 2023-09-27 06:48:21 -07:00
Jordan Rose
a563c9b93d Java: Add a bare-bones Future implementation for upcoming async APIs 2023-09-27 06:48:21 -07:00
Jordan Rose
7d1e4d9bf8 jni: Separate "convert to Exception" and "throw Exception" steps
In preparation for completeable Futures, which will want to use an
Exception without throwing it.
2023-09-27 06:48:21 -07:00
Jordan Rose
e13fb02721 jni: Add a wrapper for JNIEnv::new_object that works with jni_args 2023-09-25 11:20:47 -07:00
Sergey Skrobotov
6e733b2742 libsignal-net: network connection primitives 2023-09-22 13:10:40 -07:00
moiseev-signal
7b42c8dc86
Fix a warning when built for fuzzing 2023-09-20 14:10:54 -07:00
moiseev-signal
840a1906c7
Update prost to version 0.12 2023-09-20 14:00:54 -07:00
Alex Konradi
d1f9dff273 Bump to version v0.32.1 2023-09-20 14:26:31 -04:00
moiseev-signal
2a0ba6421f
Copy less in nitro attestation implementation 2023-09-20 10:51:26 -07:00
Jordan Rose
ffc6747553 CI: Add protocol/cross-version-testing to Slow Tests
(because it has to download and build many libsignal versions)
2023-09-20 06:35:36 -07:00
Jordan Rose
301a117384 Add a cross-version-testing crate for libsignal-protocol
By importing past tags of libsignal-protocol, we can check how the
current implementation behaves against previous versions. This initial
test only does v3 (pre-Kyber) 1:1 sessions, but we can add more tests
in the future.
2023-09-20 06:35:36 -07:00
Jordan Rose
f836427f7b protocol: Add missing 'digest' feature for curve25519-dalek dependency
This has always been turned on by other crates, but when
libsignal-protocol is built alone it previously failed.
2023-09-20 06:35:36 -07:00
moiseev-signal
36363750a2
Reimplement IncrementalMacInputStream backed by directly allocated ByteBuffer 2023-09-15 11:00:50 -07:00
akonradi-signal
d07b90f603
Fix Rust documentation
Fix warnings identified by cargo doc and require that the docs build successfully in the future.
2023-09-15 12:17:29 -04:00
moiseev-signal
212094e0c9
Use scalar::clamp_integer 2023-09-14 10:20:14 -07:00
Jordan Rose
e94dc9cf3c verify_duplicate_crates: Use improved --edges no-proc-macro
Previously this didn't compose correctly with `--duplicates` (`-d`),
but now it prunes out dependencies in proc-macros just like we already
were for non-"normal" dependencies (build and dev), allowing us to
maintain our focus on code size.

While here, prefer long forms of flags for more readable code, and
improve the comments around the dependencies we can't avoid
duplicating.
2023-09-14 06:25:59 -07:00
moiseev-signal
62657f2f51
Implement new logic for incremental mac chunk size 2023-09-13 14:33:37 -07:00
akonradi-signal
9752b6e9fa
Use hex! for binary strings in zkgroup and zkcredential 2023-09-13 14:45:21 -04:00
akonradi-signal
501f27c4ce
Remove unnecessary mut 2023-09-13 09:59:39 -04:00
moiseev-signal
d464d0030b
Implement Nitro attestation 2023-09-12 16:54:28 -07:00
akonradi-signal
ef542e3b9f
Bump rust compiler version to nightly 2023-09-01 2023-09-12 14:27:08 -04:00