xref: /qemu/crypto/meson.build (revision 1583a389)
1crypto_ss = ss.source_set()
2crypto_ss.add(genh)
3crypto_ss.add(files(
4  'afsplit.c',
5  'block-luks.c',
6  'block-qcow.c',
7  'block.c',
8  'cipher.c',
9  'desrfb.c',
10  'hash.c',
11  'hmac.c',
12  'ivgen-essiv.c',
13  'ivgen-plain.c',
14  'ivgen-plain64.c',
15  'ivgen.c',
16  'pbkdf.c',
17  'secret_common.c',
18  'secret.c',
19  'tlscreds.c',
20  'tlscredsanon.c',
21  'tlscredspsk.c',
22  'tlscredsx509.c',
23  'tlssession.c',
24))
25
26if 'CONFIG_NETTLE' in config_host
27  crypto_ss.add(files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'))
28elif 'CONFIG_GCRYPT' in config_host
29  crypto_ss.add(files('hash-gcrypt.c', 'pbkdf-gcrypt.c'))
30  if 'CONFIG_GCRYPT_HMAC' in config_host
31    crypto_ss.add(files('hmac-gcrypt.c'))
32  else
33    crypto_ss.add(files('hmac-glib.c'))
34  endif
35else
36  crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c'))
37endif
38
39crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
40crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
41crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
42crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c'))
43
44if 'CONFIG_NETTLE' in config_host
45  crypto_ss.add(nettle)
46elif 'CONFIG_GCRYPT' in config_host
47  crypto_ss.add(gcrypt)
48endif
49
50if 'CONFIG_GNUTLS' in config_host
51  crypto_ss.add(gnutls)
52endif
53
54
55crypto_ss = crypto_ss.apply(config_host, strict: false)
56libcrypto = static_library('crypto', crypto_ss.sources() + genh,
57                           dependencies: [crypto_ss.dependencies()],
58                           name_suffix: 'fa',
59                           build_by_default: false)
60
61crypto = declare_dependency(link_whole: libcrypto,
62                            dependencies: [authz, qom])
63
64util_ss.add(files('aes.c'))
65util_ss.add(files('init.c'))
66
67if 'CONFIG_GCRYPT' in config_host
68  util_ss.add(files('random-gcrypt.c'))
69elif 'CONFIG_GNUTLS' in config_host
70  util_ss.add(files('random-gnutls.c'))
71elif 'CONFIG_RNG_NONE' in config_host
72  util_ss.add(files('random-none.c'))
73else
74  util_ss.add(files('random-platform.c'))
75endif
76
77if 'CONFIG_GCRYPT' in config_host
78  util_ss.add(gcrypt)
79endif
80
81if 'CONFIG_GNUTLS' in config_host
82  util_ss.add(gnutls)
83endif
84