Commit Graph

61 Commits

Author SHA1 Message Date
Jack Lloyd
846bcdfe7d Fix the Java interface for DeviceTransferKey 2021-03-09 10:23:19 -05:00
Jack Lloyd
1944d16dec Device Sender Utilities - Generate Key + Self-Signed Certificate 2021-03-08 16:46:19 -05:00
Jordan Rose
f9dc12947e Bridge: Limit bridge_get_bytearray so it can use bridge_fn_buffer
By disallowing arbitrary expressions, bridge_get_bytearray (and
bridge_get_optional_bytearray) ends up a lot more like bridge_get,
and can reuse the infrastructure in bridge_fn_buffer instead of
needing a separate per-bridge implementation.
2021-02-25 18:08:13 -08:00
Greyson Parrelli
a1468f7371 Move the burden of SessionCipher locking to the client. 2021-02-18 12:45:34 -05:00
Jack Lloyd
334231fbf0 Merge pull request #178 from signalapp/jack/remove-displayable-format
Remove DisplayableFingerprint_Format from bridge
2021-02-04 16:40:39 -05:00
Jack Lloyd
26d46e3d2d Remove DisplayableFingerprint_Format from bridge
This should only be done by the fingerprint generator.

Was exposed in Java but never called by Android. Not even exposed in Swift
2021-02-04 16:18:18 -05:00
Jordan Rose
512d0226bc Reject SenderCertificates without UUIDs
Additionally, never look up a session by e164 when decrypting
sealed-sender messages.

This is an API-breaking change for both Java and Swift clients;
certain fields and arguments are no longer Optional. On top of that,
some tests may need to be updated to provide UUIDs instead of just
phone numbers.
2021-02-04 11:25:33 -08:00
Jordan Rose
b522c42526 Bridge: use Node's bridge_fn HKDF for JNI as well
FFI's is still separate because it generates its output into an
existing buffer, which is a different signature than the other two.
2021-02-03 17:01:11 -08:00
Jordan Rose
478e178ac4 Add bridge_fn_void and use it for SessionRecord_ArchiveCurrentState
This also builds on the mutable borrow groundwork in the previous
commit.
2021-02-03 15:38:34 -08:00
Jordan Rose
c05ec3368f Bridge: move last ffi/jni macro-based APIs over to regular bridge_fns
Slightly more verbose than a dedicated macro, but not worth keeping
around.
2021-02-01 18:33:48 -08:00
Jordan Rose
6e46c905f4 Bridge: move remaining int-returning APIs to plain bridge_fns
They don't fit in bridge_get! because they have extra logic, but
that's okay.
2021-02-01 18:33:48 -08:00
Jordan Rose
1187d3c1de Bridge: move simple object returns to bridge_get! as well 2021-02-01 18:33:48 -08:00
Jordan Rose
3d95678b76 Bridge: add a general bridge_get! and use it for strings and ints 2021-02-01 18:33:48 -08:00
Jordan Rose
f92e670bfd Bridge: move PreKeyBundle_New into bridge_fn
This is the first use of Option<&PublicKey> as an argument type.
2021-02-01 18:18:42 -08:00
Jordan Rose
dffb8864c6 Bridge: implement bridge_get[_optional]_string using bridge_fn
Replaces per-bridge implementations. Unfortunately, the other macros
are a little harder:

- bridge_deserialize and bridge_destroy allow customizing the /type/
  name rather than the final function name
- bridge_get[_optional]_bytearray avoids extra copies differently from
  bridge_fn_buffer

This reorders the FFI arguments to put the output at the front, a
convention we've been slowly moving towards anyway.
2021-01-28 17:59:11 -08:00
Jack Lloyd
d77fa218a2 Map errors through the bridge more carefully
Remove several errors that were very once-off.

