diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:33 +0000 |
commit | 9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch) | |
tree | 2784370cda9bbf2da9114d70f05399c0b229d28c /epan/dissectors/packet-pkcs12.c | |
parent | Adding debian version 4.2.6-1. (diff) | |
download | wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-pkcs12.c')
-rw-r--r-- | epan/dissectors/packet-pkcs12.c | 281 |
1 files changed, 141 insertions, 140 deletions
diff --git a/epan/dissectors/packet-pkcs12.c b/epan/dissectors/packet-pkcs12.c index 86075eba..e9bd7abb 100644 --- a/epan/dissectors/packet-pkcs12.c +++ b/epan/dissectors/packet-pkcs12.c @@ -1,7 +1,7 @@ /* Do not modify this file. Changes will be overwritten. */ /* Generated automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-pkcs12.c */ -/* asn2wrs.py -b -L -p pkcs12 -c ./pkcs12.cnf -s ./packet-pkcs12-template -D . -O ../.. pkcs12.asn */ +/* asn2wrs.py -b -q -L -p pkcs12 -c ./pkcs12.cnf -s ./packet-pkcs12-template -D . -O ../.. pkcs12.asn */ /* packet-pkcs12.c * Routines for PKCS#12: Personal Information Exchange packet dissection @@ -25,6 +25,7 @@ #include <epan/oids.h> #include <epan/asn1.h> #include <epan/prefs.h> +#include <wsutil/array.h> #include "packet-ber.h" #include "packet-pkcs12.h" @@ -46,97 +47,97 @@ void proto_register_pkcs12(void); void proto_reg_handoff_pkcs12(void); /* Initialize the protocol and registered fields */ -static int proto_pkcs12 = -1; +static int proto_pkcs12; -static int hf_pkcs12_X509Certificate_PDU = -1; -static int hf_pkcs12_AuthenticatedSafe_PDU = -1; /* AuthenticatedSafe */ -static gint ett_decrypted_pbe = -1; +static int hf_pkcs12_X509Certificate_PDU; +static int hf_pkcs12_AuthenticatedSafe_PDU; /* AuthenticatedSafe */ +static int ett_decrypted_pbe; -static expert_field ei_pkcs12_octet_string_expected = EI_INIT; +static expert_field ei_pkcs12_octet_string_expected; -static const char *object_identifier_id = NULL; -static int iteration_count = 0; -static tvbuff_t *salt = NULL; -static const char *password = NULL; -static gboolean try_null_password = FALSE; +static const char *object_identifier_id; +static int iteration_count; +static tvbuff_t *salt; +static const char *password; +static bool try_null_password; static int dissect_AuthenticatedSafe_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); static int dissect_SafeContents_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); static int dissect_PrivateKeyInfo_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data); -static int hf_pkcs12_PFX_PDU = -1; /* PFX */ -static int hf_pkcs12_SafeContents_PDU = -1; /* SafeContents */ -static int hf_pkcs12_KeyBag_PDU = -1; /* KeyBag */ -static int hf_pkcs12_PKCS8ShroudedKeyBag_PDU = -1; /* PKCS8ShroudedKeyBag */ -static int hf_pkcs12_CertBag_PDU = -1; /* CertBag */ -static int hf_pkcs12_CRLBag_PDU = -1; /* CRLBag */ -static int hf_pkcs12_SecretBag_PDU = -1; /* SecretBag */ -static int hf_pkcs12_PrivateKeyInfo_PDU = -1; /* PrivateKeyInfo */ -static int hf_pkcs12_EncryptedPrivateKeyInfo_PDU = -1; /* EncryptedPrivateKeyInfo */ -static int hf_pkcs12_PBEParameter_PDU = -1; /* PBEParameter */ -static int hf_pkcs12_PBKDF2Params_PDU = -1; /* PBKDF2Params */ -static int hf_pkcs12_PBES2Params_PDU = -1; /* PBES2Params */ -static int hf_pkcs12_PBMAC1Params_PDU = -1; /* PBMAC1Params */ -static int hf_pkcs12_version = -1; /* T_version */ -static int hf_pkcs12_authSafe = -1; /* ContentInfo */ -static int hf_pkcs12_macData = -1; /* MacData */ -static int hf_pkcs12_mac = -1; /* DigestInfo */ -static int hf_pkcs12_macSalt = -1; /* OCTET_STRING */ -static int hf_pkcs12_iterations = -1; /* INTEGER */ -static int hf_pkcs12_AuthenticatedSafe_item = -1; /* ContentInfo */ -static int hf_pkcs12_SafeContents_item = -1; /* SafeBag */ -static int hf_pkcs12_bagId = -1; /* T_bagId */ -static int hf_pkcs12_bagValue = -1; /* T_bagValue */ -static int hf_pkcs12_bagAttributes = -1; /* SET_OF_PKCS12Attribute */ -static int hf_pkcs12_bagAttributes_item = -1; /* PKCS12Attribute */ -static int hf_pkcs12_certId = -1; /* T_certId */ -static int hf_pkcs12_certValue = -1; /* T_certValue */ -static int hf_pkcs12_crlId = -1; /* T_crlId */ -static int hf_pkcs12_crlValue = -1; /* T_crlValue */ -static int hf_pkcs12_secretTypeId = -1; /* T_secretTypeId */ -static int hf_pkcs12_secretValue = -1; /* T_secretValue */ -static int hf_pkcs12_attrId = -1; /* T_attrId */ -static int hf_pkcs12_attrValues = -1; /* T_attrValues */ -static int hf_pkcs12_attrValues_item = -1; /* T_attrValues_item */ -static int hf_pkcs12_privateKeyVersion = -1; /* Version */ -static int hf_pkcs12_privateKeyAlgorithm = -1; /* AlgorithmIdentifier */ -static int hf_pkcs12_privateKey = -1; /* PrivateKey */ -static int hf_pkcs12_attributes = -1; /* Attributes */ -static int hf_pkcs12_Attributes_item = -1; /* Attribute */ -static int hf_pkcs12_encryptionAlgorithm = -1; /* AlgorithmIdentifier */ -static int hf_pkcs12_encryptedData = -1; /* EncryptedData */ -static int hf_pkcs12_salt = -1; /* OCTET_STRING */ -static int hf_pkcs12_iterationCount = -1; /* INTEGER */ -static int hf_pkcs12_saltChoice = -1; /* T_saltChoice */ -static int hf_pkcs12_specified = -1; /* OCTET_STRING */ -static int hf_pkcs12_otherSource = -1; /* AlgorithmIdentifier */ -static int hf_pkcs12_keyLength = -1; /* INTEGER_1_MAX */ -static int hf_pkcs12_prf = -1; /* AlgorithmIdentifier */ -static int hf_pkcs12_keyDerivationFunc = -1; /* AlgorithmIdentifier */ -static int hf_pkcs12_encryptionScheme = -1; /* AlgorithmIdentifier */ -static int hf_pkcs12_messageAuthScheme = -1; /* AlgorithmIdentifier */ +static int hf_pkcs12_PFX_PDU; /* PFX */ +static int hf_pkcs12_SafeContents_PDU; /* SafeContents */ +static int hf_pkcs12_KeyBag_PDU; /* KeyBag */ +static int hf_pkcs12_PKCS8ShroudedKeyBag_PDU; /* PKCS8ShroudedKeyBag */ +static int hf_pkcs12_CertBag_PDU; /* CertBag */ +static int hf_pkcs12_CRLBag_PDU; /* CRLBag */ +static int hf_pkcs12_SecretBag_PDU; /* SecretBag */ +static int hf_pkcs12_PrivateKeyInfo_PDU; /* PrivateKeyInfo */ +static int hf_pkcs12_EncryptedPrivateKeyInfo_PDU; /* EncryptedPrivateKeyInfo */ +static int hf_pkcs12_PBEParameter_PDU; /* PBEParameter */ +static int hf_pkcs12_PBKDF2Params_PDU; /* PBKDF2Params */ +static int hf_pkcs12_PBES2Params_PDU; /* PBES2Params */ +static int hf_pkcs12_PBMAC1Params_PDU; /* PBMAC1Params */ +static int hf_pkcs12_version; /* T_version */ +static int hf_pkcs12_authSafe; /* ContentInfo */ +static int hf_pkcs12_macData; /* MacData */ +static int hf_pkcs12_mac; /* DigestInfo */ +static int hf_pkcs12_macSalt; /* OCTET_STRING */ +static int hf_pkcs12_iterations; /* INTEGER */ +static int hf_pkcs12_AuthenticatedSafe_item; /* ContentInfo */ +static int hf_pkcs12_SafeContents_item; /* SafeBag */ +static int hf_pkcs12_bagId; /* T_bagId */ +static int hf_pkcs12_bagValue; /* T_bagValue */ +static int hf_pkcs12_bagAttributes; /* SET_OF_PKCS12Attribute */ +static int hf_pkcs12_bagAttributes_item; /* PKCS12Attribute */ +static int hf_pkcs12_certId; /* T_certId */ +static int hf_pkcs12_certValue; /* T_certValue */ +static int hf_pkcs12_crlId; /* T_crlId */ +static int hf_pkcs12_crlValue; /* T_crlValue */ +static int hf_pkcs12_secretTypeId; /* T_secretTypeId */ +static int hf_pkcs12_secretValue; /* T_secretValue */ +static int hf_pkcs12_attrId; /* T_attrId */ +static int hf_pkcs12_attrValues; /* T_attrValues */ +static int hf_pkcs12_attrValues_item; /* T_attrValues_item */ +static int hf_pkcs12_privateKeyVersion; /* Version */ +static int hf_pkcs12_privateKeyAlgorithm; /* AlgorithmIdentifier */ +static int hf_pkcs12_privateKey; /* PrivateKey */ +static int hf_pkcs12_attributes; /* Attributes */ +static int hf_pkcs12_Attributes_item; /* Attribute */ +static int hf_pkcs12_encryptionAlgorithm; /* AlgorithmIdentifier */ +static int hf_pkcs12_encryptedData; /* EncryptedData */ +static int hf_pkcs12_salt; /* OCTET_STRING */ +static int hf_pkcs12_iterationCount; /* INTEGER */ +static int hf_pkcs12_saltChoice; /* T_saltChoice */ +static int hf_pkcs12_specified; /* OCTET_STRING */ +static int hf_pkcs12_otherSource; /* AlgorithmIdentifier */ +static int hf_pkcs12_keyLength; /* INTEGER_1_MAX */ +static int hf_pkcs12_prf; /* AlgorithmIdentifier */ +static int hf_pkcs12_keyDerivationFunc; /* AlgorithmIdentifier */ +static int hf_pkcs12_encryptionScheme; /* AlgorithmIdentifier */ +static int hf_pkcs12_messageAuthScheme; /* AlgorithmIdentifier */ /* Initialize the subtree pointers */ -static gint ett_pkcs12_PFX = -1; -static gint ett_pkcs12_MacData = -1; -static gint ett_pkcs12_AuthenticatedSafe = -1; -static gint ett_pkcs12_SafeContents = -1; -static gint ett_pkcs12_SafeBag = -1; -static gint ett_pkcs12_SET_OF_PKCS12Attribute = -1; -static gint ett_pkcs12_CertBag = -1; -static gint ett_pkcs12_CRLBag = -1; -static gint ett_pkcs12_SecretBag = -1; -static gint ett_pkcs12_PKCS12Attribute = -1; -static gint ett_pkcs12_T_attrValues = -1; -static gint ett_pkcs12_PrivateKeyInfo = -1; -static gint ett_pkcs12_Attributes = -1; -static gint ett_pkcs12_EncryptedPrivateKeyInfo = -1; -static gint ett_pkcs12_PBEParameter = -1; -static gint ett_pkcs12_PBKDF2Params = -1; -static gint ett_pkcs12_T_saltChoice = -1; -static gint ett_pkcs12_PBES2Params = -1; -static gint ett_pkcs12_PBMAC1Params = -1; +static int ett_pkcs12_PFX; +static int ett_pkcs12_MacData; +static int ett_pkcs12_AuthenticatedSafe; +static int ett_pkcs12_SafeContents; +static int ett_pkcs12_SafeBag; +static int ett_pkcs12_SET_OF_PKCS12Attribute; +static int ett_pkcs12_CertBag; +static int ett_pkcs12_CRLBag; +static int ett_pkcs12_SecretBag; +static int ett_pkcs12_PKCS12Attribute; +static int ett_pkcs12_T_attrValues; +static int ett_pkcs12_PrivateKeyInfo; +static int ett_pkcs12_Attributes; +static int ett_pkcs12_EncryptedPrivateKeyInfo; +static int ett_pkcs12_PBEParameter; +static int ett_pkcs12_PBKDF2Params; +static int ett_pkcs12_T_saltChoice; +static int ett_pkcs12_PBES2Params; +static int ett_pkcs12_PBMAC1Params; static void append_oid(wmem_allocator_t *pool, proto_tree *tree, const char *oid) { @@ -174,7 +175,7 @@ generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsi if (pwlen > 63 / 2) { - return FALSE; + return false; } /* Store salt and password in BUF_I */ @@ -198,7 +199,7 @@ generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsi err = gcry_md_open(&md, GCRY_MD_SHA1, 0); if (gcry_err_code(err)) { - return FALSE; + return false; } for (i = 0; i < 64; i++) { @@ -222,7 +223,7 @@ generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsi if (cur_keylen == req_keylen) { gcry_mpi_release (num_b1); - return TRUE; /* ready */ + return true; /* ready */ } /* need more bytes. */ @@ -235,7 +236,7 @@ generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsi if (rc != 0) { - return FALSE; + return false; } gcry_mpi_add_ui (num_b1, num_b1, 1); @@ -249,7 +250,7 @@ generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsi if (rc != 0) { - return FALSE; + return false; } gcry_mpi_add (num_ij, num_ij, num_b1); @@ -260,7 +261,7 @@ generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsi rc = gcry_mpi_print (GCRYMPI_FMT_USG, buf_i + i, n, &n, num_ij); if (rc != 0) { - return FALSE; + return false; } gcry_mpi_release (num_ij); @@ -288,15 +289,15 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry char *iv = NULL; char *clear_data = NULL; tvbuff_t *clear_tvb = NULL; - const gchar *oidname; + const char *oidname; GString *name; proto_tree *tree; char byte; - gboolean decrypt_ok = TRUE; + bool decrypt_ok = true; - if(((password == NULL) || (*password == '\0')) && (try_null_password == FALSE)) { + if(((password == NULL) || (*password == '\0')) && (try_null_password == false)) { /* we are not configured to decrypt */ - return FALSE; + return false; } encryption_algorithm = x509af_get_last_algorithm_id(); @@ -321,44 +322,44 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry /* we don't know how to decrypt this */ proto_item_append_text(item, " [Unsupported encryption algorithm]"); - return FALSE; + return false; } if((iteration_count == 0) || (salt == NULL)) { proto_item_append_text(item, " [Insufficient parameters]"); - return FALSE; + return false; } /* allocate buffers */ key = (char *)wmem_alloc(pinfo->pool, keylen); if(!generate_key_or_iv(pinfo, 1 /*LEY */, salt, iteration_count, password, keylen, key)) - return FALSE; + return false; if(ivlen) { iv = (char *)wmem_alloc(pinfo->pool, ivlen); if(!generate_key_or_iv(pinfo, 2 /* IV */, salt, iteration_count, password, ivlen, iv)) - return FALSE; + return false; } /* now try an internal function */ err = gcry_cipher_open(&cipher, algo, mode, 0); if (gcry_err_code (err)) - return FALSE; + return false; err = gcry_cipher_setkey (cipher, key, keylen); if (gcry_err_code (err)) { gcry_cipher_close (cipher); - return FALSE; + return false; } if(ivlen) { err = gcry_cipher_setiv (cipher, iv, ivlen); if (gcry_err_code (err)) { gcry_cipher_close (cipher); - return FALSE; + return false; } } @@ -371,7 +372,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry proto_item_append_text(item, " [Failed to decrypt with password preference]"); gcry_cipher_close (cipher); - return FALSE; + return false; } gcry_cipher_close (cipher); @@ -388,7 +389,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry for(i = (int)byte; i > 0 ; i--) { if(clear_data[datalen - i] != byte) { - decrypt_ok = FALSE; + decrypt_ok = false; break; } } @@ -399,13 +400,13 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry /* we assume the result is ASN.1 - check it is a SET or SEQUENCE */ byte = clear_data[0]; if((byte != 0x30) && (byte != 0x31)) { /* do we need more here? OCTET STRING? */ - decrypt_ok = FALSE; + decrypt_ok = false; } if(!decrypt_ok) { proto_item_append_text(item, " [Failed to decrypt with supplied password]"); - return FALSE; + return false; } proto_item_append_text(item, " [Decrypted successfully]"); @@ -414,7 +415,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry /* OK - so now clear_data contains the decrypted data */ - clear_tvb = tvb_new_child_real_data(encrypted_tvb,(const guint8 *)clear_data, datalen, datalen); + clear_tvb = tvb_new_child_real_data(encrypted_tvb,(const uint8_t *)clear_data, datalen, datalen); name = g_string_new(""); oidname = oid_resolved_from_string(pinfo->pool, object_identifier_id_param); @@ -428,7 +429,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry /* now try and decode it */ call_ber_oid_callback(object_identifier_id_param, clear_tvb, 0, actx->pinfo, tree, NULL); - return TRUE; + return true; } @@ -968,102 +969,102 @@ dissect_pkcs12_PBMAC1Params(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_PFX_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PFX(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PFX_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PFX(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PFX_PDU); return offset; } static int dissect_SafeContents_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_SafeContents(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_SafeContents_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_SafeContents(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_SafeContents_PDU); return offset; } static int dissect_KeyBag_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_KeyBag(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_KeyBag_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_KeyBag(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_KeyBag_PDU); return offset; } static int dissect_PKCS8ShroudedKeyBag_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PKCS8ShroudedKeyBag(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PKCS8ShroudedKeyBag_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PKCS8ShroudedKeyBag(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PKCS8ShroudedKeyBag_PDU); return offset; } static int dissect_CertBag_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_CertBag(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_CertBag_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_CertBag(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_CertBag_PDU); return offset; } static int dissect_CRLBag_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_CRLBag(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_CRLBag_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_CRLBag(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_CRLBag_PDU); return offset; } static int dissect_SecretBag_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_SecretBag(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_SecretBag_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_SecretBag(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_SecretBag_PDU); return offset; } static int dissect_PrivateKeyInfo_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PrivateKeyInfo(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PrivateKeyInfo_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PrivateKeyInfo(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PrivateKeyInfo_PDU); return offset; } static int dissect_EncryptedPrivateKeyInfo_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_EncryptedPrivateKeyInfo(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_EncryptedPrivateKeyInfo_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_EncryptedPrivateKeyInfo(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_EncryptedPrivateKeyInfo_PDU); return offset; } static int dissect_PBEParameter_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PBEParameter(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBEParameter_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PBEParameter(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBEParameter_PDU); return offset; } static int dissect_PBKDF2Params_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PBKDF2Params(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBKDF2Params_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PBKDF2Params(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBKDF2Params_PDU); return offset; } static int dissect_PBES2Params_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PBES2Params(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBES2Params_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PBES2Params(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBES2Params_PDU); return offset; } static int dissect_PBMAC1Params_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - offset = dissect_pkcs12_PBMAC1Params(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBMAC1Params_PDU); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); + offset = dissect_pkcs12_PBMAC1Params(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_PBMAC1Params_PDU); return offset; } static int strip_octet_string(tvbuff_t *tvb) { - gint8 ber_class; + int8_t ber_class; bool pc, ind; - gint32 tag; - guint32 len; + int32_t tag; + uint32_t len; int offset = 0; /* PKCS#7 encodes the content as OCTET STRING, whereas CMS is just any ANY */ @@ -1083,10 +1084,10 @@ static int strip_octet_string(tvbuff_t *tvb) static int dissect_AuthenticatedSafe_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); if((offset = strip_octet_string(tvb)) > 0) - dissect_pkcs12_AuthenticatedSafe(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_AuthenticatedSafe_PDU); + dissect_pkcs12_AuthenticatedSafe(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_AuthenticatedSafe_PDU); else proto_tree_add_expert(tree, pinfo, &ei_pkcs12_octet_string_expected, tvb, 0, 1); return tvb_captured_length(tvb); @@ -1096,11 +1097,11 @@ static int dissect_SafeContents_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *pinf { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); offset = strip_octet_string(tvb); - dissect_pkcs12_SafeContents(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_SafeContents_PDU); + dissect_pkcs12_SafeContents(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_SafeContents_PDU); return tvb_captured_length(tvb); } @@ -1108,10 +1109,10 @@ static int dissect_X509Certificate_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *p { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); if((offset = strip_octet_string(tvb)) > 0) - dissect_x509af_Certificate(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_X509Certificate_PDU); + dissect_x509af_Certificate(false, tvb, offset, &asn1_ctx, tree, hf_pkcs12_X509Certificate_PDU); else proto_tree_add_expert(tree, pinfo, &ei_pkcs12_octet_string_expected, tvb, 0, 1); @@ -1339,7 +1340,7 @@ void proto_register_pkcs12(void) { }; /* List of subtrees */ - static gint *ett[] = { + static int *ett[] = { &ett_decrypted_pbe, &ett_pkcs12_PFX, &ett_pkcs12_MacData, |