*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#endif
#ifdef HAVE_LIBGCRYPT
-#include <gcrypt.h>
+#include <wsutil/wsgcrypt.h>
#endif
#define PNAME "PKCS#12: Personal Information Exchange"
#define PKCS12_PBE_3DES_SHA1_OID "1.2.840.113549.1.12.1.3"
#define PKCS12_PBE_RC2_40_SHA1_OID "1.2.840.113549.1.12.1.6"
+void proto_register_pkcs12(void);
+void proto_reg_handoff_pkcs12(void);
+
/* Initialize the protocol and registered fields */
static int proto_pkcs12 = -1;
gcry_mpi_t num_b1 = NULL;
size_t pwlen;
char hash[20], buf_b[64], buf_i[128], *p;
- char *salt;
+ char *salt_p;
int salt_size;
size_t cur_keylen;
size_t n;
cur_keylen = 0;
salt_size = tvb_length(salt_tvb);
- salt = tvb_get_ephemeral_string(salt_tvb, 0, salt_size);
+ salt_p = tvb_get_ephemeral_string(salt_tvb, 0, salt_size);
if (pw == NULL)
pwlen = 0;
/* Store salt and password in BUF_I */
p = buf_i;
for (i = 0; i < 64; i++)
- *p++ = salt[i % salt_size];
+ *p++ = salt_p[i % salt_size];
if (pw)
{
for (i = j = 0; i < 64; i += 2)
salt = NULL;
}
-int PBE_decrypt_data(const char *object_identifier_id _U_, tvbuff_t *encrypted_tvb _U_, asn1_ctx_t *actx _U_, proto_item *item _U_)
+int PBE_decrypt_data(const char *object_identifier_id_param, tvbuff_t *encrypted_tvb, asn1_ctx_t *actx, proto_item *item)
{
#ifdef HAVE_LIBGCRYPT
const char *encryption_algorithm;
}
/* allocate buffers */
- key = ep_alloc(keylen);
+ key = (char *)ep_alloc(keylen);
if(!generate_key_or_iv(1 /*LEY */, salt, iteration_count, password, keylen, key))
return FALSE;
if(ivlen) {
- iv = ep_alloc(ivlen);
+ iv = (char *)ep_alloc(ivlen);
if(!generate_key_or_iv(2 /* IV */, salt, iteration_count, password, ivlen, iv))
return FALSE;
}
datalen = tvb_length(encrypted_tvb);
- clear_data = g_malloc(datalen);
+ clear_data = (char *)g_malloc(datalen);
err = gcry_cipher_decrypt (cipher, clear_data, datalen, tvb_get_ephemeral_string(encrypted_tvb, 0, datalen), datalen);
if (gcry_err_code (err)) {
tvb_set_free_cb(clear_tvb, g_free);
name = g_string_new("");
- oidname = oid_resolved_from_string(object_identifier_id);
- g_string_printf(name, "Decrypted %s", oidname ? oidname : object_identifier_id);
+ oidname = oid_resolved_from_string(object_identifier_id_param);
+ g_string_printf(name, "Decrypted %s", oidname ? oidname : object_identifier_id_param);
/* add it as a new source */
add_new_data_source(actx->pinfo, clear_tvb, name->str);
g_string_free(name, TRUE);
/* now try and decode it */
- call_ber_oid_callback(object_identifier_id, clear_tvb, 0, actx->pinfo, tree);
+ call_ber_oid_callback(object_identifier_id_param, clear_tvb, 0, actx->pinfo, tree);
return TRUE;
#else