commit: 26550ea9d5b168d720d5feeab02c25f070c388be
parent da6337aa5a73f535ef9ff2588ffc019f96613590
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 1 Oct 2017 14:14:26 -0700
Add libsignal-protocol-c git
Diffstat:
6 files changed, 179 insertions(+), 0 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -112,6 +112,10 @@
[submodule "pkg/libpng/src"]
path = pkg/libpng/src
url = https://github.com/glennrp/libpng
+[submodule "pkg/libsignal-protocol-c/src"]
+ path = pkg/libsignal-protocol-c/src
+ url = https://github.com/WhisperSystems/libsignal-protocol-c
+ ignore = all
[submodule "pkg/libusb/src"]
path = pkg/libusb/src
url = https://github.com/libusb/libusb
diff --git a/pkg/gen.lua b/pkg/gen.lua
@@ -40,6 +40,7 @@ subgen 'libnl'
subgen 'libpciaccess'
subgen 'libpng'
subgen 'libressl'
+subgen 'libsignal-protocol-c'
subgen 'libtermkey'
subgen 'libusb'
subgen 'libxkbcommon'
diff --git a/pkg/libsignal-protocol-c/gen.lua b/pkg/libsignal-protocol-c/gen.lua
@@ -0,0 +1,112 @@
+cflags{
+ '-Wall',
+ '-I $srcdir/src',
+ '-I $srcdir/src/curve25519/ed25519',
+ '-I $srcdir/src/curve25519/ed25519/additions',
+ '-I $srcdir/src/curve25519/ed25519/additions/generalized',
+ '-I $srcdir/src/curve25519/ed25519/nacl_includes',
+}
+
+lib('libsignal-protocol-c.a', [[src/(
+ LocalStorageProtocol.pb-c.c
+ WhisperTextProtocol.pb-c.c
+ FingerprintProtocol.pb-c.c
+
+ vpool.c
+ signal_protocol.c
+ curve.c
+ hkdf.c
+ ratchet.c
+ protocol.c
+ session_state.c
+ session_record.c
+ session_pre_key.c
+ session_builder.c
+ session_cipher.c
+ key_helper.c
+ sender_key.c
+ sender_key_state.c
+ sender_key_record.c
+ group_session_builder.c
+ group_cipher.c
+ fingerprint.c
+ device_consistency.c
+
+ protobuf-c/protobuf-c.c
+ curve25519/(
+ curve25519-donna.c
+ ed25519/fe_0.c
+ ed25519/fe_1.c
+ ed25519/fe_add.c
+ ed25519/fe_cmov.c
+ ed25519/fe_copy.c
+ ed25519/fe_frombytes.c
+ ed25519/fe_invert.c
+ ed25519/fe_isnegative.c
+ ed25519/fe_isnonzero.c
+ ed25519/fe_mul.c
+ ed25519/fe_neg.c
+ ed25519/fe_pow22523.c
+ ed25519/fe_sq.c
+ ed25519/fe_sq2.c
+ ed25519/fe_sub.c
+ ed25519/fe_tobytes.c
+ ed25519/ge_add.c
+ ed25519/ge_double_scalarmult.c
+ ed25519/ge_frombytes.c
+ ed25519/ge_madd.c
+ ed25519/ge_msub.c
+ ed25519/ge_p1p1_to_p2.c
+ ed25519/ge_p1p1_to_p3.c
+ ed25519/ge_p2_0.c
+ ed25519/ge_p2_dbl.c
+ ed25519/ge_p3_0.c
+ ed25519/ge_p3_dbl.c
+ ed25519/ge_p3_to_cached.c
+ ed25519/ge_p3_to_p2.c
+ ed25519/ge_p3_tobytes.c
+ ed25519/ge_precomp_0.c
+ ed25519/ge_scalarmult_base.c
+ ed25519/ge_sub.c
+ ed25519/ge_tobytes.c
+ ed25519/open.c
+ ed25519/sc_muladd.c
+ ed25519/sc_reduce.c
+ ed25519/sign.c
+ ed25519/additions/compare.c
+ ed25519/additions/curve_sigs.c
+ ed25519/additions/elligator.c
+ ed25519/additions/fe_isequal.c
+ ed25519/additions/fe_isreduced.c
+ ed25519/additions/fe_mont_rhs.c
+ ed25519/additions/fe_montx_to_edy.c
+ ed25519/additions/fe_sqrt.c
+ ed25519/additions/ge_isneutral.c
+ ed25519/additions/ge_montx_to_p3.c
+ ed25519/additions/ge_neg.c
+ ed25519/additions/ge_p3_to_montx.c
+ ed25519/additions/ge_scalarmult.c
+ ed25519/additions/ge_scalarmult_cofactor.c
+ ed25519/additions/keygen.c
+ ed25519/additions/open_modified.c
+ ed25519/additions/sc_clamp.c
+ ed25519/additions/sc_cmov.c
+ ed25519/additions/sc_neg.c
+ ed25519/additions/sign_modified.c
+ ed25519/additions/utility.c
+ ed25519/additions/generalized/ge_p3_add.c
+ ed25519/additions/generalized/gen_eddsa.c
+ ed25519/additions/generalized/gen_labelset.c
+ ed25519/additions/generalized/gen_veddsa.c
+ ed25519/additions/generalized/gen_x.c
+ ed25519/additions/generalized/point_isreduced.c
+ ed25519/additions/generalized/sc_isreduced.c
+ ed25519/additions/xeddsa.c
+ ed25519/additions/zeroize.c
+ ed25519/nacl_sha512/blocks.c
+ ed25519/nacl_sha512/hash.c
+ ed25519/tests/internal_fast_tests.c
+ )
+)]])
+
+fetch 'git'
diff --git a/pkg/libsignal-protocol-c/patch/0001-Avoid-including-sys-cdefs.h-header.patch b/pkg/libsignal-protocol-c/patch/0001-Avoid-including-sys-cdefs.h-header.patch
@@ -0,0 +1,60 @@
+From b77b2265f0a45ebc9ca4734f90f9e12ad2139ba2 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 28 Sep 2017 10:40:17 -0700
+Subject: [PATCH] Avoid including sys/cdefs.h header
+
+sys/cdefs.h is non-standard, and other headers in the project already just use
+`#ifdef __cplusplus` directly. The existing ifdefs and defines are confusing and
+broken in some cases (for instance, musl libc does not provide sys/cdefs.h, so
+the build fails).
+---
+ src/vpool.h | 20 ++++++--------------
+ 1 file changed, 6 insertions(+), 14 deletions(-)
+
+diff --git a/src/vpool.h b/src/vpool.h
+index 04707cb..71b9710 100644
+--- a/src/vpool.h
++++ b/src/vpool.h
+@@ -21,18 +21,6 @@
+ #define _VPOOL_H_
+
+ #include <sys/types.h>
+-#if !defined(_WINDOWS) && !defined(__sun__)
+-#include <sys/cdefs.h>
+-#else
+-#ifdef __cplusplus
+-#define __BEGIN_DECLS extern "C" {
+-#define __END_DECLS }
+-#else
+-#define __BEGIN_DECLS
+-#define __END_DECLS
+-#endif /* __cplusplus */
+-#endif /* _WINDOWS */
+-
+ #include <limits.h>
+
+ struct vpool {
+@@ -49,7 +37,9 @@ struct vpool {
+ enum vpool_trunc {VPOOL_EXCLUDE, VPOOL_INCLUDE};
+ #define VPOOL_TAIL UINT_MAX
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ void vpool_init(struct vpool *pool, size_t blksize, size_t limit);
+ void vpool_final(struct vpool *pool);
+@@ -71,6 +61,8 @@ int vpool_truncate(struct vpool *pool,
+
+ void vpool_export(struct vpool *pool, void **buf, size_t *size);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* !_VPOOL_H_ */
+--
+2.14.2
+
diff --git a/pkg/libsignal-protocol-c/rev b/pkg/libsignal-protocol-c/rev
@@ -0,0 +1 @@
+1
diff --git a/pkg/libsignal-protocol-c/src b/pkg/libsignal-protocol-c/src
@@ -0,0 +1 @@
+Subproject commit 431b18a0eabc354aa0191cbcf26f1be61f9e000e