In Java avoid throwing RuntimeException unless it's an internal error
that we really should crash on.
2021-01-28 14:26:17 -05:00
Jordan Rose
c3b14f0a44 Java: Hook up the 'log' crate to SignalProtocolLogger 2021-01-21 13:57:28 -08:00
Jordan Rose
eee42a8fce Update generated signal_ffi.h / Native.java 2021-01-19 16:07:37 -08:00
Jordan Rose
2d8c877baa Move SignalMessage and PreKeySignalMessage to bridge_fn 2021-01-14 13:34:58 -08:00
Jordan Rose
19be1c569d Convert publickey_verify to bridge_fn
This included reordering parameters in the C version so that the
output parameter is always first. That's consistent with our other C
APIs anyway.
2021-01-14 13:34:34 -08:00
Jack Lloyd
8ae34e784b Remove SessionState from Java interface
With https://github.com/signalapp/Signal-Android-Private/pull/1279 merged,
Android no longer uses SessionState
2021-01-06 12:57:41 -05:00
Jordan Rose
7b3093ddbb Add a --verify option to gen_java_decl.py
And bump the copyright years to 2021.
2021-01-04 12:08:26 -08:00
Sebastian
b9cfddb97a Implement IdentityKeyPair Deserialize 2021-01-04 17:42:41 +01:00
Jack Lloyd
4131f8075c Merge pull request #105 from signalapp/jack/no-more-java-protobuf
Remove protobuf from Java binding
2020-12-10 10:24:14 -05:00
Jack Lloyd
4b4af51b08 Remove more of SessionState from the Java binding
Leaving only a few bits still directly used by Android
2020-12-09 17:29:20 -05:00
Jack Lloyd
f4f2a98985 Remove bogus constructor 2020-12-09 15:31:29 -05:00
Jack Lloyd
4b4b7e3df6 Make some changes on the road to removing SessionState from Java 2020-12-09 13:48:14 -05:00
Jack Lloyd
612ef9f44c Remove protobuf from Java 2020-12-09 13:01:31 -05:00
Jack Lloyd
a8c0555f4e Transfer SessionRecords via handle instead of serialization 2020-12-08 18:18:46 -05:00
Jack Lloyd
f8182af008 Invoke native methods instead of manipulating protobufs within Java 2020-12-08 18:13:12 -05:00
Jack Lloyd
a32efa2d24 Remove some Java API surface no longer needed
Some cruft still remains for the tests which is hard to avoid, eg getAliceBaseKey
2020-12-08 18:13:06 -05:00
Jack Lloyd
07ac8befdc Merge pull request #100 from signalapp/jack/log-java-exceptions
Have Maven log stack traces of tests that fail with exceptions
2020-12-07 17:55:32 -05:00
Jack Lloyd
fe45db9c82 Have Maven log stack traces of tests that fail with exceptions 2020-12-07 17:28:03 -05:00
Jack Lloyd
9f11b256a8 Expose AES-GCM-SIV to Java and Swift 2020-12-04 18:13:16 -05:00
Jordan Rose
df87cd2edf UnidentifiedSenderMessageContent: Don't validate the sender up front
Both the Android and iOS clients currently allow customizing this
validatation logic for testing purposes, and iOS additionally wants to
log the information about the unwrapped message even if there are
problems with it.

iOS does also currently log information about the unwrapped message
even if the static key being used is wrong, but in order to fix that
we'd have to have a secondary return value (either the expected static
key, computed during decrypt-to-USMC, or a flag saying whether the
comparison failed).
2020-12-01 16:50:49 -08:00
Jack Lloyd
153fe71238 Remove Java-side protobufs for Sealed Sender
They were still being used in the tests
2020-11-21 04:58:57 -05:00
Jack Lloyd
786b9b5792 SealedSessionCipher decrypt 2020-11-19 16:06:04 -05:00
Jack Lloyd
405d071ead SealedSessionCipher encrypt 2020-11-19 13:24:29 -05:00
Jack Lloyd
ddda1a3635 UnidentifiedSenderMessage 2020-11-19 13:24:29 -05:00
Jack Lloyd
4a8705dce1 UnidentifiedSenderMessageContent 2020-11-19 13:24:29 -05:00
Jack Lloyd
507629ff0d Add SenderCertificate and ServerCertificate 2020-11-19 13:24:29 -05:00
Jack Lloyd
3cb8e46ba1 Remove some unused util functions from Java library
The only function Android imports from KeyHelper is generateRegistrationId
2020-11-18 15:42:29 -05:00
Jack Lloyd
61057fe71b Import the libsignal-metadata-java tests
Accidentally omitted from import in #21
2020-11-13 13:45:24 -05:00
Jack Lloyd
b92b5937ca Automatically generate Native.java from the exported symbols of the Rust bridge 2020-11-12 17:47:00 -05:00
Jack Lloyd
c3fd6fcf6a Use a better name
Unrelated, remove an unused import
2020-11-11 13:00:48 -05:00
Jack Lloyd
54835b0a03 Fixes for Android
- Allow info to be null/empty in HKDF arguments. This is used during
  KBS attestation.
- Allow creating an ECPublicKey from the un-typed key bytes, also used
  when talking to KBS.
2020-11-11 11:48:27 -05:00
Jack Lloyd
9ca168a567 Remove the SenderKey protobufs from Java wrapper 2020-11-06 17:47:56 -05:00
Jack Lloyd
dd57254f8f Move makefile and docker file into java subdir 2020-11-06 16:40:54 -05:00
Jack Lloyd
a3f5b64257 Add ECPublicKey.generate 2020-11-05 17:59:09 -05:00
Jack Lloyd
4db424c3b2 Don't ignore invalid preKeyIds just because preKey is null 2020-11-05 17:59:09 -05:00