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

1290 Commits

Author SHA1 Message Date
Jordan Rose
d2bef606d1 Bump to version v0.10.0 2021-11-08 11:45:34 -08:00
Jordan Rose
3647f2501b
Merge pull request #417 from signalapp/feature/zkgroup
Add zkgroup to libsignal-client
2021-11-08 11:30:16 -08:00
Jordan Rose
8cf56835ef zkgroup: Move blob padding/unpadding into Rust
Previously this was defined in the app layers, because zkgroup's
original codegen didn't support custom exception types. However, we
can now move it to a common implementation in Rust.
2021-11-08 11:06:32 -08:00
Jordan Rose
014f190cab node: Improve zkgroup's ByteArray helper class
Don't validate sizes explicitly; that's already handled by the
*_CheckValidContents functions exposed in the bridge layer.
2021-11-08 11:06:32 -08:00
Jordan Rose
78b2f1cf64 node: Fix eslint issues 2021-11-08 11:06:32 -08:00
Jordan Rose
ec16fb3067 yarn format 2021-11-08 11:06:32 -08:00
Jordan Rose
32a05f398c node: Add/standardize zkgroup license headers 2021-11-08 11:06:32 -08:00
Jordan Rose
ef958176bd node: Get zkgroup working (and passing tests) 2021-11-08 11:06:32 -08:00
Jordan Rose
96c85fb545 node: Add zkgroup sources verbatim (does not compile) 2021-11-08 11:06:32 -08:00
Jordan Rose
4186b4a506 swift: Improve zkgroup's ByteArray helper class
Don't validate sizes explicitly; they're already provided in the
signatures of the *_check_valid_contents functions exposed in the FFI
layer.
2021-11-08 11:06:32 -08:00
Jordan Rose
bd248f715f swift: Eliminate ZKGUuid type in favor of Foundation.UUID 2021-11-08 11:06:32 -08:00
Jordan Rose
2198447164 swiftlint: allow the term "master" (for GroupMasterKey) 2021-11-08 11:06:32 -08:00
Jordan Rose
ed24ddf8c5 swift: Update zkgroup license headers, remove codegen warnings
And format with swiftlint and remove the extra space after 'throws'
(from Swift having untyped errors).
2021-11-08 11:06:32 -08:00
Jordan Rose
51dd9db22d swift: Get zkgroup to work (and pass its tests)
This is a pretty mechanical translation *except* for

- changes to the ByteArray class to account for libsignal-client
  supporting fixed-size arrays in the bridge layer

- introducing the Randomness wrapper struct to manage the 32 bytes of
  randomness zkgroup uses

- removing ZkGroupException in favor of SignalError, which has a new
  'verificationFailed' case

Everything else replaces zkgroup's generated "ffiapi" entry points with
libsignal-client's bridge_fn entry points.
2021-11-08 11:06:32 -08:00
Jordan Rose
9174837432 swift: Add zkgroup Swift sources verbatim (does not compile) 2021-11-08 11:06:32 -08:00
Jordan Rose
deeafcad51 java: Improve zkgroup's ByteArray helper class
- Don't validate sizes ahead of time if the subclass calls
  CheckValidContents anyway.
- Move serialize() up to ByteArray. Consequently, make ProfileKeyVersion
  *not* a ByteArray, since it serializes as a string.
2021-11-08 11:06:32 -08:00
Jordan Rose
3ed5fff78c java: Merge zkgroup's Hex utility class into libsignal's existing one 2021-11-08 11:06:31 -08:00
Jordan Rose
b8ec92d332 java: Update zkgroup license headers, remove codegen warnings 2021-11-08 11:06:31 -08:00
Jordan Rose
ef73a621f0 java: Get the zkgroup sources to build and pass tests
This is a pretty mechanical translation *except* for

- moving the RANDOM_LENGTH constant out of the obsolete Native class
  (libsignal-client has its own) into a new Constants class

- replacing the mocked SecureRandom with a custom subclass; Mockito
  was refusing to mock SecureRandom and honestly that's fair

- removing unused classes UUIDUtil and ZkGroupError

