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

1431 Commits

Author SHA1 Message Date
Jordan Rose
916269c3e5 Bump to version v0.16.0 2022-04-06 11:08:56 -07:00
Trevor Perrin
7e12a71889
zkgroup: Optimize credential presentation and FFI cleanup
Optimize presentation of credentials (AuthCredentialPresentationV2, ProfileKeyCredentialPresentationV2, PniCredentialPresentationV2). Server will accept V1 or V2 presentations. Clients will produce V2.

Various improvements to FFI to support this, and some minor optimizations (in particular "lazy statics" to avoid redundant loading of SystemParams).
2022-04-06 11:07:08 -07:00
Jordan Rose
29998598e3 GitHub: Pin cbindgen version rather than using what's installed 2022-04-04 12:25:33 -07:00
Jordan Rose
459938a3bc update_versions.py: accept both '0.1.2' and 'v0.1.2' 2022-04-04 12:25:33 -07:00
Jordan Rose
07a51f0211 Release docs: changes to the Rust API are now considered breaking 2022-04-04 12:25:33 -07:00
Jordan Rose
e003feaf74 Add missing "license" lines to Cargo.toml files
This helps tools that read metadata from Cargo.toml, but has no other
effect.
2022-04-04 12:25:33 -07:00
Jordan Rose
93bfcea1ce Build the JNI component of libsignal-server for M1 Macs too 2022-04-04 12:25:33 -07:00
Jordan Rose
300b57fa9e Java: Add a ProGuard file to preserve our JNI bindings 2022-03-29 17:08:48 -07:00
Jordan Rose
59b3a24621 jni: Don't construct keys and records by serialization
Similar to the previous commit, this would make sense if we lazily
deserialized these types, but we don't. It's faster to clone them
structurally in Rust than to serialize and deserialize them.
2022-03-29 17:08:48 -07:00
Jordan Rose
07f6577640 jni: convert ProtocolAddresses to Java like any other bridge_handle
At one point we experimented with Java's SignalProtocolAddress only
wrapping a String + integer, rather than a boxed Rust handle, but we
gave that up because it was more difficult to pass them across the
bridge. That means there's no longer a need to go through
SignalProtocolAddress's main constructor when trying to box one from
Rust.
2022-03-29 17:08:48 -07:00
Jordan Rose
48ce4bf27d java: Test devicetransfer with java.security.cert.CertificateFactory
...instead of the deprecated javax.security.cert.X509Certificate.
2022-03-28 09:49:31 -07:00
Jordan Rose
8247be4840 Java: Fix package for InvalidSenderKeySessionException 2022-03-25 15:34:30 -07:00
Jordan Rose
df2d4ae9fa swift: Remove unnecessary Tests/LinuxMain.swift
This was previously necessary because the Linux implementation of
SwiftPM+XCTest didn't support automatic test discovery, but that's no
longer a problem with newer versions of Swift.
2022-03-25 12:04:17 -07:00
Jordan Rose
ba47c9d681 Bump to version v0.15.1 2022-03-24 17:01:23 -07:00
Jordan Rose
355e2006c4 Java: update reproducible build to Debian Buster (from Stretch)
The main advantage here is that we don't need any dependencies from
the unstable repo, which means we can be sure that the glibc version
we build against is suitable for Buster instead of being pulled in
from a later train. (We can't do this for Stretch because Stretch is
too old for all our build tools.)

While here, simplify the build a little bit: we're already using
snapshots of the Debian repo, so drop the separate file for pinned
dependencies.
2022-03-24 16:59:36 -07:00
Jordan Rose
b5d48df116 Bump to version v0.15.0 2022-03-23 10:57:54 -07:00
Jordan Rose
cbc2103f24 Update README 2022-03-23 10:49:09 -07:00
Jordan Rose
970677795a Node: Rename SignalClientError to LibSignalError 2022-03-23 10:49:09 -07:00
Jordan Rose
0542686e70 Update artifact/package/module names across all three app languages
- Java: org.whispersystems:signal-client-java ->
    org.signal:libsignal-client
- Java: org.whispersystems:signal-client-android ->
    org.signal:libsignal-android
- Java: org.whispersystems:libsignal-server ->
    org.signal:libsignal-server
- Swift: SignalClient -> LibSignalClient
- NPM: @signalapp/signal-client -> @signalapp/libsignal-client
- Repository: github.com/signalapp/libsignal-client ->
    github.com/signalapp/libsignal
