From b7aa21218296a7d6dfd62dbc9dd8258a23f2e6c2 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Tue, 3 Jul 2007 14:19:40 +0000 Subject: [PATCH] bongo-config compatibility with older GNUTLS 1.0 APIs --- src/apps/config/config.c | 2 +- src/apps/config/config.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apps/config/config.c b/src/apps/config/config.c index 475a385..00c2fdf 100644 --- a/src/apps/config/config.c +++ b/src/apps/config/config.c @@ -363,7 +363,7 @@ GenerateCryptoData() { gnutls_x509_crt_set_key_usage(certificate, GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_DATA_ENCIPHERMENT); - ret = gnutls_x509_crt_sign2(certificate, certificate, key, GNUTLS_DIG_SHA1, 0); + ret = GNUTLS_SELF_SIGN(certificate, key); if (ret < 0) { XplConsolePrintf("ERROR: Couldn't self-sign certificate. %s\n", gnutls_strerror(ret)); return FALSE; diff --git a/src/apps/config/config.h b/src/apps/config/config.h index f2de203..03413fa 100644 --- a/src/apps/config/config.h +++ b/src/apps/config/config.h @@ -70,4 +70,13 @@ static char *bongo_avirus_config = " \"flags\": 168\n" "}\n"; +/* compat with older gnutls */ +#ifndef GNUTLS_DIG_SHA1 + // older GNUTLS +# define GNUTLS_SELF_SIGN(c, k) gnutls_x509_crt_sign((c), (c), (k)) +#elif + // new GNUTLS +# define GNUTLS_SELF_SIGN(c, k) gnutls_x509_crt_sign2((c), (c), (k), GNUTLS_DIG_SHA1, 0) +#endif + #endif