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
3e6f93bdef
Merge pull request #162 from signalapp/jrose/bridge-get-string-using-bridge_fn
...
Bridge: implement bridge_get[_optional]_string using bridge_fn
2021-02-01 11:10:49 -08:00
Jack Lloyd
376cdae548
Bump Java to 0.2.3
2021-02-01 12:34:49 -05: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
0078f4e954
Merge pull request #143 from signalapp/jrose/migrate-to-bridge_fn
...
Migrate a big chunk of FFI/JNI to bridge_fn
2021-01-19 16:22:03 -08:00
Jordan Rose
eee42a8fce
Update generated signal_ffi.h / Native.java
2021-01-19 16:07:37 -08:00
Jack Lloyd
9a0c177dfb
Merge pull request #147 from signalapp/jack/java-0.2.2
...
Bump Java version to 0.2.2
2021-01-16 17:41:12 -05:00
Jack Lloyd
b94f08e589
Bump Java version to 0.2.2
2021-01-16 17:38:20 -05:00
Jack Lloyd
6c030d56a5
Drop down to 25k
2021-01-16 15:07:42 -05:00
Jack Lloyd
6c4cd62d1d
Many encryptings
2021-01-16 14:32:22 -05: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
Jordan Rose
c7b4785b9e
Merge pull request #114 from signalapp/jrose/rethrow-errors-and-exceptions
...
Propagate callback exceptions/errors when they fail the whole operation
2021-01-12 12:37:45 -08:00
Jordan Rose
8fa2f4a73f
JNI: Rethrow callback exceptions instead of wrapping them
2021-01-12 11:54:19 -08:00
Jordan Rose
049300d9d4
JNI: Report callback exceptions as the "cause" of a callback failing
2021-01-12 11:54:19 -08:00
Jack Lloyd
7f87232e3d
Bump Java version to 0.2.1 for release
2021-01-11 16:58:21 -05:00
Jack Lloyd
ba91fe441e
Merge pull request #135 from signalapp/jack/fix-decrypt-logic
...
Fix handling when attempting to decrypt with a session that isn't found
2021-01-07 16:47:51 -05:00
Jack Lloyd
0184984db5
Add a test that decryption works after you archive a session state
2021-01-07 15:24:44 -05:00
Jack Lloyd
564a1b7d54
Resolve difference in behavior between Java and Rust SessionRecord
...
In libsignal-protocol-java, SessionRecord holds a SesssionState struct which is
the "active" session plus a list of old states. If the record is freshly
created, there is still a SessionState, but it is an uninitialized/new protobuf
structure which causes all fields to be empty/zero/false.
So in the original Java logic you can call for example hasSenderChain, and on
an empty/fresh record it will return false. However in Rust, in this case the
Option is empty and we return an error instead.
For hasSenderChain, it seems reasonable to return false if there is no active
session, since if there is no session there is certainly no chain.
Android also expects the session version to be == 0 on such sessions, but this
makes less sense, so have this logic only in the Java binding and not in the
Rust library proper.
2021-01-07 13:15:25 -05: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
Jordan Rose
e4ad87fb85
Merge pull request #76 from signalapp/jrose/begin-merging-bridge-libraries
...
Begin merging bridge libraries (ffi and jni)
2020-12-10 13:12:33 -08:00
Jordan Rose
0e19342801
Build libsignal_jni.so with LTO when using it from Java
...
When building a cdylib, Rust currently doesn't export public symbols
on Linux if they come from a dependency. However, enabling LTO gets
around this by performing the filtering step after the merging.
https://github.com/rust-lang/rfcs/issues/2771
2020-12-10 11:29:42 -08:00
Jack Lloyd
059d514611
Merge pull request #113 from signalapp/jack/bump-java-version
...
Bump the Java version number
2020-12-10 14:06:49 -05:00
Jack Lloyd
6cd9771fab
Bump the Java version number
...
Arbitrarily bumping the minor version to signify more notable changes
than prior versions, eg
- Sealed sender now in Rust
- Removed protobufs from Java
- Partial removal of SessionState from Java
- Adding AES-GCM-SIV
2020-12-10 13:24:06 -05:00
Jack Lloyd
21ddb9f112
Merge pull request #93 from signalapp/jack/docker-clean
...
Fix clean target and use it during Docker builds
2020-12-10 13:20:33 -05:00
Jack Lloyd
adb4a65772
For clean target on Desktop, also remove dll and dylib
2020-12-10 13:08:31 -05: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
f471a455c0
Merge pull request #102 from signalapp/jack/java-session-cleanup
...
Cleanup Java Session logic
2020-12-09 16:52:14 -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
Jordan Rose
d05089e6e8
Java: get local tests working on Mac as well
2020-12-08 17:24:03 -08: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