- updating to JUnit 4, which zkgroup's tests rely on
2021-11-08 11:06:31 -08:00
Jordan Rose
c2261d1701 java: Add the zkgroup sources verbatim (does not compile) 2021-11-08 11:04:58 -08:00
Jordan Rose
852069bdc9 bridge: Add zkgroup APIs
These APIs are designed to match the generated "simpleapi" entry
points in the original zkgroup repository, to make it easier to adapt
the existing Java, Swift, and TypeScript code to libsignal-client.

The cbindgen-generated signal_ffi.h now includes constants, so that
the fixed-size arrays used to serialize zkgroup types can use named
constants in Rust. This meant filtering out some constants that were
getting picked up but that should not be included.

Note that this commit makes references to Java exception types that
will be added in a later commit.
2021-11-08 11:04:41 -08:00
Jordan Rose
10e466c074 bridge: Add back support for bridging u64, now losslessly
- FFI: still maps trivially to uint64_t, no change
- JNI: reinterpret as jlong (i64) to not lose any information
- Node: until Neon supports bigints, convert to/from a big-endian
  Buffer
2021-11-08 11:04:41 -08:00
Jordan Rose
4dc3ca5e6e bridge: Add support for bincode-serialized args and results
This will be used by zkgroup. Note that in order to print the type
correctly in C, a type `Serialized<FooBar>` will be translated to
`[u8; FOO_BAR_LEN]`, where 'FOO_BAR_LEN' has to be a constant that's
in scope.
2021-11-08 11:04:41 -08:00
Jordan Rose
c5ba4ecf48 bridge: Add support for arrays as arguments and return values
Specifically, adding support for *references to fixed-sized arrays* as
arguments (pointer-to-fixed-size-array in C, byte[] in Java, Buffer in
Node), and fixed-sized array values as results (out-pointer-to-fixed-
sized-array in C, byte[] in Java, Buffer in Node). This will be used
for some zkgroup primitive values.
2021-11-08 11:04:41 -08:00
Jordan Rose
f1da238532
Merge pull request #411 from signalapp/jrose/android-save-unstripped-libraries
Android: upload unstripped libraries to Maven as well
2021-11-04 17:32:42 -07:00
Jordan Rose
efa1faefd9
Merge pull request #406 from signalapp/jrose/testable-jar-artifacts
java: Build a "testable" signal-client-java as well
2021-11-04 17:32:29 -07:00
Jordan Rose
4173865931 Android: upload unstripped libraries to Maven as well
This allows us to symbolicate native crash traces if necessary.
2021-11-03 16:32:02 -07:00
Jordan Rose
c65df8524d java: Build a "testable" signal-client-java as well
This is like signal-client-java, but also contains dylibs for Mac and
Windows for testing purposes. Gradle will automatically fetch these
artifacts from the corresponding GitHub release.
2021-11-01 16:54:46 -07:00
Jordan Rose
a00cfd1e90 GitHub: When a release is tagged, build and publish JNI artifacts
This will be used to build a "testable" signal-client-java.jar that
includes native libraries for macOS and Windows in addition to Linux.
This is something zkgroup already has; in particular it allows
developers working on the server to use the zkgroup APIs even if they
run macOS or Windows on their individual machines.
2021-11-01 12:53:56 -07:00
Jordan Rose
ad5166e814 node: Factor out loading the native module into its own file
This logic is a bit finicky and it's better not to repeat it.
2021-11-01 11:46:52 -07:00
Jordan Rose
2544f3d827 bridge: Be more explicit about bridging u64 timestamps
u64 can't be represented as a primitive in Java or TypeScript (and for
the latter, Neon doesn't support bigint yet). However, for timestamps
represented as milliseconds, the integer-safe range of float64 still
covers more than 285,000 years, so it's reasonably safe to use
TypeScript's 'number' or Java's 'long' to represent these
ostensibly-64-bit values. Indicate this with a new Timestamp wrapper
type in the bridge layer.

In theory we could push this new Timestamp type down to the
libsignal-protocol crate. However, the protocol itself doesn't impose
any restrictions on the timestamp fields, so I figured it was best to
put it at the bridge layer, to indicate that it's about how Signal
specifically uses these fields.