2022-03-23 10:49:09 -07:00
Jordan Rose
a0c1745f8b Java: reorganize package structure
- org.whispersystems.libsignal -> org.signal.libsignal.protocol
- org.whispersystems.libsignal.protocol ->
    org.signal.libsignal.protocol.messages
- org.whispersystems.libsignal.util.AndroidSignalProtocolLogger ->
    org.signal.libsignal.logging.AndroidSignalProtocolLogger
- org.signal.zkgroup -> org.signal.libsignal.zkgroup
- org.signal.devicetransfer -> org.signal.libsignal.devicetransfer
  (test only)
- org.signal.client.internal -> org.signal.libsignal.internal
2022-03-23 10:49:09 -07:00
Jordan Rose
f98b7394ec Gradle: Conditionally throw an error when building without JDK 11
Previously the project would error out during the configuration stage,
since the Android Gradle plugin requires JDK 11 to even load. Now it
throws an error if you try to build a top-level task or a task in the
Android subproject, but allows you to build, e.g. 'client:test' with
no problems.
2022-03-22 10:19:47 -07:00
Jordan Rose
526cbab04f Gradle: Fix conditional execution of :downloadNonLinuxLibraries
This helper task was supposed to only execute when publishing the
client or server artifacts, but at the point where that was checked
the task graph *hasn't been built yet*. Instead, add the task to the
task graph unconditionally, but disable it by default, and have its
dependents enable it only when publishing.
2022-03-22 10:19:47 -07:00
Jordan Rose
4e10836255 Java: fix directory structure for org.signal.libsignal.metadata 2022-03-22 10:19:47 -07:00
Jordan Rose
d26cf8b46d Add dedicated error types for invalid 1:1 and Sender Key sessions
In Java these are subclasses of IllegalStateException, a
RuntimeException, so that every session operation isn't annotated as
throwing InvalidSessionException. Swift and TypeScript don't have
typed errors, so they're just additional specific cases that can be
caught.
2022-03-21 14:12:04 -07:00
Jordan Rose
6bd001f244 protocol: Tweak error text for NoSenderKeyState error
We use this when the record for a given distribution ID is missing the
state for a particular chain ID.
2022-03-21 14:12:04 -07:00
Jordan Rose
6591567d31 protocol: Audit the failability of SenderKey session operations
Similar to the previous commit, this makes crate-internal operations
use a dedicated error type, or not produce an error at all, in order
to make sure that errors for invalid sessions always have the
distribution ID attached.
2022-03-21 14:12:04 -07:00
Jordan Rose
601454d201 protocol: Audit the failability of 1:1 session operations
Anything that stays within the crate gets a dedicated error type, or
no error at all if the operation cannot actually fail. The "defensive"
signatures remain for public operations.

Apart from making 'Result' more meaningful, this also keeps from
propagating low-level errors out that really indicate a corrupt
session.
2022-03-21 14:12:04 -07:00
Jordan Rose
c22f7c76b9 java: Fix exception specifications
Some were overzealous, others were missing. Some are still not really
appropriate; see further commits.
2022-03-21 14:12:04 -07:00
Jordan Rose
13292a001c node: Update devDependencies with yarn upgrade
No updates needed for the run-time dependencies.
2022-03-21 11:32:56 -07:00
Jordan Rose
a2182ca348 Update other Rust dependencies
This was done by `cargo update`, followed by reverting to earlier
versions of specific crates that have trouble on our current pinned
nightly.
2022-03-21 11:32:56 -07:00
Jordan Rose
6f2c751d65 Update cpufeatures to 0.2.2, for 64-bit Android hardware crypto
Code using cpufeatures to check for hardware support for cryptographic
operations will now be able to do so on 64-bit Android as well.
2022-03-21 11:32:56 -07:00
Jordan Rose
4e0ab0b08f protocol: Collapse ProtobufDecodingError into InvalidProtobufEncoding
The former was used for errors in the protobuf format itself, while
the latter was used when the decoded protobuf failed some higher-level
precondition. But apps can't really distinguish those cases, and
neither one "should" happen in a reliable system, so this is just
defending against rare or malicious inputs.

This commit mechanically turns every prost::DecodeError into
InvalidProtobufEncoding, but the next commit will make more of a
distinction of these errors.
2022-03-18 12:07:51 -07:00
Jordan Rose
e5e716e9a0 protocol: Remove InternalError error in favor of panics
All our bridges translate panics to platform-specific errors anyway;
there's no advantage in using a dedicated error for things that should
*really* never happen.
2022-03-18 12:07:51 -07:00
Jordan Rose
556f658f1f java: Avoid some unnecessary serialization just to deserialize again 2022-03-18 11:34:17 -07:00
Jordan Rose
1e33d9073d GitHub: Move "Swift Package" CI job to Linux
Pros:

