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

1651 Commits

Author SHA1 Message Date
Jordan Rose
9729dd91d1
Merge pull request #1 from signalapp/jrose/clone-on-demand
Clone unowned object handles on demand
2020-10-02 15:27:13 -07:00
Jordan Rose
d5e8aa7f9d Consistently use init(owned:) for handle owners
Most wrapper types don't need the "maybe owned, maybe borrowed"
functionality of ClonableHandleOwner, but we can still be explicit
about ownership to make sure nothing gets destroyed that shouldn't.
2020-10-02 15:21:15 -07:00
Jordan Rose
934cb60a5c Clone unowned object handles on demand
This fixes a correctness issue when object wrappers are returned, and
a performance issue when object wrappers are made for non-owned
handles.
2020-10-02 15:21:15 -07:00
Jack Lloyd
f4b571ce0b
Merge pull request #2 from signalapp/jack/ffi
Initial Swift binding work
2020-10-02 18:17:19 -04:00
Jack Lloyd
bcdda77a4c Remove signal_ffi.h
Generated by makefile now
2020-10-02 18:12:52 -04:00
Jack Lloyd
11986398be Use Into/From instead of an explicit conversion function 2020-10-02 17:55:05 -04:00
Jordan Rose
3ebd738652 Simplify pkg-config configuration
pkg-config already has a way to refer to "the directory of the .pc
file".
2020-10-02 14:44:53 -07:00
Jack Lloyd
d2edc6cbf0 Add some end to end session encryption/decryption tests 2020-10-02 17:17:09 -04:00
Jack Lloyd
dc3e0c0b0a Add constructors for PreKeyRecord and SignedPreKeyRecord 2020-10-02 17:16:57 -04:00
Jack Lloyd
9c936d123d add ciphertext meessage 2020-10-02 17:16:33 -04:00
Jack Lloyd
c8a1ff0cd2 Update SignalEncrypt to the new API returning an object 2020-10-02 17:15:52 -04:00
Jack Lloyd
ad11574b0d Merge the InMemory data stores
This is mostly (only?) for testing anyway, and having them all be a
single struct makes the tests easier
2020-10-02 17:15:18 -04:00
Jack Lloyd
2eb4696af3 We must distinguish what CiphertextMessage is returned from encrypt 2020-10-02 17:13:58 -04:00
Jordan Rose
679493fc2e PrivateKey.init() -> PrivateKey.generate()
Make it explicit that this is non-pure (i.e. we won't get the same
PrivateKey every time).
2020-10-02 12:47:33 -07:00
Jordan Rose
cf105f9fd2 Implement a safer form for passing stores through to libsignal-ffi
- Make the store protocols class-bound, so that we can guarantee
  reference semantics.

- Use a callback-based 'withSenderKeyStore' that produces an FFI-layer
  store that's only valid for the duration of the callback.
2020-10-02 11:20:17 -07:00
Jordan Rose
e90d6172b3 Collapse invokeFnReturningUInt(32|64) into invokeFnReturningInteger 2020-10-02 11:06:06 -07:00
Jordan Rose
62e9b5207b Clean up CheckError helper
And introduce a SignalFfiErrorRef to help distinguish OpaquePointers.
2020-10-02 11:06:06 -07:00
Jordan Rose
29312c9d39 Use SignalErrorCode values in CheckError switch 2020-10-02 11:06:06 -07:00
Jordan Rose
4cc86ab486 Read a pkg-config file for libsignal_ffi if it's there
This makes it easier to build against a locally-built libsignal_ffi:
set PKG_CONFIG_PATH before invoking `swift build`.
2020-10-02 11:06:06 -07:00
Jordan Rose
fd106d254e Accept const pointers for the various stores 2020-10-02 10:31:24 -07:00
Jordan Rose
54d8e582d4 Generate a pkg-config file for building against the build directory
And wrap up the various build tasks in a Makefile:
- make rust: normal cargo build
- make cbindgen: regenerate the FFI header
- make pkg-config: generate the pkg-config file for using the library

All of this stuff is only set up for a local build, not
cross-compiling, but the pkg-config is only sensible for a local build
anyway. We can revisit this later.
2020-10-01 15:16:03 -07:00
Jordan Rose
6b16626593 Name enum variants as SignalErrorCode_Foo
Small change to import better into Swift
2020-10-01 12:53:53 -07:00
Jordan Rose
1690b8d2f7 Make type renaming more reliable 2020-10-01 12:47:30 -07:00
Jack Lloyd
3b53917164 stores 2020-10-01 13:25:41 -04:00
Jack Lloyd
75b82d6246 More stores 2020-10-01 13:00:23 -04:00
Jack Lloyd
4487483c58 Add the other in mem data stores 2020-09-30 18:46:30 -04:00
Jack Lloyd
7df96578b2 Remove trailing ;s 2020-09-30 18:27:51 -04:00
Jack Lloyd
7656aef7ef fix the crash 2020-09-30 18:26:51 -04:00
Jack Lloyd
6271113a01 Add clone functions for all types 2020-09-30 18:16:59 -04:00
Jack Lloyd
dbfda723db Update for renamed structs 2020-09-30 15:51:47 -04:00
Jack Lloyd
3294d21923 Namespace the types as well 2020-09-30 15:39:24 -04:00
Jack Lloyd
06956d4b34 Correct memory leaks in the store layer 2020-09-30 15:25:46 -04:00
Jack Lloyd
32b6fd4df5 Another attempt, alas not working 2020-09-29 18:12:31 -04:00
Jack Lloyd
bf09bd9895 Initial incomplete implementation of Swift binding 2020-09-29 16:16:15 -04:00
Jack Lloyd
fdf3e954e0 Add license and readme file 2020-09-29 16:10:42 -04:00
Jack Lloyd
b59af68f9b We need 2 ctx pointers
The first in the store to act as a "self" and the second for the user context
2020-09-25 16:12:29 -04:00
Jack Lloyd
1eee61bf44 Helpers for IdentityKeyPair protobuf 2020-09-24 15:12:27 -04:00
Jack Lloyd
b100147493 Avoid serializing if returning a new object makes more sense 2020-09-23 15:24:38 -04:00
Jack Lloyd
27a5711e91 Make optional u32 handling simpler 2020-09-23 15:18:43 -04:00
Jack Lloyd
13ee68ad16 Return arrays and strings in newly allocated copies 2020-09-23 12:58:16 -04:00
Jack Lloyd
89bbfa294b Return strings as copies 2020-09-23 12:18:10 -04:00
Jack Lloyd
a0ba3a592a cargo fmt 2020-09-23 10:41:19 -04:00
Jack Lloyd
dd9ef4b0a4 Use _destroy suffix consistently for destructor fns 2020-09-23 10:40:44 -04:00
Jack Lloyd
594b9434d1 Change fingerprint interface 2020-09-18 18:40:41 -04:00
Jack Lloyd
146ff74995 Add warning to README 2020-09-18 16:06:50 -04:00
Jack Lloyd
e3ede0030a Consistent naming 2020-09-18 15:39:12 -04:00
Jack Lloyd
e21f6a9e50 Change signature verification ABI 2020-09-18 15:28:47 -04:00
Jack Lloyd
e7372b1aaa Correct typo 2020-09-18 15:21:34 -04:00
Jack Lloyd
755cc052f3
Merge pull request #8 from signalapp/jack/add-context
Update with Context (unused) and capture more debug info
2020-09-17 13:27:43 -04:00
Jack Lloyd
f02bdf6eb5 Remove some redundant uses of ref 2020-09-17 12:55:18 -04:00