aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
Diffstat (limited to 'epan')
-rw-r--r--epan/CMakeLists.txt1
-rw-r--r--epan/Makefile.common2
-rw-r--r--epan/base64.c67
-rw-r--r--epan/base64.h41
-rw-r--r--epan/dissectors/packet-http.c4
-rw-r--r--epan/dissectors/packet-smtp.c18
-rw-r--r--epan/tvbuff_base64.c4
-rw-r--r--epan/wslua/wslua_tvb.c4
8 files changed, 15 insertions, 126 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 9b20aa0e63..c7a7b98cf3 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -1471,7 +1471,6 @@ set(LIBWIRESHARK_FILES
app_mem_usage.c
asn1.c
atalk-utils.c
- base64.c
camel-persistentdata.c
charsets.c
circuit.c
diff --git a/epan/Makefile.common b/epan/Makefile.common
index 3e7f1b288d..69b7f6d811 100644
--- a/epan/Makefile.common
+++ b/epan/Makefile.common
@@ -32,7 +32,6 @@ LIBWIRESHARK_SRC = \
app_mem_usage.c \
asn1.c \
atalk-utils.c \
- base64.c \
camel-persistentdata.c \
charsets.c \
circuit.c \
@@ -158,7 +157,6 @@ LIBWIRESHARK_INCLUDES = \
asn1.h \
atalk-utils.h \
ax25_pids.h \
- base64.h \
bridged_pids.h \
camel-persistentdata.h \
charsets.h \
diff --git a/epan/base64.c b/epan/base64.c
deleted file mode 100644
index bf507fca8a..0000000000
--- a/epan/base64.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* base64.c
- * Base-64 conversion
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include "base64.h"
-
-/* Decode a base64 string in-place - simple and slow algorithm.
- Return length of result. Taken from rproxy/librsync/base64.c by
- Andrew Tridgell. */
-
-size_t epan_base64_decode(char *s)
-{
- static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\r\n";
- int bit_offset, byte_offset, idx, i;
- unsigned char *d = (unsigned char *)s;
- char *p;
- int cr_idx;
-
- /* we will allow CR and LF - but ignore them */
- cr_idx = (int) (strchr(b64, '\r') - b64);
-
- i=0;
-
- while (*s && (p=strchr(b64, *s))) {
- idx = (int)(p - b64);
- if(idx < cr_idx) {
- byte_offset = (i*6)/8;
- bit_offset = (i*6)%8;
- d[byte_offset] &= ~((1<<(8-bit_offset))-1);
- if (bit_offset < 3) {
- d[byte_offset] |= (idx << (2-bit_offset));
- } else {
- d[byte_offset] |= (idx >> (bit_offset-2));
- d[byte_offset+1] = 0;
- d[byte_offset+1] |= (idx << (8-(bit_offset-2))) & 0xFF;
- }
- i++;
- }
- s++;
- }
-
- d[i*3/4] = 0;
- return i*3/4;
-}
diff --git a/epan/base64.h b/epan/base64.h
deleted file mode 100644
index 2888bbdac0..0000000000
--- a/epan/base64.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* base64.h
- * Base-64 conversion
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef __BASE64_H__
-#define __BASE64_H__
-
-#include "ws_symbol_export.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* In-place decoding of a base64 string. Resulting string is NULL terminated */
-WS_DLL_PUBLIC
-size_t epan_base64_decode(char *s);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __BASE64_H__ */
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index ce372e6823..1a9529e8ea 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -41,7 +41,7 @@
#include <epan/conversation.h>
#include <epan/packet.h>
#include <epan/strutil.h>
-#include <epan/base64.h>
+#include <wsutil/base64.h>
#include <epan/stats_tree.h>
#include <epan/req_resp_hdrs.h>
@@ -2655,7 +2655,7 @@ check_auth_basic(proto_item *hdr_item, tvbuff_t *tvb, gchar *value)
hdr_tree = NULL;
value += hdrlen;
- epan_base64_decode(value);
+ ws_base64_decode_inplace(value);
proto_tree_add_string(hdr_tree, hf_http_basic, tvb,
0, 0, value);
diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c
index bdcb4b8070..6a1f8bdcf7 100644
--- a/epan/dissectors/packet-smtp.c
+++ b/epan/dissectors/packet-smtp.c
@@ -40,7 +40,7 @@
#include <epan/strutil.h>
#include <epan/wmem/wmem.h>
#include <epan/reassemble.h>
-#include <epan/base64.h>
+#include <wsutil/base64.h>
#include <epan/dissectors/packet-ssl.h>
/* RFC 2821 */
@@ -321,7 +321,7 @@ decode_plain_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
decrypt = tvb_get_string(wmem_packet_scope(), tvb, a_offset, a_linelen);
if (stmp_decryption_enabled) {
- returncode = (gint)epan_base64_decode(decrypt);
+ returncode = (gint)ws_base64_decode_inplace(decrypt);
if (returncode) {
length_user1 = (gint)strlen(decrypt);
if (returncode >= (length_user1 + 1)) {
@@ -579,7 +579,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(pinfo->fd->num >= session_state->first_auth_frame) &&
((session_state->last_auth_frame == 0) || (pinfo->fd->num <= session_state->last_auth_frame))) {
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
- if ((stmp_decryption_enabled) && (epan_base64_decode(decrypt) > 0)) {
+ if ((stmp_decryption_enabled) && (ws_base64_decode_inplace(decrypt) > 0)) {
line = decrypt;
} else {
line = tvb_get_ptr(tvb, loffset, linelen);
@@ -837,7 +837,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* This line wasn't already decrypted through the state machine */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
if (stmp_decryption_enabled) {
- if (epan_base64_decode(decrypt) == 0) {
+ if (ws_base64_decode_inplace(decrypt) == 0) {
/* Go back to the original string */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
}
@@ -851,7 +851,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* This line wasn't already decrypted through the state machine */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
if (stmp_decryption_enabled) {
- if (epan_base64_decode(decrypt) == 0) {
+ if (ws_base64_decode_inplace(decrypt) == 0) {
/* Go back to the original string */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
}
@@ -863,7 +863,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else if (session_state->ntlm_rsp_frame == pinfo->fd->num) {
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
if (stmp_decryption_enabled) {
- if (epan_base64_decode(decrypt) == 0) {
+ if (ws_base64_decode_inplace(decrypt) == 0) {
/* Go back to the original string */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset, linelen);
col_append_str(pinfo->cinfo, COL_INFO, decrypt);
@@ -907,7 +907,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* This line wasn't already decrypted through the state machine */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset + 11, linelen - 11);
if (stmp_decryption_enabled) {
- if (epan_base64_decode(decrypt) == 0) {
+ if (ws_base64_decode_inplace(decrypt) == 0) {
/* Go back to the original string */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset + 11, linelen - 11);
}
@@ -922,7 +922,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
loffset + 5, linelen - 5, ENC_ASCII|ENC_NA);
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset + 10, linelen - 10);
if (stmp_decryption_enabled) {
- if (epan_base64_decode(decrypt) == 0) {
+ if (ws_base64_decode_inplace(decrypt) == 0) {
/* Go back to the original string */
decrypt = tvb_get_string(wmem_packet_scope(), tvb, loffset + 10, linelen - 10);
col_append_str(pinfo->cinfo, COL_INFO, tvb_get_string(wmem_packet_scope(), tvb, loffset, 10));
@@ -1097,7 +1097,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (linelen >= 4) {
if ((stmp_decryption_enabled) && (code == 334)) {
decrypt = tvb_get_string(wmem_packet_scope(), tvb, offset + 4, linelen - 4);
- if (epan_base64_decode(decrypt) > 0) {
+ if (ws_base64_decode_inplace(decrypt) > 0) {
if (g_ascii_strncasecmp(decrypt, "NTLMSSP", 7) == 0) {
base64_string = tvb_get_string(wmem_packet_scope(), tvb, loffset + 4, linelen - 4);
col_append_fstr(pinfo->cinfo, COL_INFO, "%d ", code);
diff --git a/epan/tvbuff_base64.c b/epan/tvbuff_base64.c
index 425670a71b..5f4cb67f8b 100644
--- a/epan/tvbuff_base64.c
+++ b/epan/tvbuff_base64.c
@@ -27,7 +27,7 @@
#include <glib.h>
#include <epan/tvbuff.h>
-#include <epan/base64.h>
+#include <wsutil/base64.h>
tvbuff_t *
base64_to_tvb(tvbuff_t *parent, const char *base64)
@@ -36,7 +36,7 @@ base64_to_tvb(tvbuff_t *parent, const char *base64)
char *data = g_strdup(base64);
gint len;
- len = (gint) epan_base64_decode(data);
+ len = (gint) ws_base64_decode_inplace(data);
tvb = tvb_new_child_real_data(parent, (const guint8 *)data, len, len);
tvb_set_free_cb(tvb, g_free);
diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c
index aa1d7b5bc1..2341abfc1f 100644
--- a/epan/wslua/wslua_tvb.c
+++ b/epan/wslua/wslua_tvb.c
@@ -35,7 +35,7 @@
/* WSLUA_MODULE Tvb Functions for handling packet data */
#include "wslua.h"
-#include "epan/base64.h"
+#include "wsutil/base64.h"
WSLUA_CLASS_DEFINE(ByteArray,FAIL_ON_NULL("null bytearray"),NOP);
@@ -269,7 +269,7 @@ static int ByteArray_base64_decode(lua_State* L) {
memcpy(data, ba->data, ba->len);
data[ba->len] = '\0';
- len = epan_base64_decode(data);
+ len = ws_base64_decode_inplace(data);
g_byte_array_append(ba2,data,(int)len);
g_free(data);