[Pkg-privacy-commits] [libotr] 24/225: * Protocol-v2.html: Clarified the uniqueness conditions for the counter.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:44:47 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 65fc0b1439b502e9bc559676f8e781c9f156643b
Author: cypherpunk <cypherpunk>
Date:   Sun Oct 30 21:01:14 2005 +0000

    	* Protocol-v2.html: Clarified the uniqueness conditions for the
    	counter.
    
    	* src/auth.c (otrl_auth_handle_v1_key_exchange): Clear the auth
    	structure when we receive an unexpected v1 Key Exchange Message.
---
 ChangeLog        |  8 ++++++++
 Protocol-v2.html | 11 ++++++-----
 src/auth.c       |  5 +++++
 src/tests.c      | 14 +++++++++++---
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a2117a5..0723217 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-10-30
+
+	* Protocol-v2.html: Clarified the uniqueness conditions for the
+	counter.
+
+	* src/auth.c (otrl_auth_handle_v1_key_exchange): Clear the auth
+	structure when we receive an unexpected v1 Key Exchange Message.
+
 2005-10-27
 
 	* src/auth.h:
diff --git a/Protocol-v2.html b/Protocol-v2.html
index fe3f253..6cde7c7 100644
--- a/Protocol-v2.html
+++ b/Protocol-v2.html
@@ -148,22 +148,23 @@ that group, as indicated in the detailed description below.</p>
 <ol>
 <li>Picks the most recent of her own D-H encryption keys that Bob has
 acknowledged receiving (by using it in a Data Message, or failing that,
-in the AKE).  Let keyid<sub>A</sub> be the serial number of that
-key.</li>
+in the AKE).  Let key<sub>A</sub> by that key, and let keyid<sub>A</sub>
+be its serial number.</li>
 <li>If the above key is Alice's most recent key, she generates a new D-H key 
 (next_dh), to get the serial number keyid<sub>A</sub>+1.</li>
 <li>Picks the most recent of Bob's D-H encryption keys that she has
 received from him (either in a Data Message or in the AKE).  Let
-keyid<sub>B</sub> be the serial number of that key.</li>
+key<sub>B</sub> by that key, and let keyid<sub>B</sub> be its serial
+number.</li>
 <li>Uses Diffie-Hellman to compute a shared secret from the two keys
-labelled by keyid<sub>A</sub> and keyid<sub>B</sub>, and generates the
+key<sub>A</sub> and key<sub>B</sub>, and generates the
 sending AES key, ek, and the sending MAC key, mk, as detailed
 below.</li>
 <li>Collects any old MAC keys that were used in previous messages, but
 will never again be used (because their associated D-H keys are no
 longer the most recent ones) into a list, oldmackeys.</li>
 <li>Picks a value of the counter, ctr, so that the triple
-(keyid<sub>A</sub>, keyid<sub>B</sub>, ctr) is never the same for more
+(key<sub>A</sub>, key<sub>B</sub>, ctr) is never the same for more
 than one Data Message Alice sends to Bob.</li>
 <li>Computes T<sub>A</sub> = (keyid<sub>A</sub>, keyid<sub>B</sub>, next_dh,
 ctr, AES-CTR<sub>ek,ctr</sub>(msg))</li>
diff --git a/src/auth.c b/src/auth.c
index f40f018..28f2928 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -1255,6 +1255,11 @@ gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth,
 	goto err;
     }
 
+    if (auth->authstate != OTRL_AUTHSTATE_V1_SETUP) {
+	/* Clear the auth and start over */
+	otrl_auth_clear(auth);
+    }
+
     /* Everything checked out */
     auth->their_keyid = received_keyid;
     gcry_mpi_release(auth->their_pub);
diff --git a/src/tests.c b/src/tests.c
index b3455d0..6603952 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -206,14 +206,21 @@ void test_crash1(void)
     sending(BOB, ALICE, "then."); dispatch();
 }
 
-void test_refresh(void)
+void test_refresh(int vers)
 {
+    ConnContext *alicecontext, *bobcontext;
+
     printf("\n\n*** Testing refresh ***\n\n");
 
     otrl_context_forget_all(us);
-    ALICEPOLICY = OTRL_POLICY_DEFAULT;
+    ALICEPOLICY = vers == 1 ? (OTRL_POLICY_DEFAULT &~ OTRL_POLICY_ALLOW_V2) :
+	OTRL_POLICY_DEFAULT;
     sending(ALICE, BOB, "?OTR?"); dispatch();
 
+    alicecontext = otrl_context_find(us, BOB, ALICE, PROTO, 0, NULL, NULL, NULL);
+    bobcontext = otrl_context_find(us, ALICE, BOB, PROTO, 0, NULL, NULL, NULL);
+    printf("%p %p\n", alicecontext, bobcontext);
+
     sending(ALICE, BOB, "Hi!"); dispatch();
     sending(BOB, ALICE, "There!"); dispatch();
     sending(ALICE, BOB, "You!"); dispatch();
@@ -236,7 +243,8 @@ int main(int argc, char **argv)
     test(2,1);
     test_unreadable();
     test_crash1();
-    test_refresh();
+    test_refresh(2);
+    test_refresh(1);
 
     otrl_userstate_free(us);
 

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