diff options
| author | Marvin W <git@larma.de> | 2026-08-22 19:03:26 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2026-10-23 16:58:30 +0200 |
| commit | b0456e13ed35e6ebf684b3a7f4d1cb4b6ec352cc (patch) | |
| tree | 5ecd70a986a08c1cf9984bdda97a9cc8c05255af | |
| parent | 76a91fca2fc7dd5975e8ff0e6695f27c98539dba (diff) | |
Move crypto-vala inside libdino
| -rw-r--r-- | crypto-vala/crypto-vala.deps | 2 | ||||
| -rw-r--r-- | crypto-vala/meson.build | 34 | ||||
| -rw-r--r-- | libdino/dino.deps | 1 | ||||
| -rw-r--r-- | libdino/meson.build | 25 | ||||
| -rw-r--r-- | libdino/src/crypto/cipher.vala (renamed from crypto-vala/src/cipher.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/cipher_converter.vala (renamed from crypto-vala/src/cipher_converter.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/error.vala (renamed from crypto-vala/src/error.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/gnu/cipher.vala (renamed from crypto-vala/src/cipher_gcrypt.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/gnu/utils.vala (renamed from crypto-vala/src/gcrypt.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/openssl/cipher.vala (renamed from crypto-vala/src/cipher_openssl.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/openssl/utils.vala (renamed from crypto-vala/src/openssl.vala) | 2 | ||||
| -rw-r--r-- | libdino/src/crypto/srtp.vala (renamed from crypto-vala/src/srtp.vala) | 2 | ||||
| -rw-r--r-- | libdino/vapi/libgcrypt.vapi (renamed from crypto-vala/vapi/libgcrypt.vapi) | 0 | ||||
| -rw-r--r-- | libdino/vapi/libsrtp2.vapi (renamed from crypto-vala/vapi/libsrtp2.vapi) | 0 | ||||
| -rw-r--r-- | libdino/vapi/openssl.vapi (renamed from crypto-vala/vapi/openssl.vapi) | 0 | ||||
| -rw-r--r-- | meson.build | 32 | ||||
| -rw-r--r-- | meson_options.txt | 2 | ||||
| -rw-r--r-- | plugins/ice/meson.build | 5 | ||||
| -rw-r--r-- | plugins/omemo/meson.build | 5 | ||||
| -rw-r--r-- | plugins/omemo/src/file_transfer/file_decryptor.vala | 2 | ||||
| -rw-r--r-- | plugins/omemo/src/file_transfer/file_encryptor.vala | 2 | ||||
| -rw-r--r-- | plugins/omemo/src/jingle/jet_omemo.vala | 2 | ||||
| -rw-r--r-- | plugins/rtp/meson.build | 1 |
23 files changed, 54 insertions, 75 deletions
diff --git a/crypto-vala/crypto-vala.deps b/crypto-vala/crypto-vala.deps deleted file mode 100644 index c029e7af..00000000 --- a/crypto-vala/crypto-vala.deps +++ /dev/null @@ -1,2 +0,0 @@ -gio-2.0 -glib-2.0 diff --git a/crypto-vala/meson.build b/crypto-vala/meson.build deleted file mode 100644 index bc66fbf9..00000000 --- a/crypto-vala/meson.build +++ /dev/null @@ -1,34 +0,0 @@ -dependencies = [ - dep_gio, - dep_glib, - dep_libsrtp2, -] -sources = files( - 'src/cipher.vala', - 'src/cipher_converter.vala', - 'src/error.vala', - 'src/srtp.vala', -) -c_args = vala_c_args + [ - '-DG_LOG_DOMAIN="crypto-vala"', -] -vala_args = [ - '--vapidir', meson.current_source_dir() / 'vapi', -] -if crypto_backend == 'gnutls' - dependencies += [ dep_libgcrypt ] - sources += files( - 'src/gcrypt.vala', - 'src/cipher_gcrypt.vala', - ) -else # openssl - dependencies += [ dep_openssl ] - sources += files( - 'src/openssl.vala', - 'src/cipher_openssl.vala', - ) -endif -lib_crypto_vala = library('crypto-vala', sources, c_args: c_args, vala_args: vala_args, dependencies: dependencies, version: '0.0', install: true, install_dir: [true, true, true], install_rpath: default_install_rpath) -dep_crypto_vala = declare_dependency(link_with: lib_crypto_vala, include_directories: include_directories('.')) - -install_data('crypto-vala.deps', install_dir: get_option('datadir') / 'vala/vapi', install_tag: 'devel') # TODO: workaround for https://github.com/mesonbuild/meson/issues/9756 diff --git a/libdino/dino.deps b/libdino/dino.deps index 372dc9bf..bef3fb2a 100644 --- a/libdino/dino.deps +++ b/libdino/dino.deps @@ -1,4 +1,5 @@ gee-0.8 +gio-2.0 glib-2.0 gmodule-2.0 qlite diff --git a/libdino/meson.build b/libdino/meson.build index 6124931d..dbaddf56 100644 --- a/libdino/meson.build +++ b/libdino/meson.build @@ -8,6 +8,7 @@ dependencies = [ dep_glib, dep_gmodule, dep_libsoup, + dep_libsrtp2, dep_qlite, dep_xmpp_vala ] @@ -16,6 +17,10 @@ sources = files( 'src/dbus/login1.vala', 'src/dbus/notifications.vala', 'src/dbus/upower.vala', + 'src/crypto/cipher.vala', + 'src/crypto/cipher_converter.vala', + 'src/crypto/error.vala', + 'src/crypto/srtp.vala', 'src/entity/account.vala', 'src/entity/call.vala', 'src/entity/conversation.vala', @@ -73,13 +78,31 @@ sources = files( 'src/util/util.vala', 'src/util/weak_timeout.vala', ) + sources += [version_c] + +if crypto_backend == 'gnu' + dependencies += [ dep_libgcrypt ] + sources += files( + 'src/crypto/gnu/cipher.vala', + 'src/crypto/gnu/utils.vala', + ) +elif crypto_backend == 'openssl' + dependencies += [ dep_openssl ] + sources += files( + 'src/crypto/openssl/cipher.vala', + 'src/crypto/openssl/utils.vala', + ) +endif + c_args = vala_c_args + [ '-DDINO_SYSTEM_LIBDIR_NAME="@0@"'.format(get_option('prefix') / get_option('libdir')), '-DDINO_SYSTEM_PLUGIN_DIR="@0@"'.format(get_option('prefix') / get_option('libdir') / get_option('plugindir')), '-DG_LOG_DOMAIN="libdino"', ] -vala_args = [] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] if meson.get_compiler('vala').version().version_compare('=0.56.11') vala_args += ['-D', 'VALA_0_56_11'] endif diff --git a/crypto-vala/src/cipher.vala b/libdino/src/crypto/cipher.vala index f7aee100..89282144 100644 --- a/crypto-vala/src/cipher.vala +++ b/libdino/src/crypto/cipher.vala @@ -1,4 +1,4 @@ -namespace Crypto { +namespace Dino.Crypto { public interface SymmetricCipher { public abstract void set_key(uint8[] key) throws Error; diff --git a/crypto-vala/src/cipher_converter.vala b/libdino/src/crypto/cipher_converter.vala index 49e7af71..c2404c6d 100644 --- a/crypto-vala/src/cipher_converter.vala +++ b/libdino/src/crypto/cipher_converter.vala @@ -1,6 +1,6 @@ using GLib; -namespace Crypto { +namespace Dino.Crypto { public class SymmetricCipherEncrypter : Converter, Object { private SymmetricCipherEncryption cipher; diff --git a/crypto-vala/src/error.vala b/libdino/src/crypto/error.vala index a26f39c3..2458ae4a 100644 --- a/crypto-vala/src/error.vala +++ b/libdino/src/crypto/error.vala @@ -1,4 +1,4 @@ -namespace Crypto { +namespace Dino.Crypto { public errordomain Error { ILLEGAL_ARGUMENTS, diff --git a/crypto-vala/src/cipher_gcrypt.vala b/libdino/src/crypto/gnu/cipher.vala index 3e811d29..41f15837 100644 --- a/crypto-vala/src/cipher_gcrypt.vala +++ b/libdino/src/crypto/gnu/cipher.vala @@ -1,4 +1,4 @@ -namespace Crypto { +namespace Dino.Crypto { internal class SymmetricCipherGcrypt : SymmetricCipher, SymmetricCipherEncryption, SymmetricCipherDecryption, Object { private GCrypt.Cipher.Cipher cipher; diff --git a/crypto-vala/src/gcrypt.vala b/libdino/src/crypto/gnu/utils.vala index 1997a5e1..8a25ab27 100644 --- a/crypto-vala/src/gcrypt.vala +++ b/libdino/src/crypto/gnu/utils.vala @@ -1,4 +1,4 @@ -namespace Crypto { +namespace Dino.Crypto { public static void randomize(uint8[] buffer) { GCrypt.Random.randomize(buffer); diff --git a/crypto-vala/src/cipher_openssl.vala b/libdino/src/crypto/openssl/cipher.vala index 75a0ef9a..02064770 100644 --- a/crypto-vala/src/cipher_openssl.vala +++ b/libdino/src/crypto/openssl/cipher.vala @@ -1,4 +1,4 @@ -namespace Crypto { +namespace Dino.Crypto { internal class SymmetricCipherEncryptionOpenssl : SymmetricCipher, SymmetricCipherEncryption, Object { private OpenSSL.EVP.CipherContext? cipher; diff --git a/crypto-vala/src/openssl.vala b/libdino/src/crypto/openssl/utils.vala index 4a288467..7a9ed9b6 100644 --- a/crypto-vala/src/openssl.vala +++ b/libdino/src/crypto/openssl/utils.vala @@ -1,4 +1,4 @@ -namespace Crypto { +namespace Dino.Crypto { public static void randomize(uint8[] buffer) { OpenSSL.RAND.bytes(buffer); diff --git a/crypto-vala/src/srtp.vala b/libdino/src/crypto/srtp.vala index 22210e37..852dccdc 100644 --- a/crypto-vala/src/srtp.vala +++ b/libdino/src/crypto/srtp.vala @@ -1,6 +1,6 @@ using Srtp; -namespace Crypto.Srtp { +namespace Dino.Crypto.Srtp { public const string AES_CM_128_HMAC_SHA1_80 = "AES_CM_128_HMAC_SHA1_80"; public const string AES_CM_128_HMAC_SHA1_32 = "AES_CM_128_HMAC_SHA1_32"; public const string F8_128_HMAC_SHA1_80 = "F8_128_HMAC_SHA1_80"; diff --git a/crypto-vala/vapi/libgcrypt.vapi b/libdino/vapi/libgcrypt.vapi index 0fa69a02..0fa69a02 100644 --- a/crypto-vala/vapi/libgcrypt.vapi +++ b/libdino/vapi/libgcrypt.vapi diff --git a/crypto-vala/vapi/libsrtp2.vapi b/libdino/vapi/libsrtp2.vapi index f8f2d297..f8f2d297 100644 --- a/crypto-vala/vapi/libsrtp2.vapi +++ b/libdino/vapi/libsrtp2.vapi diff --git a/crypto-vala/vapi/openssl.vapi b/libdino/vapi/openssl.vapi index 87693d37..87693d37 100644 --- a/crypto-vala/vapi/openssl.vapi +++ b/libdino/vapi/openssl.vapi diff --git a/meson.build b/meson.build index 84597fd4..b9df102b 100644 --- a/meson.build +++ b/meson.build @@ -47,33 +47,28 @@ vala_c_args = cc.get_supported_arguments([ '-Wno-unused-variable', ]) -plugin_crypto = get_option('plugin-ice') -foreach plugin : ['plugin-ice', 'plugin-omemo', 'plugin-rtp'] - if get_option(plugin).enabled() and not plugin_crypto.enabled() - plugin_crypto = get_option(plugin) - elif get_option(plugin).allowed() and not plugin_crypto.allowed() - plugin_crypto = get_option(plugin) - endif -endforeach - if get_option('crypto-backend') == 'auto' # Prefer libgcrypt/gnutls over openssl because glib-networking is usually # built with gnutls anyway. dep_libgcrypt = dependency('libgcrypt', required: false) dep_gnutls = dependency('gnutls', required: false) if dep_libgcrypt.found() and dep_gnutls.found() - crypto_backend = 'gnutls' + crypto_backend = 'gnu' else - dep_openssl = dependency('openssl', disabler: true, required: plugin_crypto) - crypto_backend = 'openssl' + dep_openssl = dependency('openssl', required: false) + if dep_openssl.found() + crypto_backend = 'openssl' + else + error('Could not find crypto backend automatically. Specify explicitly via crypto-backend option.') + endif endif elif get_option('crypto-backend') == 'openssl' - dep_openssl = dependency('openssl', disabler: true, required: plugin_crypto) + dep_openssl = dependency('openssl', required: true) crypto_backend = 'openssl' -elif get_option('crypto-backend') == 'gnutls' - dep_libgcrypt = dependency('libgcrypt', disabler: true, required: plugin_crypto) - dep_gnutls = dependency('gnutls', disabler: true, required: get_option('plugin-ice')) - crypto_backend = 'gnutls' +elif get_option('crypto-backend') == 'gnu' + dep_libgcrypt = dependency('libgcrypt', required: true) + dep_gnutls = dependency('gnutls', required: get_option('plugin-ice')) + crypto_backend = 'gnu' endif dep_gdk_pixbuf = dependency('gdk-pixbuf-2.0') @@ -92,7 +87,7 @@ dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1', version: '>=1.5') dep_libcanberra = dependency('libcanberra', disabler: true, required: get_option('plugin-notification-sound')) dep_libqrencode = dependency('libqrencode', disabler: true, required: get_option('plugin-omemo')) -dep_libsrtp2 = dependency('libsrtp2', disabler: true, required: plugin_crypto) +dep_libsrtp2 = dependency('libsrtp2', disabler: true, required: true) dep_libomemo_c = dependency('libomemo-c', disabler: true, required: get_option('plugin-omemo')) dep_libsoup = dependency('libsoup-3.0') dep_nice = dependency('nice', version: '>=0.1.15', disabler: true, required: get_option('plugin-ice')) @@ -119,5 +114,4 @@ subdir('qlite') subdir('xmpp-vala') subdir('libdino') subdir('main') -subdir('crypto-vala') subdir('plugins') diff --git a/meson_options.txt b/meson_options.txt index bbf7a046..4700ef74 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,7 +1,7 @@ option('plugindir', type: 'string', value: 'dino/plugins', description: 'Dino plugin directory, relative to libdir') option('set-install-rpath', type: 'boolean', value: false, description: 'Set rpath of installed binaries to the configured libdir') -option('crypto-backend', type: 'combo', choices: ['auto', 'openssl', 'gnutls'], value: 'auto', description: 'Preferred crypto backend') +option('crypto-backend', type: 'combo', choices: ['auto', 'openssl', 'gnu'], value: 'auto', description: 'Preferred crypto backend') option('plugin-ice', type: 'feature', value: 'enabled', description: 'Peer-to-peer communication') option('plugin-omemo', type: 'feature', value: 'enabled', description: 'End-to-end encryption using OMEMO') diff --git a/plugins/ice/meson.build b/plugins/ice/meson.build index 5ed807bf..5161b123 100644 --- a/plugins/ice/meson.build +++ b/plugins/ice/meson.build @@ -1,5 +1,4 @@ dependencies = [ - dep_crypto_vala, dep_dino, dep_gee, dep_gio, @@ -23,12 +22,12 @@ c_args = vala_c_args + [ vala_args = [ '--vapidir', meson.current_source_dir() / 'vapi', ] -if crypto_backend == 'gnutls' +if crypto_backend == 'gnu' dependencies += [ dep_gnutls ] sources += files( 'src/dtls_srtp_gnutls.vala' ) -else # openssl +elif crypto_backend == 'openssl' dependencies += [ dep_openssl ] sources += files( 'src/dtls_srtp_openssl.vala', diff --git a/plugins/omemo/meson.build b/plugins/omemo/meson.build index d195525e..978fb9a6 100644 --- a/plugins/omemo/meson.build +++ b/plugins/omemo/meson.build @@ -1,7 +1,6 @@ subdir('po') dependencies = [ dep_libadwaita, - dep_crypto_vala, dep_dino, dep_gee, dep_glib, @@ -61,10 +60,10 @@ c_args = vala_c_args + [ '-DGETTEXT_PACKAGE="dino-omemo"', '-DLOCALE_INSTALL_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')), ] -if crypto_backend == 'gnutls' +if crypto_backend == 'gnu' dependencies += [ dep_libgcrypt ] sources += files('src/native/helper_gcrypt.c') -else +elif crypto_backend == 'openssl' dependencies += [ dep_openssl ] sources += files('src/native/helper_openssl.c') endif diff --git a/plugins/omemo/src/file_transfer/file_decryptor.vala b/plugins/omemo/src/file_transfer/file_decryptor.vala index ff96b4a3..8ae0b96b 100644 --- a/plugins/omemo/src/file_transfer/file_decryptor.vala +++ b/plugins/omemo/src/file_transfer/file_decryptor.vala @@ -1,6 +1,6 @@ using Dino.Entities; -using Crypto; +using Dino.Crypto; using Omemo; namespace Dino.Plugins.Omemo { diff --git a/plugins/omemo/src/file_transfer/file_encryptor.vala b/plugins/omemo/src/file_transfer/file_encryptor.vala index 1aed752f..5f1d6e69 100644 --- a/plugins/omemo/src/file_transfer/file_encryptor.vala +++ b/plugins/omemo/src/file_transfer/file_encryptor.vala @@ -1,7 +1,7 @@ using Gee; using Gtk; -using Crypto; +using Dino.Crypto; using Dino.Entities; using Xmpp; using Omemo; diff --git a/plugins/omemo/src/jingle/jet_omemo.vala b/plugins/omemo/src/jingle/jet_omemo.vala index b1a27e15..8a84d3d2 100644 --- a/plugins/omemo/src/jingle/jet_omemo.vala +++ b/plugins/omemo/src/jingle/jet_omemo.vala @@ -1,4 +1,4 @@ -using Crypto; +using Dino.Crypto; using Dino; using Dino.Entities; using Gee; diff --git a/plugins/rtp/meson.build b/plugins/rtp/meson.build index fadce062..b4ba5cf6 100644 --- a/plugins/rtp/meson.build +++ b/plugins/rtp/meson.build @@ -1,5 +1,4 @@ dependencies = [ - dep_crypto_vala, dep_dino, dep_gee, dep_glib, |
