[Pkg-privacy-commits] [libotr] 108/225: Don't copy auth states on receipt of a COMMIT message

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:06 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 543b9d63fe1ff8aebaf882c47092df7f340d7fbf
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date:   Sat Aug 25 15:06:55 2012 -0400

    Don't copy auth states on receipt of a COMMIT message
    
    Similarly to the previous commit, if we receive a COMMIT message, we
    should just use it to start a new SIGMA protocol, rather than comparing
    it against the old COMMIT message we may have still lying around.  This
    completely removes the need for the otrl_auth_copy_on_commit function.
---
 src/auth.c    | 35 -----------------------------------
 src/auth.h    |  8 --------
 src/message.c | 14 ++------------
 3 files changed, 2 insertions(+), 55 deletions(-)

diff --git a/src/auth.c b/src/auth.c
index 09b0408..37ed20d 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -1428,41 +1428,6 @@ err:
 
 /*
  * Copy relevant information from the master OtrlAuthInfo to an
- * instance OtrlAuthInfo in response to a D-H Commit with a new
- * instance. The fields copied will depend on the state of the
- * master auth.
- */
-void otrl_auth_copy_on_commit(OtrlAuthInfo *m_auth, OtrlAuthInfo *auth)
-{
-    switch(m_auth->authstate) {
-	case OTRL_AUTHSTATE_NONE:
-	case OTRL_AUTHSTATE_AWAITING_REVEALSIG:
-	    auth->authstate = OTRL_AUTHSTATE_NONE;
-	    break;
-	case OTRL_AUTHSTATE_AWAITING_DHKEY:
-	    /* We sent a D-H Commit Message, and we also received one.
-	     *  Copy our D_H Commit and auth state */
-	    otrl_dh_keypair_free(&(auth->our_dh));
-	    auth->initiated = m_auth->initiated;
-	    otrl_dh_keypair_copy(&(auth->our_dh), &(m_auth->our_dh));
-	    auth->our_keyid = m_auth->our_keyid;
-	    memmove(auth->r, m_auth->r, 16);
-	    if (auth->encgx) free(auth->encgx);
-	    auth->encgx = malloc(m_auth->encgx_len);
-	    memmove(auth->encgx, m_auth->encgx, m_auth->encgx_len);
-	    memmove(auth->hashgx, m_auth->hashgx, 32);
-
-	    auth->authstate = OTRL_AUTHSTATE_AWAITING_DHKEY;
-	    break;
-
-	default:
-	    /* This bad state will be detected and handled later */
-	    break;
-    }
-}
-
-/*
- * Copy relevant information from the master OtrlAuthInfo to an
  * instance OtrlAuthInfo in response to a D-H Key with a new
  * instance. The fields copied will depend on the state of the
  * master auth.
diff --git a/src/auth.h b/src/auth.h
index 4f9eaee..b8437b3 100644
--- a/src/auth.h
+++ b/src/auth.h
@@ -161,14 +161,6 @@ gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth,
 
 /*
  * Copy relevant information from the master OtrlAuthInfo to an
- * instance OtrlAuthInfo in response to a D-H Commit with a new
- * instance. The fields copied will depend on the state of the
- * master auth.
- */
-void otrl_auth_copy_on_commit(OtrlAuthInfo *m_auth, OtrlAuthInfo *auth);
-
-/*
- * Copy relevant information from the master OtrlAuthInfo to an
  * instance OtrlAuthInfo in response to a D-H Key with a new
  * instance. The fields copied will depend on the state of the
  * master auth.
diff --git a/src/message.c b/src/message.c
index a28b98c..7cd925f 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1051,11 +1051,9 @@ int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
 		context->msgstate = m_context->msgstate;
 	    }
 
-	    if (msgtype == OTRL_MSGTYPE_DH_COMMIT) {
-		otrl_auth_copy_on_commit(&(m_context->auth), &(context->auth));
-	    } else if (msgtype == OTRL_MSGTYPE_DH_KEY) {
+	    if (msgtype == OTRL_MSGTYPE_DH_KEY) {
 		otrl_auth_copy_on_key(&(m_context->auth), &(context->auth));
-	    } else {
+	    } else if (msgtype != OTRL_MSGTYPE_DH_COMMIT) {
 		return 1;  /* Ignore unexpected message */
 	    }
 
@@ -1073,14 +1071,6 @@ int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
 		context->auth.protocol_version = 3;
 		context->protocol_version = 3;
 		otrl_auth_copy_on_key(&(m_context->auth), &(context->auth));
-	    } else if (msgtype == OTRL_MSGTYPE_DH_COMMIT &&
-		    m_context->auth.authstate == OTRL_AUTHSTATE_AWAITING_DHKEY
-		    && !(context->auth.authstate ==
-		    OTRL_AUTHSTATE_AWAITING_DHKEY)) {
-		context->msgstate = m_context->msgstate;
-		context->auth.protocol_version = 3;
-		context->protocol_version = 3;
-		otrl_auth_copy_on_commit(&(m_context->auth), &(context->auth));
 	    }
 	}
     }

-- 
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