- Linux executors are cheaper on GitHub's CI, when running in the
  private repository.

- Checks that the Swift package can still be built and tested on
  Linux, even though that's not a primary goal.

Cons:

- Removed the code coverage report. It's possible to do this on Linux
  as well, but we haven't been using this as a primary tool, and it's
  still possible to check locally (particularly by running in Xcode).
  The coverage of the Rust tests is more interesting anyway, and we
  haven't had an automated report for *that*.

Neutral:

- Moved the SwiftLint run to the "Swift CocoaPod" job, since SwiftLint
  isn't installed on GitHub's Linux images by default. Even though
  "Swift CocoaPod" is the longest job at the moment and we may want to
  shorten it, the SwiftLint action is quick anyway.
2022-03-17 16:11:43 -07:00
Jordan Rose
ee26c7f269 Swift: restore Linux compatibility (testing only)
- Provide a fallback for generating random data that doesn't use
  Security.framework.
- Fix package unsafe linker settings for ld.gold compatibility.
- Don't depend on the UUID_NULL constant.
2022-03-17 16:11:43 -07:00
Jordan Rose
ac9ad59fb4 protocol: Include message type in InvalidMessage error
The main purpose of this is to distinguish new-session PreKey message
failures from established-session Whisper message failures.

In some cases this meant *not* using InvalidMessage, because the error
wasn't for a particular CiphertextMessage.
2022-03-17 11:46:12 -07:00
Jordan Rose
278d13f944 SSv2: clarify (unlikely) error for a missing identity key
This is returned as a SessionNotFound error so that the recipient's
address can be included, but it's important to clarify that it's the
identity key that's missing.
2022-03-17 11:46:12 -07:00
Jordan Rose
0f5744a712 protocol: Remove the ability to create an empty SenderKeyRecord 2022-03-16 14:09:08 -07:00
Jordan Rose
2cefe2afd6 NoSenderKeyState is a kind of NoSession / SessionNotFound error
...not an illegal state. Also, put the distribution ID in here too,
for good measure.
2022-03-16 14:09:08 -07:00
Jordan Rose
5affb61407 protocol: Separate out InvalidSenderKeySession error state
Making this error actionable means including the distribution ID, and
even without exposing that to apps it'll show up better in logs.
2022-03-16 14:09:08 -07:00
Jordan Rose
b53c9dfa9e SessionNotFound should provide the address that didn't have a session 2022-03-16 14:09:08 -07:00
Jordan Rose
d2ab3dd09f protocol: Collapse InvalidCiphertext error into InvalidMessage
Originally InvalidCiphertext meant something structurally wrong, while
InvalidMessage meant it wasn't decryptable. But distinguishing those
isn't really important except for debugging purposes, so using a
string description is sufficient.
2022-03-14 14:59:39 -07:00
Jordan Rose
507b3b0402 protocol: Remove ProtobufEncodingError
The prost crate documents that encoding can only fail if the buffer
being encoded to is too small, which can never happen when encoding to
a Vec.
2022-03-14 14:59:39 -07:00
Jordan Rose
3e768aa76c protocol: Avoid deserialization overhead for SenderCertificate
A SenderCertificate object stores both the serialized bytes and the
deserialized fields that make up the certificate, which means that
converting from an in-memory protobuf representation requires
serializing back to bytes. Avoid that extra step by delaying the
deserialization of the SenderCertificate protobuf.
2022-03-14 14:59:39 -07:00
Jordan Rose
d8ab51df1e GitHub: apt-get update for "Publish to NPM" action too 2022-03-11 13:46:36 -08:00
Jordan Rose
bd30563044 Java: use the artifact name as the human-readable name when publishing
This matches the (explicitly-specified) name in the previous Gradle
configuration.
2022-03-11 13:31:13 -08:00
Jordan Rose
d2dd1edd78 Java: fix Makefile publish action 2022-03-11 13:31:13 -08:00
Jordan Rose
6f681780cb gitignore: Fix new Java build directory paths 2022-03-11 13:31:13 -08:00
Jordan Rose
6787408e5d Bump to version v0.14.0 2022-03-11 11:00:16 -08:00