[Pkg-privacy-commits] [libotr] 53/225: Clean up the "received symkey" callback.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:44:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository libotr.

commit 67b8799e6e666c99c21d845963e43df4b02c8c05
Author: cypherpunk <cypherpunk>
Date:   Wed Jul 2 16:12:46 2008 +0000

    Clean up the "received symkey" callback.
---
 src/message.c | 10 +++++++---
 src/message.h |  9 +++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/message.c b/src/message.c
index f06b81d..42f2a99 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1040,9 +1040,13 @@ int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
 		     * extra symmetric key, let the application know. */
 		    tlv = otrl_tlv_find(tlvs, OTRL_TLV_SYMKEY);
 		    if (tlv && otrl_api_version >= 0x040000) {
-			if (ops->received_symkey) {
-			    ops->received_symkey(opdata, context, tlv,
-				    extrakey);
+			if (ops->received_symkey && tlv->len >= 4) {
+			    unsigned char *bufp = tlv->data;
+			    unsigned int use =
+				(bufp[0] << 24) | (bufp[1] << 16) |
+				(bufp[2] << 8) | bufp[3];
+			    ops->received_symkey(opdata, context, use,
+				    bufp+4, tlv->len - 4, extrakey);
 			}
 		    }
 		    gcry_free(extrakey);
diff --git a/src/message.h b/src/message.h
index 1c3286f..db39896 100644
--- a/src/message.h
+++ b/src/message.h
@@ -122,11 +122,12 @@ typedef struct s_OtrlMessageAppOps {
 
     /* We received a request from the buddy to use the current "extra"
      * symmetric key.  The key will be passed in symkey, of length
-     * OTRL_EXTRAKEY_BYTES.  The TLV which carried the request will be
-     * passed in tlv, so that the applications can communicate other
-     * identifiers (some id for the data transfer, for example). */
+     * OTRL_EXTRAKEY_BYTES.  The requested use, as well as use-specific
+     * data will be passed so that the applications can communicate other
+     * information (some id for the data transfer, for example). */
     void (*received_symkey)(void *opdata, ConnContext *context,
-	    OtrlTLV *tlv, const unsigned char *symkey);
+	    unsigned int use, const unsigned char *usedata,
+	    size_t usedatalen, const unsigned char *symkey);
     
     /* Update the auth UI with respect to SMP events */
     void (*handle_smp_event)(void *opdata, OtrlSMPEvent smp_event,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git



More information about the Pkg-privacy-commits mailing list