xref: /openbmc/qemu/crypto/meson.build (revision 6a18fd05)
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_GCRYPT' in config_host
27  wo_nettle = files('hash-gcrypt.c', 'pbkdf-gcrypt.c')
28else
29  wo_nettle = files('hash-glib.c', 'pbkdf-stub.c')
30endif
31if 'CONFIG_GCRYPT_HMAC' not in config_host
32  wo_nettle += files('hmac-glib.c')
33endif
34crypto_ss.add(when: [nettle, 'CONFIG_NETTLE'],
35             if_true: files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'),
36             if_false: wo_nettle)
37
38crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
39crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
40crypto_ss.add(when: 'CONFIG_GCRYPT_HMAC', if_true: files('hmac-gcrypt.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
44crypto_ss = crypto_ss.apply(config_host, strict: false)
45libcrypto = static_library('crypto', crypto_ss.sources() + genh,
46                           dependencies: [crypto_ss.dependencies()],
47                           name_suffix: 'fa',
48                           build_by_default: false)
49
50crypto = declare_dependency(link_whole: libcrypto,
51                            dependencies: [authz, qom])
52
53util_ss.add(files('aes.c'))
54util_ss.add(files('init.c'))
55if 'CONFIG_GCRYPT' in config_host
56  util_ss.add(files('random-gcrypt.c'))
57elif 'CONFIG_GNUTLS' in config_host
58  util_ss.add(files('random-gnutls.c'), gnutls)
59elif 'CONFIG_RNG_NONE' in config_host
60  util_ss.add(files('random-none.c'))
61else
62  util_ss.add(files('random-platform.c'))
63endif
64