Added back x509af_get_last_algorithm_id() removed in revision 54647 to
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 27 Jan 2014 09:02:06 +0000 (09:02 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 27 Jan 2014 09:02:06 +0000 (09:02 +0000)
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.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@54975 f5534014-38df-0310-8fa8-9805f1628bb7

asn1/cms/cms.cnf
asn1/pkcs12/packet-pkcs12-template.c
asn1/x509af/packet-x509af-template.c
asn1/x509af/packet-x509af-template.h
asn1/x509af/x509af.cnf
epan/dissectors/packet-cms.c
epan/dissectors/packet-pkcs12.c
epan/dissectors/packet-x509af.c
epan/dissectors/packet-x509af.h

index af843d17037d73b0862ef9d744393f90cf79f5c7..b2c81b09f433c17d5a96b012861b7afb55d0e093 100644 (file)
@@ -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
index be2d14c2a4b756772683dbe23a5bbd6cdefb5d68..e0130579d2c9be7feb87563bdabc2b43ef3f5482 100644 (file)
@@ -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)) {
index 7d20220a68badc10557757eb4b4a8f8336342c64..9641aa9bcc845c3cfbddf2fb9139217cc2b006b5 100644 (file)
@@ -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_)
 {
index 15fa07af4eb9cb3c3d6178c31b3bbd07d1a3124e..41d0dd8612650bb3227327e07c5ae83b72502d84 100644 (file)
@@ -28,5 +28,7 @@
 
 #include "packet-x509af-exp.h"
 
+extern const char* x509af_get_last_algorithm_id(void);
+
 #endif  /* PACKET_X509AF_H */
 
index 1c092bd21e747bdda3b62f87b9797be4e0dcf028..b532a45b9fcbbc70c9f5b14f130f6211848fdb3d 100644 (file)
@@ -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);
 
index d02e088cc7e857da364b351193abf3604b21eed4..e0f72136203ccc70a952b585b1e848b9d4d05a3a 100644 (file)
@@ -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);
 
 
 
index db48f7668af3284e685250d84bce5f1fefc88858..7c375c3e59d0c604b7195c8948137a492a43417a 100644 (file)
@@ -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)) {
index 19ab3dd2c40a5adce66579445032aef33c7e9d57..199e98587abd4f074713525b25b4fd076f912287 100644 (file)
@@ -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
index 760b8a9b4f279a3d1595578bec37dae6f2272e77..13ff245a45a478056bc85777945f46a4f08b4b5c 100644 (file)
@@ -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 */