aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2014-01-27 09:02:06 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2014-01-27 09:02:06 +0000
commitface757db3169f8f9964c7fd31250cf67c6764cb (patch)
tree4e878c303482949502bf67a9f5da6cf38073994b
parentb48a2db7d1b3518b37197298fdd59cea3479fb54 (diff)
Added back x509af_get_last_algorithm_id() removed in revision 54647 to
restore usage in cms and pkcs12. They never got a valid value in actx->external.direct_reference because they use another actx in this case. This will add back the global variable in x509af, but this is needed until we manage to pass the value in another way. See comments in bug 9573. svn path=/trunk/; revision=54975
-rw-r--r--asn1/cms/cms.cnf4
-rw-r--r--asn1/pkcs12/packet-pkcs12-template.c2
-rw-r--r--asn1/x509af/packet-x509af-template.c6
-rw-r--r--asn1/x509af/packet-x509af-template.h2
-rw-r--r--asn1/x509af/x509af.cnf2
-rw-r--r--epan/dissectors/packet-cms.c4
-rw-r--r--epan/dissectors/packet-pkcs12.c2
-rw-r--r--epan/dissectors/packet-x509af.c24
-rw-r--r--epan/dissectors/packet-x509af.h2
9 files changed, 34 insertions, 14 deletions
diff --git a/asn1/cms/cms.cnf b/asn1/cms/cms.cnf
index af843d1703..b2c81b09f4 100644
--- a/asn1/cms/cms.cnf
+++ b/asn1/cms/cms.cnf
@@ -153,8 +153,8 @@ RevocationInfoChoice/other otherRIC
old_offset = get_ber_identifier(tvb, old_offset, NULL, NULL, NULL);
old_offset = get_ber_length(tvb, old_offset, NULL, NULL);
- if(content_tvb && actx->external.direct_reference)
- cms_verify_msg_digest(pi, content_tvb, actx->external.direct_reference, tvb, old_offset);
+ if(content_tvb)
+ cms_verify_msg_digest(pi, content_tvb, x509af_get_last_algorithm_id(), tvb, old_offset);
#.FN_PARS SMIMECapability/capability
FN_VARIANT = _str HF_INDEX = hf_cms_attrType VAL_PTR = &object_identifier_id
diff --git a/asn1/pkcs12/packet-pkcs12-template.c b/asn1/pkcs12/packet-pkcs12-template.c
index be2d14c2a4..e0130579d2 100644
--- a/asn1/pkcs12/packet-pkcs12-template.c
+++ b/asn1/pkcs12/packet-pkcs12-template.c
@@ -252,7 +252,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param, tvbuff_t *encrypted
return FALSE;
}
- encryption_algorithm = actx->external.direct_reference;
+ encryption_algorithm = x509af_get_last_algorithm_id();
/* these are the only encryption schemes we understand for now */
if(!strcmp(encryption_algorithm, PKCS12_PBE_3DES_SHA1_OID)) {
diff --git a/asn1/x509af/packet-x509af-template.c b/asn1/x509af/packet-x509af-template.c
index 7d20220a68..9641aa9bcc 100644
--- a/asn1/x509af/packet-x509af-template.c
+++ b/asn1/x509af/packet-x509af-template.c
@@ -53,8 +53,14 @@ static int hf_x509af_extension_id = -1;
/* Initialize the subtree pointers */
static gint ett_pkix_crl = -1;
#include "packet-x509af-ett.c"
+static const char *algorithm_id;
#include "packet-x509af-fn.c"
+const char *x509af_get_last_algorithm_id(void) {
+ return algorithm_id;
+}
+
+
static int
dissect_pkix_crl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
{
diff --git a/asn1/x509af/packet-x509af-template.h b/asn1/x509af/packet-x509af-template.h
index 15fa07af4e..41d0dd8612 100644
--- a/asn1/x509af/packet-x509af-template.h
+++ b/asn1/x509af/packet-x509af-template.h
@@ -28,5 +28,7 @@
#include "packet-x509af-exp.h"
+extern const char* x509af_get_last_algorithm_id(void);
+
#endif /* PACKET_X509AF_H */
diff --git a/asn1/x509af/x509af.cnf b/asn1/x509af/x509af.cnf
index 1c092bd21e..b532a45b9f 100644
--- a/asn1/x509af/x509af.cnf
+++ b/asn1/x509af/x509af.cnf
@@ -72,6 +72,8 @@ CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate
%(DEFAULT_BODY)s
+ algorithm_id = actx->external.direct_reference;
+
if(actx->external.direct_reference) {
name = oid_resolved_from_string(actx->external.direct_reference);
diff --git a/epan/dissectors/packet-cms.c b/epan/dissectors/packet-cms.c
index d02e088cc7..e0f7213620 100644
--- a/epan/dissectors/packet-cms.c
+++ b/epan/dissectors/packet-cms.c
@@ -1529,8 +1529,8 @@ dissect_cms_MessageDigest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
old_offset = get_ber_identifier(tvb, old_offset, NULL, NULL, NULL);
old_offset = get_ber_length(tvb, old_offset, NULL, NULL);
- if(content_tvb && actx->external.direct_reference)
- cms_verify_msg_digest(pi, content_tvb, actx->external.direct_reference, tvb, old_offset);
+ if(content_tvb)
+ cms_verify_msg_digest(pi, content_tvb, x509af_get_last_algorithm_id(), tvb, old_offset);
diff --git a/epan/dissectors/packet-pkcs12.c b/epan/dissectors/packet-pkcs12.c
index db48f7668a..7c375c3e59 100644
--- a/epan/dissectors/packet-pkcs12.c
+++ b/epan/dissectors/packet-pkcs12.c
@@ -344,7 +344,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param, tvbuff_t *encrypted
return FALSE;
}
- encryption_algorithm = actx->external.direct_reference;
+ encryption_algorithm = x509af_get_last_algorithm_id();
/* these are the only encryption schemes we understand for now */
if(!strcmp(encryption_algorithm, PKCS12_PBE_3DES_SHA1_OID)) {
diff --git a/epan/dissectors/packet-x509af.c b/epan/dissectors/packet-x509af.c
index 19ab3dd2c4..199e98587a 100644
--- a/epan/dissectors/packet-x509af.c
+++ b/epan/dissectors/packet-x509af.c
@@ -177,6 +177,7 @@ static gint ett_x509af_DSS_Params = -1;
/*--- End of included file: packet-x509af-ett.c ---*/
#line 56 "../../asn1/x509af/packet-x509af-template.c"
+static const char *algorithm_id;
/*--- Included file: packet-x509af-fn.c ---*/
#line 1 "../../asn1/x509af/packet-x509af-fn.c"
@@ -217,6 +218,8 @@ dissect_x509af_T_algorithmId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_x509af_algorithm_id, &actx->external.direct_reference);
+ algorithm_id = actx->external.direct_reference;
+
if(actx->external.direct_reference) {
name = oid_resolved_from_string(actx->external.direct_reference);
@@ -232,7 +235,7 @@ dissect_x509af_T_algorithmId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
static int
dissect_x509af_T_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 82 "../../asn1/x509af/x509af.cnf"
+#line 84 "../../asn1/x509af/x509af.cnf"
offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
@@ -323,7 +326,7 @@ static const ber_choice_t SubjectName_choice[] = {
static int
dissect_x509af_SubjectName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 109 "../../asn1/x509af/x509af.cnf"
+#line 111 "../../asn1/x509af/x509af.cnf"
const char* str;
offset = dissect_ber_choice(actx, tree, tvb, offset,
@@ -369,7 +372,7 @@ dissect_x509af_SubjectPublicKeyInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
static int
dissect_x509af_T_extnId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 88 "../../asn1/x509af/x509af.cnf"
+#line 90 "../../asn1/x509af/x509af.cnf"
const char *name;
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_x509af_extension_id, &actx->external.direct_reference);
@@ -399,7 +402,7 @@ dissect_x509af_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_x509af_T_extnValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 99 "../../asn1/x509af/x509af.cnf"
+#line 101 "../../asn1/x509af/x509af.cnf"
gint8 ber_class;
gboolean pc, ind;
gint32 tag;
@@ -886,7 +889,12 @@ static void dissect_DSS_Params_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr
/*--- End of included file: packet-x509af-fn.c ---*/
-#line 57 "../../asn1/x509af/packet-x509af-template.c"
+#line 58 "../../asn1/x509af/packet-x509af-template.c"
+
+const char *x509af_get_last_algorithm_id(void) {
+ return algorithm_id;
+}
+
static int
dissect_pkix_crl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
@@ -1223,7 +1231,7 @@ void proto_register_x509af(void) {
"INTEGER", HFILL }},
/*--- End of included file: packet-x509af-hfarr.c ---*/
-#line 93 "../../asn1/x509af/packet-x509af-template.c"
+#line 99 "../../asn1/x509af/packet-x509af-template.c"
};
/* List of subtrees */
@@ -1266,7 +1274,7 @@ void proto_register_x509af(void) {
&ett_x509af_DSS_Params,
/*--- End of included file: packet-x509af-ettarr.c ---*/
-#line 99 "../../asn1/x509af/packet-x509af-template.c"
+#line 105 "../../asn1/x509af/packet-x509af-template.c"
};
/* Register protocol */
@@ -1309,7 +1317,7 @@ void proto_reg_handoff_x509af(void) {
/*--- End of included file: packet-x509af-dis-tab.c ---*/
-#line 127 "../../asn1/x509af/packet-x509af-template.c"
+#line 133 "../../asn1/x509af/packet-x509af-template.c"
/*XXX these should really go to a better place but since that
I have not that ITU standard, ill put it here for the time
diff --git a/epan/dissectors/packet-x509af.h b/epan/dissectors/packet-x509af.h
index 760b8a9b4f..13ff245a45 100644
--- a/epan/dissectors/packet-x509af.h
+++ b/epan/dissectors/packet-x509af.h
@@ -66,5 +66,7 @@ void dissect_x509af_Certificate_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, p
/*--- End of included file: packet-x509af-exp.h ---*/
#line 30 "../../asn1/x509af/packet-x509af-template.h"
+extern const char* x509af_get_last_algorithm_id(void);
+
#endif /* PACKET_X509AF_H */