|
@@ -1633,6 +1633,7 @@ endif
|
|
gcrypt = not_found
|
|
gcrypt = not_found
|
|
nettle = not_found
|
|
nettle = not_found
|
|
hogweed = not_found
|
|
hogweed = not_found
|
|
|
|
+crypto_sm4 = not_found
|
|
xts = 'none'
|
|
xts = 'none'
|
|
|
|
|
|
if get_option('nettle').enabled() and get_option('gcrypt').enabled()
|
|
if get_option('nettle').enabled() and get_option('gcrypt').enabled()
|
|
@@ -1658,6 +1659,17 @@ if not gnutls_crypto.found()
|
|
cc.find_library('gpg-error', required: true)],
|
|
cc.find_library('gpg-error', required: true)],
|
|
version: gcrypt.version())
|
|
version: gcrypt.version())
|
|
endif
|
|
endif
|
|
|
|
+ crypto_sm4 = gcrypt
|
|
|
|
+ # SM4 ALG is available in libgcrypt >= 1.9
|
|
|
|
+ if gcrypt.found() and not cc.links('''
|
|
|
|
+ #include <gcrypt.h>
|
|
|
|
+ int main(void) {
|
|
|
|
+ gcry_cipher_hd_t handler;
|
|
|
|
+ gcry_cipher_open(&handler, GCRY_CIPHER_SM4, GCRY_CIPHER_MODE_ECB, 0);
|
|
|
|
+ return 0;
|
|
|
|
+ }''', dependencies: gcrypt)
|
|
|
|
+ crypto_sm4 = not_found
|
|
|
|
+ endif
|
|
endif
|
|
endif
|
|
if (not get_option('nettle').auto() or have_system) and not gcrypt.found()
|
|
if (not get_option('nettle').auto() or have_system) and not gcrypt.found()
|
|
nettle = dependency('nettle', version: '>=3.4',
|
|
nettle = dependency('nettle', version: '>=3.4',
|
|
@@ -1666,6 +1678,18 @@ if not gnutls_crypto.found()
|
|
if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
|
|
if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
|
|
xts = 'private'
|
|
xts = 'private'
|
|
endif
|
|
endif
|
|
|
|
+ crypto_sm4 = nettle
|
|
|
|
+ # SM4 ALG is available in nettle >= 3.9
|
|
|
|
+ if nettle.found() and not cc.links('''
|
|
|
|
+ #include <nettle/sm4.h>
|
|
|
|
+ int main(void) {
|
|
|
|
+ struct sm4_ctx ctx;
|
|
|
|
+ unsigned char key[16] = {0};
|
|
|
|
+ sm4_set_encrypt_key(&ctx, key);
|
|
|
|
+ return 0;
|
|
|
|
+ }''', dependencies: nettle)
|
|
|
|
+ crypto_sm4 = not_found
|
|
|
|
+ endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
|
|
@@ -2267,6 +2291,7 @@ config_host_data.set('CONFIG_GNUTLS_CRYPTO', gnutls_crypto.found())
|
|
config_host_data.set('CONFIG_TASN1', tasn1.found())
|
|
config_host_data.set('CONFIG_TASN1', tasn1.found())
|
|
config_host_data.set('CONFIG_GCRYPT', gcrypt.found())
|
|
config_host_data.set('CONFIG_GCRYPT', gcrypt.found())
|
|
config_host_data.set('CONFIG_NETTLE', nettle.found())
|
|
config_host_data.set('CONFIG_NETTLE', nettle.found())
|
|
|
|
+config_host_data.set('CONFIG_CRYPTO_SM4', crypto_sm4.found())
|
|
config_host_data.set('CONFIG_HOGWEED', hogweed.found())
|
|
config_host_data.set('CONFIG_HOGWEED', hogweed.found())
|
|
config_host_data.set('CONFIG_QEMU_PRIVATE_XTS', xts == 'private')
|
|
config_host_data.set('CONFIG_QEMU_PRIVATE_XTS', xts == 'private')
|
|
config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
|
|
config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
|
|
@@ -4306,6 +4331,7 @@ summary_info += {'nettle': nettle}
|
|
if nettle.found()
|
|
if nettle.found()
|
|
summary_info += {' XTS': xts != 'private'}
|
|
summary_info += {' XTS': xts != 'private'}
|
|
endif
|
|
endif
|
|
|
|
+summary_info += {'SM4 ALG support': crypto_sm4}
|
|
summary_info += {'AF_ALG support': have_afalg}
|
|
summary_info += {'AF_ALG support': have_afalg}
|
|
summary_info += {'rng-none': get_option('rng_none')}
|
|
summary_info += {'rng-none': get_option('rng_none')}
|
|
summary_info += {'Linux keyring': have_keyring}
|
|
summary_info += {'Linux keyring': have_keyring}
|