This commit paves the way for being stricter about *other* u64 values
that might want to use the full 64-bit space.
2021-11-01 11:46:16 -07:00
Jordan Rose
0f27f82890
Merge pull request #400 from signalapp/jrose/standardize-license-headers
Standardize license headers
2021-10-28 17:48:45 -07:00
Jordan Rose
92a66ca660
Merge pull request #399 from signalapp/jrose/bridge-ffi-uuid-results
bridge: Support UUID return values in the FFI bridge
2021-10-28 17:35:17 -07:00
Jordan Rose
9a569f2ffe Standardize license headers
...to have a period after "Signal Messenger, LLC."

...except for the Java sources, which still need a cleanup pass.
2021-10-28 17:27:30 -07:00
Jordan Rose
81ff2fc2f8
Merge pull request #397 from signalapp/jrose/zkgroup-error-handling
zkgroup: Tidy up error handling
2021-10-28 16:40:55 -07:00
Jordan Rose
c58ebfe4ee bridge: Support UUID return values in the FFI bridge
This was already present in the Java and Node bridges; I'm not sure
why it was considered a problem in the FFI bridge.
2021-10-28 16:21:14 -07:00
Jordan Rose
477838a63c zkgroup: Tidy up error handling
- Use displaydoc to stringify the errors, using the comments that were
  already there. These go into the string descriptions for errors
  exposed to the apps, which can be useful.

- Split PointDecodeError into its own type so that it's not exposed
  generally.
2021-10-28 12:48:08 -07:00
Jordan Rose
ebf804527c
Merge pull request #392 from signalapp/jrose/zkgroup
Import the non-FFI Rust sources of zkgroup
2021-10-28 12:47:18 -07:00
Jordan Rose
64e6978271
Merge pull request #396 from signalapp/jrose/silence-bridge-jni-warning
bridge: Fix warning when building for Java
2021-10-27 12:31:48 -07:00
Jordan Rose
a545b640a6 bridge: Fix warning when building for Java 2021-10-27 11:56:34 -07:00
Jordan Rose
a9012af8e2 Bump to version v0.9.8 2021-10-27 10:36:57 -07:00
Jim Gustafson
8310666076 Implement node interfaces for HsmEnclave 2021-10-26 18:58:20 -07:00
Jim Gustafson
4b9348475c Implement swift interfaces for HsmEnclave 2021-10-26 18:34:27 -07:00
Jordan Rose
0f5f7648f9 Update README for recent changes (hsm-enclave and zkgroup) 2021-10-26 14:37:25 -07:00
Jordan Rose
0de0703bda zkgroup: Remove allow(non_snake_case) where unnecessary
zkgroup uses capitalization to distinguish between scalar values and
curve points, which is conventional in cryptography. However, *most*
files aren't actually doing curve-level operations, and so they don't
need to except themselves from having their names checked.

Also, add deny(unsafe_code) to zkgroup. zkgroup shouldn't need any
unsafe code; like the other crates, let's not bend that policy without
a good reason.
2021-10-26 14:36:39 -07:00
Jordan Rose
729ad3e14c Add zkgroup to the Rust workspace
- Bump the version to 0.9.0, mainly so it doesn't get confused with
  the original repo.
- Use the poksho in this repo and our custom 3.0.0-lizard2 branch of
  curve25519-dalek (instead of a 2.0.0-based one).
- Bump the sha2 dependency to match curve25519-dalek 3.0.
- Remove the reference to the crate's ffi module.

With this, the tests pass and the benchmarks run.
2021-10-26 13:16:36 -07:00
Jordan Rose
5fde6d5fbd zkgroup: Mark as AGPL, and change license headers to match the repo 2021-10-26 12:59:47 -07:00
Jordan Rose
3bdd71493f Import the non-FFI Rust sources of zkgroup
This is the start of an effort to merge zkgroup into libsignal-client,
including its Java, Swift, and TypeScript wrappers. For now we'll just
concentrate on getting the Rust crate to build and pass its tests.
2021-10-26 12:55:16 -07:00
Jordan Rose
b3c12ddf64
Merge pull request #391 from signalapp/jrose/describe-panic
bridge: When converting panics to errors, check for String too
2021-10-26 10:09:47 -07:00
Jordan Rose
8125e891d1 bridge: When converting panics to errors, check for String too
See https://github.com/rust-lang/rfcs/issues/1389.
2021-10-26 09:48:27 -07:00