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>
This commit is contained in:
Peter Wu 2019-06-30 13:29:57 +02:00 committed by Anders Broman
parent 2e9f54ee5b
commit 5599f8e492
2 changed files with 22 additions and 6 deletions

View File

@ -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 */

View File

@ -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__ */