diff options
author | Marvin W <git@larma.de> | 2017-04-23 10:01:40 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-04-26 21:48:53 +0200 |
commit | eddf17c68274c3e8ecf86a13858243159ffe9714 (patch) | |
tree | db92b3ea3ffd453a16df9e53d0b454d172b8c8f2 /plugins | |
parent | 3eb9aa0fa79ea9fcebb5f702f81c2e54aafdc8cc (diff) | |
download | dino-eddf17c68274c3e8ecf86a13858243159ffe9714.tar.gz dino-eddf17c68274c3e8ecf86a13858243159ffe9714.zip |
cmake/signal-protocol: shared lib, mark_as_advanced and others
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gpgme-vala/CMakeLists.txt | 13 | ||||
-rw-r--r-- | plugins/omemo/CMakeLists.txt | 2 | ||||
-rw-r--r-- | plugins/openpgp/CMakeLists.txt | 2 | ||||
-rw-r--r-- | plugins/signal-protocol/CMakeLists.txt | 98 | ||||
-rw-r--r-- | plugins/signal-protocol/src/signal_helper.c | 2 | ||||
-rw-r--r-- | plugins/signal-protocol/src/signal_helper.h | 4 | ||||
-rw-r--r-- | plugins/signal-protocol/vapi/signal-protocol-native.vapi | 48 | ||||
-rw-r--r-- | plugins/signal-protocol/vapi/signal-protocol-public.vapi | 54 |
8 files changed, 115 insertions, 108 deletions
diff --git a/plugins/gpgme-vala/CMakeLists.txt b/plugins/gpgme-vala/CMakeLists.txt index 14cef3d2..ed1f57d0 100644 --- a/plugins/gpgme-vala/CMakeLists.txt +++ b/plugins/gpgme-vala/CMakeLists.txt @@ -20,12 +20,6 @@ GENERATE_HEADER gpgme-vala ) -set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src) -add_definitions(${CFLAGS}) -add_library(gpgme-vala ${GPGME_VALA_C} src/gpgme_fix.c) -target_link_libraries(gpgme-vala ${GPGME_VALA_PACKAGES} gpgme) -set_property(TARGET gpgme-vala PROPERTY POSITION_INDEPENDENT_CODE ON) - add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h" COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/src/gpgme_fix.h" "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h" @@ -49,3 +43,10 @@ DEPENDS ${CMAKE_BINARY_DIR}/exports/gpgme.vapi ) +set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src) +add_definitions(${CFLAGS}) +add_library(gpgme-vala ${GPGME_VALA_C} src/gpgme_fix.c) +add_dependencies(gpgme-vala gpgme-vapi) +target_link_libraries(gpgme-vala ${GPGME_VALA_PACKAGES} gpgme) +set_property(TARGET gpgme-vala PROPERTY POSITION_INDEPENDENT_CODE ON) + diff --git a/plugins/omemo/CMakeLists.txt b/plugins/omemo/CMakeLists.txt index ed9cfd22..919c569d 100644 --- a/plugins/omemo/CMakeLists.txt +++ b/plugins/omemo/CMakeLists.txt @@ -38,7 +38,7 @@ PACKAGES add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\") add_library(omemo SHARED ${OMEMO_VALA_C}) -add_dependencies(omemo dino-vapi signal-protocol-vapi ${GETTEXT_PACKAGE}-translations) +add_dependencies(omemo ${GETTEXT_PACKAGE}-translations) target_link_libraries(omemo libdino signal-protocol-vala ${OMEMO_PACKAGES}) set_target_properties(omemo PROPERTIES PREFIX "") set_target_properties(omemo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) diff --git a/plugins/openpgp/CMakeLists.txt b/plugins/openpgp/CMakeLists.txt index b207dc4f..868a3040 100644 --- a/plugins/openpgp/CMakeLists.txt +++ b/plugins/openpgp/CMakeLists.txt @@ -50,7 +50,7 @@ GRESOURCES add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\") add_library(openpgp SHARED ${OPENPGP_VALA_C} ${OPENPGP_GRESOURCES_TARGET}) -add_dependencies(openpgp dino-vapi gpgme-vapi ${GETTEXT_PACKAGE}-translations) +add_dependencies(openpgp ${GETTEXT_PACKAGE}-translations) target_link_libraries(openpgp libdino gpgme-vala ${OPENPGP_PACKAGES}) set_target_properties(openpgp PROPERTIES PREFIX "") set_target_properties(openpgp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) diff --git a/plugins/signal-protocol/CMakeLists.txt b/plugins/signal-protocol/CMakeLists.txt index 66866ad9..4c619c86 100644 --- a/plugins/signal-protocol/CMakeLists.txt +++ b/plugins/signal-protocol/CMakeLists.txt @@ -1,8 +1,3 @@ -add_subdirectory(libsignal-protocol-c EXCLUDE_FROM_ALL) -set_property(TARGET curve25519 PROPERTY POSITION_INDEPENDENT_CODE ON) -set_property(TARGET protobuf-c PROPERTY POSITION_INDEPENDENT_CODE ON) -set_property(TARGET signal-protocol-c PROPERTY POSITION_INDEPENDENT_CODE ON) - find_package(GCrypt REQUIRED) find_packages(SIGNAL_PROTOCOL_PACKAGES REQUIRED Gee @@ -30,50 +25,54 @@ GENERATE_HEADER signal-protocol-vala ) -set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src -I${CMAKE_CURRENT_SOURCE_DIR}/src) -add_definitions(${CFLAGS}) -add_library(signal-protocol-vala ${SIGNAL_PROTOCOL_VALA_C} ${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.c) -add_dependencies(signal-protocol-vala signal-protocol-c) -target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} gcrypt signal-protocol-c m) -set_property(TARGET signal-protocol-vala PROPERTY POSITION_INDEPENDENT_CODE ON) - -set(SIGNAL_PROTOCOL_C_HEADERS - signal_protocol.h - signal_protocol_types.h - curve.h - hkdf.h - ratchet.h - protocol.h - session_state.h - session_record.h - session_pre_key.h - session_builder.h - session_cipher.h - key_helper.h - sender_key.h - sender_key_state.h - sender_key_record.h - group_session_builder.h - group_cipher.h - fingerprint.h - device_consistency.h -) - set(C_HEADERS_SRC "") set(C_HEADERS_TARGET "") -foreach(f ${SIGNAL_PROTOCOL_C_HEADERS}) - list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}") - list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/${f}") - add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/${f}" - COMMAND - cp "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" "${CMAKE_BINARY_DIR}/exports/${f}" - DEPENDS - "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" - COMMENT - Copy header file ${f} +if((SHARED_SIGNAL_PROTOCOL) OR ($ENV{SHARED_SIGNAL_PROTOCOL})) + find_package(SignalProtocol REQUIRED) +else() + add_subdirectory(libsignal-protocol-c EXCLUDE_FROM_ALL) + set_property(TARGET curve25519 PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET protobuf-c PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET signal-protocol-c PROPERTY POSITION_INDEPENDENT_CODE ON) + + set(SIGNAL_PROTOCOL_C_HEADERS + signal_protocol.h + signal_protocol_types.h + curve.h + hkdf.h + ratchet.h + protocol.h + session_state.h + session_record.h + session_pre_key.h + session_builder.h + session_cipher.h + key_helper.h + sender_key.h + sender_key_state.h + sender_key_record.h + group_session_builder.h + group_cipher.h + fingerprint.h + device_consistency.h ) -endforeach(f) + + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/exports/signal") + + foreach(f ${SIGNAL_PROTOCOL_C_HEADERS}) + list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}") + list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/signal/${f}") + add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/signal/${f}" + COMMAND + cp "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" "${CMAKE_BINARY_DIR}/exports/signal/${f}" + DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" + COMMENT + Copy header file signal/${f} + ) + endforeach(f) +endif() list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.h") list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/signal_helper.h") @@ -102,6 +101,13 @@ DEPENDS ${C_HEADERS_TARGET} ) +set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src -I${CMAKE_CURRENT_SOURCE_DIR}/src) +add_definitions(${CFLAGS}) +add_library(signal-protocol-vala ${SIGNAL_PROTOCOL_VALA_C} ${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.c) +add_dependencies(signal-protocol-vala signal-protocol-vapi) +target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} gcrypt signal-protocol-c m) +set_property(TARGET signal-protocol-vala PROPERTY POSITION_INDEPENDENT_CODE ON) + if(BUILD_TESTS) vala_precompile(SIGNAL_TEST_VALA_C SOURCES @@ -121,6 +127,6 @@ if(BUILD_TESTS) set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_BINARY_DIR}/signal-protocol) add_executable(signal-protocol-vala-test ${SIGNAL_TEST_VALA_C}) - add_dependencies(signal-protocol-vala-test signal-protocol-vala signal-protocol-vapi) + add_dependencies(signal-protocol-vala-test signal-protocol-vala) target_link_libraries(signal-protocol-vala-test signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES}) endif(BUILD_TESTS)
\ No newline at end of file diff --git a/plugins/signal-protocol/src/signal_helper.c b/plugins/signal-protocol/src/signal_helper.c index f39c4a5c..21935181 100644 --- a/plugins/signal-protocol/src/signal_helper.c +++ b/plugins/signal-protocol/src/signal_helper.c @@ -353,4 +353,4 @@ void setup_signal_vala_crypto_provider(signal_context *context) }; signal_context_set_crypto_provider(context, &provider); -}
\ No newline at end of file +} diff --git a/plugins/signal-protocol/src/signal_helper.h b/plugins/signal-protocol/src/signal_helper.h index 4319bce6..819b399b 100644 --- a/plugins/signal-protocol/src/signal_helper.h +++ b/plugins/signal-protocol/src/signal_helper.h @@ -1,7 +1,7 @@ #ifndef SIGNAL_PROTOCOL_VALA_HELPER #define SIGNAL_PROTOCOL_VALA_HELPER 1 -#include <signal_protocol.h> +#include <signal/signal_protocol.h> #include <string.h> #include <glib.h> @@ -44,4 +44,4 @@ int signal_vala_decrypt(signal_buffer **output, void *user_data); void setup_signal_vala_crypto_provider(signal_context *context); -#endif
\ No newline at end of file +#endif diff --git a/plugins/signal-protocol/vapi/signal-protocol-native.vapi b/plugins/signal-protocol/vapi/signal-protocol-native.vapi index b9ba6a31..ed391020 100644 --- a/plugins/signal-protocol/vapi/signal-protocol-native.vapi +++ b/plugins/signal-protocol/vapi/signal-protocol-native.vapi @@ -1,6 +1,6 @@ namespace Signal { [Compact] - [CCode (cname = "signal_context", cprefix="signal_context_", free_function="signal_context_destroy", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_context", cprefix="signal_context_", free_function="signal_context_destroy", cheader_filename = "signal/signal_protocol.h")] public class NativeContext { public static int create(out NativeContext context, void* user_data); public int set_crypto_provider(NativeCryptoProvider crypto_provider); @@ -13,7 +13,7 @@ namespace Signal { public delegate void LogFunc(LogLevel level, string message, void* user_data); [Compact] - [CCode (cname = "signal_crypto_provider", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_crypto_provider", cheader_filename = "signal/signal_protocol.h")] public struct NativeCryptoProvider { public RandomFunc random_func; public HmacSha256Init hmac_sha256_init_func; @@ -50,7 +50,7 @@ namespace Signal { public delegate int CryptFunc(out Buffer output, Cipher cipher, uint8[] key, uint8[] iv, uint8[] content, void* user_data); [Compact] - [CCode (cname = "signal_protocol_session_store", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_protocol_session_store", cheader_filename = "signal/signal_protocol.h")] public struct NativeSessionStore { public LoadSessionFunc load_session_func; public GetSubDeviceSessionsFunc get_sub_device_sessions_func; @@ -75,7 +75,7 @@ namespace Signal { public delegate int DeleteAllSessionsFunc(char[] name, void* user_data); [Compact] - [CCode (cname = "signal_protocol_identity_key_store", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_protocol_identity_key_store", cheader_filename = "signal/signal_protocol.h")] public struct NativeIdentityKeyStore { GetIdentityKeyPairFunc get_identity_key_pair; GetLocalRegistrationIdFunc get_local_registration_id; @@ -94,7 +94,7 @@ namespace Signal { public delegate int IsTrustedIdentityFunc(Address address, uint8[] key, void* user_data); [Compact] - [CCode (cname = "signal_protocol_pre_key_store", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_protocol_pre_key_store", cheader_filename = "signal/signal_protocol.h")] public struct NativePreKeyStore { LoadPreKeyFunc load_pre_key; StorePreKeyFunc store_pre_key; @@ -114,7 +114,7 @@ namespace Signal { [Compact] - [CCode (cname = "signal_protocol_signed_pre_key_store", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_protocol_signed_pre_key_store", cheader_filename = "signal/signal_protocol.h")] public struct NativeSignedPreKeyStore { LoadPreKeyFunc load_signed_pre_key; StorePreKeyFunc store_signed_pre_key; @@ -142,7 +142,7 @@ namespace Signal { public delegate int DestroyFunc(void* user_data); [Compact] - [CCode (cname = "signal_protocol_store_context", cprefix = "signal_protocol_store_context_", free_function="signal_protocol_store_context_destroy", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_protocol_store_context", cprefix = "signal_protocol_store_context_", free_function="signal_protocol_store_context_destroy", cheader_filename = "signal/signal_protocol.h")] public class NativeStoreContext { public static int create(out NativeStoreContext context, NativeContext global_context); public int set_session_store(NativeSessionStore store); @@ -153,7 +153,7 @@ namespace Signal { } - [CCode (cheader_filename = "signal_protocol.h")] + [CCode (cheader_filename = "signal/signal_protocol.h")] namespace Protocol { /** @@ -201,7 +201,7 @@ namespace Signal { public int is_trusted_identity(NativeStoreContext store_context, Address address, ECPublicKey identity_key); } - [CCode (cheader_filename = "key_helper.h", cprefix = "signal_protocol_key_helper_")] + [CCode (cheader_filename = "signal/key_helper.h", cprefix = "signal_protocol_key_helper_")] namespace KeyHelper { [Compact] [CCode (cname = "signal_protocol_key_helper_pre_key_list_node", cprefix = "signal_protocol_key_helper_key_list_", free_function="signal_protocol_key_helper_key_list_free")] @@ -222,7 +222,7 @@ namespace Signal { } } - [CCode (cheader_filename = "curve.h")] + [CCode (cheader_filename = "signal/curve.h")] namespace Curve { [CCode (cname = "curve_calculate_agreement")] public int calculate_agreement([CCode (array_length = false)] out uint8[] shared_key_data, ECPublicKey public_key, ECPrivateKey private_key); @@ -232,35 +232,35 @@ namespace Signal { public int verify_signature(ECPublicKey signing_key, uint8[] message, uint8[] signature); } - [CCode (cname = "session_builder_create", cheader_filename = "session_builder.h")] + [CCode (cname = "session_builder_create", cheader_filename = "signal/session_builder.h")] public static int session_builder_create(out SessionBuilder builder, NativeStoreContext store, Address remote_address, NativeContext global_context); - [CCode (cname = "session_cipher_create", cheader_filename = "session_cipher.h")] + [CCode (cname = "session_cipher_create", cheader_filename = "signal/session_cipher.h")] public static int session_cipher_create(out SessionCipher cipher, NativeStoreContext store, Address remote_address, NativeContext global_context); - [CCode (cname = "pre_key_signal_message_deserialize", cheader_filename = "protocol.h")] + [CCode (cname = "pre_key_signal_message_deserialize", cheader_filename = "signal/protocol.h")] public static int pre_key_signal_message_deserialize(out PreKeySignalMessage message, uint8[] data, NativeContext global_context); - [CCode (cname = "pre_key_signal_message_copy", cheader_filename = "protocol.h")] + [CCode (cname = "pre_key_signal_message_copy", cheader_filename = "signal/protocol.h")] public static int pre_key_signal_message_copy(out PreKeySignalMessage message, PreKeySignalMessage other_message, NativeContext global_context); - [CCode (cname = "signal_message_create", cheader_filename = "protocol.h")] + [CCode (cname = "signal_message_create", cheader_filename = "signal/protocol.h")] public static int signal_message_create(out SignalMessage message, uint8 message_version, uint8[] mac_key, ECPublicKey sender_ratchet_key, uint32 counter, uint32 previous_counter, uint8[] ciphertext, ECPublicKey sender_identity_key, ECPublicKey receiver_identity_key, NativeContext global_context); - [CCode (cname = "signal_message_deserialize", cheader_filename = "protocol.h")] + [CCode (cname = "signal_message_deserialize", cheader_filename = "signal/protocol.h")] public static int signal_message_deserialize(out SignalMessage message, uint8[] data, NativeContext global_context); - [CCode (cname = "signal_message_copy", cheader_filename = "protocol.h")] + [CCode (cname = "signal_message_copy", cheader_filename = "signal/protocol.h")] public static int signal_message_copy(out SignalMessage message, SignalMessage other_message, NativeContext global_context); - [CCode (cname = "curve_generate_key_pair", cheader_filename = "curve.h")] + [CCode (cname = "curve_generate_key_pair", cheader_filename = "signal/curve.h")] public static int curve_generate_key_pair(NativeContext context, out ECKeyPair key_pair); - [CCode (cname = "curve_decode_private_point", cheader_filename = "curve.h")] + [CCode (cname = "curve_decode_private_point", cheader_filename = "signal/curve.h")] public static int curve_decode_private_point(out ECPrivateKey public_key, uint8[] key, NativeContext global_context); - [CCode (cname = "curve_decode_point", cheader_filename = "curve.h")] + [CCode (cname = "curve_decode_point", cheader_filename = "signal/curve.h")] public static int curve_decode_point(out ECPublicKey public_key, uint8[] key, NativeContext global_context); - [CCode (cname = "curve_generate_private_key", cheader_filename = "curve.h")] + [CCode (cname = "curve_generate_private_key", cheader_filename = "signal/curve.h")] public static int curve_generate_private_key(NativeContext context, out ECPrivateKey private_key); - [CCode (cname = "ratchet_identity_key_pair_deserialize", cheader_filename = "ratchet.h")] + [CCode (cname = "ratchet_identity_key_pair_deserialize", cheader_filename = "signal/ratchet.h")] public static int ratchet_identity_key_pair_deserialize(out IdentityKeyPair key_pair, uint8[] data, NativeContext global_context); - [CCode (cname = "session_signed_pre_key_deserialize", cheader_filename = "signed_pre_key.h")] + [CCode (cname = "session_signed_pre_key_deserialize", cheader_filename = "signal/signed_pre_key.h")] public static int session_signed_pre_key_deserialize(out SignedPreKeyRecord pre_key, uint8[] data, NativeContext global_context); [Compact] - [CCode (cname = "hkdf_context", cprefix = "hkdf_", free_function = "hkdf_destroy", cheader_filename = "hkdf.h")] + [CCode (cname = "hkdf_context", cprefix = "hkdf_", free_function = "hkdf_destroy", cheader_filename = "signal/hkdf.h")] public class NativeHkdfContext { public static int create(out NativeHkdfContext context, int message_version, NativeContext global_context); public int compare(NativeHkdfContext other); diff --git a/plugins/signal-protocol/vapi/signal-protocol-public.vapi b/plugins/signal-protocol/vapi/signal-protocol-public.vapi index acdf36a3..bb22bdaa 100644 --- a/plugins/signal-protocol/vapi/signal-protocol-public.vapi +++ b/plugins/signal-protocol/vapi/signal-protocol-public.vapi @@ -1,6 +1,6 @@ namespace Signal { - [CCode (cname = "int", cprefix = "SG_ERR_", cheader_filename = "signal_protocol.h", has_type_id = false)] + [CCode (cname = "int", cprefix = "SG_ERR_", cheader_filename = "signal/signal_protocol.h", has_type_id = false)] public enum ErrorCode { [CCode (cname = "SG_SUCCESS")] SUCCESS, @@ -23,10 +23,10 @@ namespace Signal { FP_IDENT_MISMATCH; } - [CCode (cname = "SG_ERR_MINIMUM", cheader_filename = "signal_protocol.h")] + [CCode (cname = "SG_ERR_MINIMUM", cheader_filename = "signal/signal_protocol.h")] public const int MIN_ERROR_CODE; - [CCode (cname = "int", cprefix = "SG_LOG_", cheader_filename = "signal_protocol.h", has_type_id = false)] + [CCode (cname = "int", cprefix = "SG_LOG_", cheader_filename = "signal/signal_protocol.h", has_type_id = false)] public enum LogLevel { ERROR, WARNING, @@ -35,7 +35,7 @@ namespace Signal { DEBUG } - [CCode (cname = "signal_throw_gerror_by_code_", cheader_filename = "signal_protocol.h")] + [CCode (cname = "signal_throw_gerror_by_code_", cheader_filename = "signal/signal_protocol.h")] private int throw_by_code(int code, string? message = null) throws GLib.Error { if (code < 0 && code > MIN_ERROR_CODE) { throw new GLib.Error(-1, code, "%s: %s", message ?? "Signal error", ((ErrorCode)code).to_string()); @@ -43,7 +43,7 @@ namespace Signal { return code; } - [CCode (cname = "int", cprefix = "SG_CIPHER_", cheader_filename = "signal_protocol.h", has_type_id = false)] + [CCode (cname = "int", cprefix = "SG_CIPHER_", cheader_filename = "signal/signal_protocol.h", has_type_id = false)] public enum Cipher { AES_CTR_NOPADDING, AES_CBC_PKCS5, @@ -51,12 +51,12 @@ namespace Signal { } [Compact] - [CCode (cname = "signal_type_base", ref_function="signal_type_ref_vapi", unref_function="signal_type_unref_vapi", cheader_filename="signal_protocol_types.h,signal_helper.h")] + [CCode (cname = "signal_type_base", ref_function="signal_type_ref_vapi", unref_function="signal_type_unref_vapi", cheader_filename="signal/signal_protocol_types.h,signal_helper.h")] public class TypeBase { } [Compact] - [CCode (cname = "signal_buffer", cheader_filename = "signal_protocol_types.h", free_function="signal_buffer_free")] + [CCode (cname = "signal_buffer", cheader_filename = "signal/signal_protocol_types.h", free_function="signal_buffer_free")] public class Buffer { [CCode (cname = "signal_buffer_alloc")] public Buffer(size_t len); @@ -78,7 +78,7 @@ namespace Signal { } [Compact] - [CCode (cname = "signal_int_list", cheader_filename = "signal_protocol_types.h", free_function="signal_int_list_free")] + [CCode (cname = "signal_int_list", cheader_filename = "signal/signal_protocol_types.h", free_function="signal_int_list_free")] public class IntList { [CCode (cname = "signal_int_list_alloc")] public IntList(); @@ -90,7 +90,7 @@ namespace Signal { } [Compact] - [CCode (cname = "session_builder", cprefix = "session_builder_", free_function="session_builder_free", cheader_filename = "session_builder.h")] + [CCode (cname = "session_builder", cprefix = "session_builder_", free_function="session_builder_free", cheader_filename = "signal/session_builder.h")] public class SessionBuilder { [CCode (cname = "session_builder_process_pre_key_bundle")] private int process_pre_key_bundle_(PreKeyBundle pre_key_bundle); @@ -101,7 +101,7 @@ namespace Signal { } [Compact] - [CCode (cname = "session_pre_key_bundle", cprefix = "session_pre_key_bundle_", cheader_filename = "session_pre_key.h")] + [CCode (cname = "session_pre_key_bundle", cprefix = "session_pre_key_bundle_", cheader_filename = "signal/session_pre_key.h")] public class PreKeyBundle : TypeBase { public static int create(out PreKeyBundle bundle, uint32 registration_id, int device_id, uint32 pre_key_id, ECPublicKey? pre_key_public, uint32 signed_pre_key_id, ECPublicKey? signed_pre_key_public, uint8[]? signed_pre_key_signature, ECPublicKey? identity_key); @@ -116,7 +116,7 @@ namespace Signal { } [Compact] - [CCode (cname = "session_pre_key", cprefix = "session_pre_key_", cheader_filename = "session_pre_key.h,signal_helper.h")] + [CCode (cname = "session_pre_key", cprefix = "session_pre_key_", cheader_filename = "signal/session_pre_key.h,signal_helper.h")] public class PreKeyRecord : TypeBase { public PreKeyRecord(uint32 id, ECKeyPair key_pair) throws GLib.Error { int err; @@ -134,13 +134,13 @@ namespace Signal { } [Compact] - [CCode (cname = "session_record", cprefix = "session_record_", cheader_filename = "signal_protocol_types.h")] + [CCode (cname = "session_record", cprefix = "session_record_", cheader_filename = "signal/signal_protocol_types.h")] public class SessionRecord : TypeBase { public SessionState state { get; } } [Compact] - [CCode (cname = "session_state", cprefix = "session_state_", cheader_filename = "session_state.h")] + [CCode (cname = "session_state", cprefix = "session_state_", cheader_filename = "signal/session_state.h")] public class SessionState : TypeBase { //public static int create(out SessionState state, NativeContext context); //public static int deserialize(out SessionState state, uint8[] data, NativeContext context); @@ -163,7 +163,7 @@ namespace Signal { } [Compact] - [CCode (cname = "session_signed_pre_key", cprefix = "session_signed_pre_key_", cheader_filename = "session_pre_key.h")] + [CCode (cname = "session_signed_pre_key", cprefix = "session_signed_pre_key_", cheader_filename = "signal/session_pre_key.h")] public class SignedPreKeyRecord : TypeBase { public SignedPreKeyRecord(uint32 id, uint64 timestamp, ECKeyPair key_pair, uint8[] signature) throws GLib.Error { int err; @@ -190,7 +190,7 @@ namespace Signal { * Address of an Signal Protocol message recipient */ [Compact] - [CCode (cname = "signal_protocol_address", cprefix = "signal_protocol_address_", cheader_filename = "signal_protocol.h,signal_helper.h")] + [CCode (cname = "signal_protocol_address", cprefix = "signal_protocol_address_", cheader_filename = "signal/signal_protocol.h,signal_helper.h")] public class Address { public Address(string name, int32 device_id); public int32 device_id { get; set; } @@ -210,7 +210,7 @@ namespace Signal { } [Compact] - [CCode (cname = "ec_public_key", cprefix = "ec_public_key_", cheader_filename = "curve.h,signal_helper.h")] + [CCode (cname = "ec_public_key", cprefix = "ec_public_key_", cheader_filename = "signal/curve.h,signal_helper.h")] public class ECPublicKey : TypeBase { [CCode (cname = "curve_generate_public_key")] public static int generate(out ECPublicKey public_key, ECPrivateKey private_key); @@ -227,7 +227,7 @@ namespace Signal { } [Compact] - [CCode (cname = "ec_private_key", cprefix = "ec_private_key_", cheader_filename = "curve.h,signal_helper.h")] + [CCode (cname = "ec_private_key", cprefix = "ec_private_key_", cheader_filename = "signal/curve.h,signal_helper.h")] public class ECPrivateKey : TypeBase { [CCode (instance_pos = 1, cname = "ec_private_key_serialize")] private int serialize_([CCode (pos = 0)] out Buffer buffer); @@ -241,19 +241,19 @@ namespace Signal { } [Compact] - [CCode (cname = "ec_key_pair", cprefix="ec_key_pair_", cheader_filename = "curve.h,signal_helper.h")] + [CCode (cname = "ec_key_pair", cprefix="ec_key_pair_", cheader_filename = "signal/curve.h,signal_helper.h")] public class ECKeyPair : TypeBase { public static int create(out ECKeyPair key_pair, ECPublicKey public_key, ECPrivateKey private_key); public ECPublicKey public { get; } public ECPrivateKey private { get; } } - [CCode (cname = "ratchet_message_keys", cheader_filename = "ratchet.h")] + [CCode (cname = "ratchet_message_keys", cheader_filename = "signal/ratchet.h")] public class MessageKeys { } [Compact] - [CCode (cname = "ratchet_identity_key_pair", cprefix = "ratchet_identity_key_pair_", cheader_filename = "ratchet.h,signal_helper.h")] + [CCode (cname = "ratchet_identity_key_pair", cprefix = "ratchet_identity_key_pair_", cheader_filename = "signal/ratchet.h,signal_helper.h")] public class IdentityKeyPair : TypeBase { public static int create(out IdentityKeyPair key_pair, ECPublicKey public_key, ECPrivateKey private_key); public int serialze(out Buffer buffer); @@ -273,7 +273,7 @@ namespace Signal { * that session. */ [Compact] - [CCode (cname = "session_cipher", cprefix = "session_cipher_", cheader_filename = "session_cipher.h", free_function = "session_cipher_free")] + [CCode (cname = "session_cipher", cprefix = "session_cipher_", cheader_filename = "signal/session_cipher.h", free_function = "session_cipher_free")] public class SessionCipher { public void* user_data { get; set; } public DecryptionCallback decryption_callback { set; } @@ -308,7 +308,7 @@ namespace Signal { public delegate int DecryptionCallback(SessionCipher cipher, Buffer plaintext, void* decrypt_context); } - [CCode (cname = "int", cheader_filename = "protocol.h", has_type_id = false)] + [CCode (cname = "int", cheader_filename = "signal/protocol.h", has_type_id = false)] public enum CiphertextType { [CCode (cname = "CIPHERTEXT_SIGNAL_TYPE")] SIGNAL, @@ -321,7 +321,7 @@ namespace Signal { } [Compact] - [CCode (cname = "ciphertext_message", cprefix = "ciphertext_message_", cheader_filename = "protocol.h,signal_helper.h")] + [CCode (cname = "ciphertext_message", cprefix = "ciphertext_message_", cheader_filename = "signal/protocol.h,signal_helper.h")] public abstract class CiphertextMessage : TypeBase { public CiphertextType type { get; } [CCode (cname = "ciphertext_message_get_serialized")] @@ -331,7 +331,7 @@ namespace Signal { }} } [Compact] - [CCode (cname = "signal_message", cprefix = "signal_message_", cheader_filename = "protocol.h,signal_helper.h")] + [CCode (cname = "signal_message", cprefix = "signal_message_", cheader_filename = "signal/protocol.h,signal_helper.h")] public class SignalMessage : CiphertextMessage { public ECPublicKey sender_ratchet_key { get; } public uint8 message_version { get; } @@ -341,7 +341,7 @@ namespace Signal { public static int is_legacy(uint8[] data); } [Compact] - [CCode (cname = "pre_key_signal_message", cprefix = "pre_key_signal_message_", cheader_filename = "protocol.h,signal_helper.h")] + [CCode (cname = "pre_key_signal_message", cprefix = "pre_key_signal_message_", cheader_filename = "signal/protocol.h,signal_helper.h")] public class PreKeySignalMessage : CiphertextMessage { public uint8 message_version { get; } public ECPublicKey identity_key { get; } @@ -352,14 +352,14 @@ namespace Signal { public SignalMessage signal_message { get; } } [Compact] - [CCode (cname = "sender_key_message", cprefix = "sender_key_message_", cheader_filename = "protocol.h,signal_helper.h")] + [CCode (cname = "sender_key_message", cprefix = "sender_key_message_", cheader_filename = "signal/protocol.h,signal_helper.h")] public class SenderKeyMessage : CiphertextMessage { public uint32 key_id { get; } public uint32 iteration { get; } public Buffer ciphertext { get; } } [Compact] - [CCode (cname = "sender_key_distribution_message", cprefix = "sender_key_distribution_message_", cheader_filename = "protocol.h,signal_helper.h")] + [CCode (cname = "sender_key_distribution_message", cprefix = "sender_key_distribution_message_", cheader_filename = "signal/protocol.h,signal_helper.h")] public class SenderKeyDistributionMessage : CiphertextMessage { public uint32 id { get; } public uint32 iteration { get; } |