if $pkg_config --exists "nettle"; then
nettle_cflags=`$pkg_config --cflags nettle`
nettle_libs=`$pkg_config --libs nettle`
+ nettle_version=`$pkg_config --modversion nettle`
libs_softmmu="$nettle_libs $libs_softmmu"
libs_tools="$nettle_libs $libs_tools"
QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
echo "GNUTLS support $gnutls"
echo "GNUTLS hash $gnutls_hash"
echo "GNUTLS gcrypt $gnutls_gcrypt"
-echo "GNUTLS nettle $gnutls_nettle"
+echo "GNUTLS nettle $gnutls_nettle ${gnutls_nettle+($nettle_version)}"
echo "VTE support $vte"
echo "curses support $curses"
echo "curl support $curl"
fi
if test "$gnutls_nettle" = "yes" ; then
echo "CONFIG_GNUTLS_NETTLE=y" >> $config_host_mak
+ echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
fi
if test "$vte" = "yes" ; then
echo "CONFIG_VTE=y" >> $config_host_mak
#include <nettle/des.h>
#include <nettle/cbc.h>
+#if CONFIG_NETTLE_VERSION_MAJOR < 3
+typedef nettle_crypt_func nettle_cipher_func;
+#endif
+
typedef struct QCryptoCipherNettle QCryptoCipherNettle;
struct QCryptoCipherNettle {
void *ctx_encrypt;
void *ctx_decrypt;
- nettle_crypt_func *alg_encrypt;
- nettle_crypt_func *alg_decrypt;
+ nettle_cipher_func *alg_encrypt;
+ nettle_cipher_func *alg_decrypt;
uint8_t *iv;
size_t niv;
};
des_set_key(ctx->ctx_encrypt, rfbkey);
g_free(rfbkey);
- ctx->alg_encrypt = (nettle_crypt_func *)des_encrypt;
- ctx->alg_decrypt = (nettle_crypt_func *)des_decrypt;
+ ctx->alg_encrypt = (nettle_cipher_func *)des_encrypt;
+ ctx->alg_decrypt = (nettle_cipher_func *)des_decrypt;
ctx->niv = DES_BLOCK_SIZE;
break;
aes_set_encrypt_key(ctx->ctx_encrypt, nkey, key);
aes_set_decrypt_key(ctx->ctx_decrypt, nkey, key);
- ctx->alg_encrypt = (nettle_crypt_func *)aes_encrypt;
- ctx->alg_decrypt = (nettle_crypt_func *)aes_decrypt;
+ ctx->alg_encrypt = (nettle_cipher_func *)aes_encrypt;
+ ctx->alg_decrypt = (nettle_cipher_func *)aes_decrypt;
ctx->niv = AES_BLOCK_SIZE;
break;