Do not require using wsgcrypt.h

The reason to use wsgcrypt.h was to wrap it around DIAG_OFF()
macros and that should no longer be necessary.
This commit is contained in:
João Valverde 2023-02-06 10:36:41 +00:00
parent 71cfbd81b3
commit 02238edf92
14 changed files with 17 additions and 41 deletions

View File

@ -75,7 +75,7 @@
#include <wsutil/ws_assert.h>
#include <wsutil/wslog.h>
#include <wsutil/wsgcrypt.h>
#include <gcrypt.h>
#include "ui/failure_message.h"

View File

@ -452,9 +452,9 @@ a MinGW toolchain, including MinGW-w64. The same concern applies to CMake
code. Depending on the particular situation you may need to use if(WIN32) or
if(MSVC) or if(MINGW).
Wireshark uses Libgcrypt as general-purpose crypto library. To use it from
your dissector, do not include gcrypt.h directly, but use the wrapper file
wsutil/wsgcrypt.h instead.
Wireshark uses Libgcrypt as general-purpose crypto library. Some Wireshark
specific extensions are defined in wsutil/wsgcrypt.h. You might want to
include that file instead.
2. String handling

View File

@ -27,6 +27,7 @@
#include <time.h>
#include <glib.h>
#include <gcrypt.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@ -50,7 +51,6 @@
#include <ui/exit_codes.h>
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/wsgcrypt.h>
#include <wsutil/plugins.h>
#include <wsutil/privileges.h>
#include <wsutil/report_message.h>

View File

@ -8,10 +8,11 @@
*/
#include "config.h"
#include "epan.h"
#include <stdarg.h>
#include <wsutil/wsgcrypt.h>
#include <gcrypt.h>
#ifdef HAVE_LIBGNUTLS
#include <gnutls/gnutls.h>
@ -23,7 +24,6 @@
#include <epan/exceptions.h>
#include "epan.h"
#include "epan/frame_data.h"
#include "dfilter/dfilter.h"

View File

@ -10,7 +10,7 @@
#ifndef __EPAN_H__
#define __EPAN_H__
#include <glib.h>
#include <wireshark.h>
#include <wsutil/feature_list.h>
#include <epan/tvbuff.h>
@ -18,7 +18,6 @@
#include <epan/frame_data.h>
#include <epan/register.h>
#include <wiretap/wtap_opttypes.h>
#include "ws_symbol_export.h"
#ifdef __cplusplus
extern "C" {

View File

@ -22,7 +22,7 @@
#ifdef HAVE_LIBGNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/abstract.h>
# include <wsutil/wsgcrypt.h>
# include <gcrypt.h>
# include <wsutil/rsa.h>
# include <epan/uat.h>
# include <wsutil/report_message.h>

View File

@ -534,19 +534,6 @@ sub check_included_files($$)
@incFiles = (${$fileContentsRef} =~ m/\#include \s* ([<"].+[>"])/gox);
# only our wrapper file wsutils/wsgcrypt.h may include gcrypt.h
# all other files should include the wrapper
if ($filename !~ /wsgcrypt\.h/) {
foreach (@incFiles) {
if ( m#([<"]|/+)gcrypt\.h[>"]$# ) {
print STDERR "Warning: ".$filename.
" includes gcrypt.h directly. ".
"Include wsutil/wsgcrypt.h instead.\n";
last;
}
}
}
# files in the ui/qt directory should include the ui class includes
# by using #include <>
# this ensures that Visual Studio picks up these files from the

View File

@ -15,7 +15,7 @@
#include <epan/packet.h>
#include <wsutil/file_util.h>
#include <wsutil/wsgcrypt.h>
#include <gcrypt.h>
#include "cfile.h"
#include "ui/summary.h"

View File

@ -11,7 +11,7 @@
*/
#include "curve25519.h"
#include "ws_attributes.h"
#include <gcrypt.h>
static inline void
copy_and_reverse(unsigned char *dest, const unsigned char *src, size_t n)

View File

@ -13,8 +13,7 @@
#ifndef __CURVE25519_H__
#define __CURVE25519_H__
#include "ws_symbol_export.h"
#include "wsgcrypt.h"
#include <wireshark.h>
/*
* Computes Q = X25519(n, P). In other words, given the secret key n, the public

View File

@ -9,11 +9,11 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include "eax.h"
#include <stdlib.h>
#include <string.h>
/* Use libgcrypt for cipher libraries. */
#include <wsutil/wsgcrypt.h>
#include "eax.h"
#include <gcrypt.h>
typedef struct {
guint8 L[EAX_SIZEOF_KEY];

View File

@ -12,8 +12,7 @@
#ifndef _EAX_H
#define _EAX_H
#include <glib.h>
#include "ws_symbol_export.h"
#include <wireshark.h>
typedef struct tagMAC_T
{

View File

@ -12,8 +12,8 @@
#ifndef __RSA_H__
#define __RSA_H__
#include "ws_symbol_export.h"
#include "wsgcrypt.h"
#include <wireshark.h>
#include <gcrypt.h>
#ifdef HAVE_LIBGNUTLS
#include <stdio.h>

View File

@ -16,16 +16,8 @@
#define __WSGCRYPT_H__
#include <wireshark.h>
/* XXX: Turning off warnings here may not be necessary now that libgcrypt
* 1.8.0 is the minimum version.
*/
DIAG_OFF(deprecated-declarations)
#include <gcrypt.h>
DIAG_ON(deprecated-declarations)
#define HASH_MD5_LENGTH 16
#define HASH_SHA1_LENGTH 20
#define HASH_SHA2_224_LENGTH 28