aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-06-30 13:29:57 +0200
committerAnders Broman <a.broman58@gmail.com>2019-06-30 13:07:43 +0000
commit5599f8e492723c5d496e23ad5465f47e63334c5a (patch)
tree9521bb9fc8f7240780b5a5eec4e6951d300e8318 /wsutil
parent2e9f54ee5b15607a8594d4edc2e7f46d2fdb9cf2 (diff)
wsutil: fix build failure of Debian packages on Ubuntu 16.04
The libwsutil symbols file contains two public symbols which depend on Libgcrypt 1.7.0. As the version included with Ubuntu 16.04 is too old, building a Debian package fails due to missing two curve25519 symbols. Add stub implementations as workaround. Change-Id: Ie39e784e9e631750b5269d038772496565b2dce8 Reviewed-on: https://code.wireshark.org/review/33780 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/curve25519.c18
-rw-r--r--wsutil/curve25519.h10
2 files changed, 22 insertions, 6 deletions
diff --git a/wsutil/curve25519.c b/wsutil/curve25519.c
index 40ab112ff8..39e8b7389d 100644
--- a/wsutil/curve25519.c
+++ b/wsutil/curve25519.c
@@ -11,6 +11,11 @@
*/
#include "curve25519.h"
+#include "ws_attributes.h"
+
+#if GCRYPT_VERSION_NUMBER >= 0x010700 /* 1.7.0 */
+#define HAVE_X25519
+#endif
#ifdef HAVE_X25519
static inline void
@@ -100,4 +105,17 @@ crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n)
gcry_mpi_release(mpi_basepoint_x);
return r;
}
+#else
+int
+crypto_scalarmult_curve25519(unsigned char *q _U_, const unsigned char *n _U_,
+ const unsigned char *p _U_)
+{
+ return -1;
+}
+
+int
+crypto_scalarmult_curve25519_base(unsigned char *q _U_, const unsigned char *n _U_)
+{
+ return -1;
+}
#endif /* HAVE_X25519 */
diff --git a/wsutil/curve25519.h b/wsutil/curve25519.h
index 2868df1b63..fc6a28450a 100644
--- a/wsutil/curve25519.h
+++ b/wsutil/curve25519.h
@@ -10,17 +10,16 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+/*
+ * Callers MUST check GCRYPT_VERSION_NUMBER >= 0x010700 before using this API.
+ */
+
#ifndef __CURVE25519_H__
#define __CURVE25519_H__
#include "ws_symbol_export.h"
#include "wsgcrypt.h"
-#if GCRYPT_VERSION_NUMBER >= 0x010700 /* 1.7.0 */
-#define HAVE_X25519
-#endif
-
-#ifdef HAVE_X25519
/*
* Computes Q = X25519(n, P). In other words, given the secret key n, the public
* key P, compute the shared secret Q. Each key is 32 bytes long.
@@ -36,6 +35,5 @@ int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
*/
WS_DLL_PUBLIC
int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
-#endif /* HAVE_X25519 */
#endif /* __CURVE25519_H__ */