[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Backport; tests; hacking: Core code is clean, commented...



Update of /home/minion/cvsroot/src/minion
In directory moria.seul.org:/tmp/cvs-serv23515

Modified Files:
	HACKING Makefile TODO setup.py 
Log Message:
Backport; tests; hacking: Core code is clean, commented, documented, and tested

- Backported to older versions of Python.  We now support 2.0 through 
  2.2 inclusive.  This included:
      - Removing uses of // operator.
      - Checking version properly in setup.py
      - Removing use of nested scopes.
      - Replace type(foo) == str with type(foo) == type("")
      - Bundling Python's unittest.py module so we can run tests on systems
        (Python 2.0) that don't include it.
      - In crypt.c, we can no longer go from openssl BIGNUMs to Python Longs
        using _PyLong_(To|From)ByteArray -- the latter method didn't exist
        until 2.2.  We have to to/from a hex representation instead.

- Better message on insane-endianness case.

- Rename 'Formats' module to 'Packet'.
- Rename 'ServerProcess' module to 'PacketHandler'.
- Document and comment all remaining code.
- Changes to Packet: (Formerly Formats)
     - Add ReplyBlock object
     - Fix bugs in header slicing
     - Freak out on overlong subheaders.

- Changes to BuildMessage:
     - Make BuildStatelessReplyBlock a bit more paranoid about missing userKey.
     - Rejoin _buildFoo and _buildFoo_impl
     - Grouse early if header will be too long.
     - Misc cleanups
  
     - New tests: Long intermediate info,  fail on overlong routing info

- Changes to Crypto: 
     - Use symbolic constants throughout
     - Add cache for TRNG

- Changes to Hashlog:
     - Make 'sync' method conditional on underlying sync: this allows us
       to support dumbdbm.

- Changes to PacketHandler: (formerly ServerProcess)
     - Remove processMessage intermediary; rename _processMessage.
     - Add support for multiple keys
     - Make setup more sane
     - Add note on timing attacks
     - New tests: Most failing cases 

- Changes to benchMark:
     - Restructure handling of primitives, loop overhead
     - Make cleanup process handle dumbdbm.
     - Add actual vs ideal comparisons for Lioness and PacketHandler

- Changes to crypt.c:
     - Write more idiomatic and paranoid C. 
     - Make failing SHA cases fail faster
     - Backport to py2.0->py2.2; see above



Index: HACKING
===================================================================
RCS file: /home/minion/cvsroot/src/minion/HACKING,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- HACKING	29 May 2002 03:52:13 -0000	1.1
+++ HACKING	2 Jun 2002 06:11:16 -0000	1.2
@@ -1,7 +1,7 @@
 Hacking Mixminion
 
 Requirements:
-	Python 2.2 (see PORTING NOTES below)
+	Python 2.0-2.2  (see PORTING NOTES below)
 	OpenSSL 0.9.7 (you'll need to download a snapshot)
 	Working /dev/urandom (see PORTING NOTES below)
 
@@ -49,16 +49,11 @@
        ------------------
 
 
-
 PORTING NOTES:
     - If you need to run on a system without /dev/urandom, you'll need
       to write an acceptable fallback for mixminion.Crypto.trng() to
       use.  
-    - We could backport to Python 2.1 with a minimum of pain by
-      replacing uses of // with divmod.  We could backport to 2.0 
-      (with bigger headaches) by excising nested scopes.
-
-      I refuse to backport to 1.5 or 1.6.
+    - I've already backported to 2.0.  I refuse to backport to 1.5 or 1.6.
 
 CAVEATS:
     - If I haven't got a test for it in tests.py, assume it doesn't work.

Index: Makefile
===================================================================
RCS file: /home/minion/cvsroot/src/minion/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile	29 May 2002 03:52:13 -0000	1.1
+++ Makefile	2 Jun 2002 06:11:16 -0000	1.2
@@ -9,6 +9,7 @@
 clean:
 	$(PYTHON) setup.py clean
 	rm -rf build
+	rm -f lib/mixminion/_unittest.py
 	find . -name '*~' -print0 |xargs -0 rm -f
 
 test: do_build

Index: TODO
===================================================================
RCS file: /home/minion/cvsroot/src/minion/TODO,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- TODO	31 May 2002 12:47:58 -0000	1.2
+++ TODO	2 Jun 2002 06:11:16 -0000	1.3
@@ -1,8 +1,7 @@
 
 NEEDS TO BE WRITTEN
 
-- Queue for incoming messages
-- Queue for outgoing messages
+- Generic queues
 - Manager process
 - Configuration code
 - Logging/debugging code
@@ -17,8 +16,8 @@
 - Downloading from directory servers
 - Key rotation
 - Reply block storage and format.
-
-WRITTEN, BUT UNTESTED
-
-- ServerProcess.py
+- Reading messages sent to reply blocks
+- Secure delete
+- Make sure library is threadsafe.
+	- How threadsafe is openssl?
 

Index: setup.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/setup.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- setup.py	31 May 2002 12:47:58 -0000	1.2
+++ setup.py	2 Jun 2002 06:11:16 -0000	1.3
@@ -1,10 +1,15 @@
 #!/usr/bin/python
-
 # Copyright 2002 Nick Mathewson.  See LICENSE for licensing information.
 # $Id$
+import sys
 
-import os, struct
-from distutils.core import setup, Extension
+# Check the version.  We need to make sure version_info exists before we
+# compare to it: it was only added as of Python version 1.6.
+if not hasattr(sys, 'version_info') or sys.version_info < (2, 0, 0):
+    print "Sorry, but I require Python 2.0 or higher."
+    sys.exit(0)
+
+import os, struct, shutil
 
 VERSION= '0.1'
 
@@ -13,11 +18,19 @@
 SSL_DIR="contrib/openssl"
 
 MACROS=[]
+MODULES=[]
+
+#======================================================================
+# Install unittest if python doesn't provide it. (This is a 2.0 issue)
+try:
+    import unittest
+except:
+    shutil.copy("contrib/unittest.py", "lib/mixminion/_unittest.py")
 
 #======================================================================
 # Detect endian-ness
 
-#XXXX this breaks cross-compilation
+#XXXX This breaks cross-compilation, but might be good enough for now.
 num = struct.pack("@I", 0x01020304) 
 big_endian = (num== "\x01\x02\x03\x04")
 little_endian = (num=="\x04\x03\x02\x01")
@@ -32,9 +45,13 @@
     if os.path.exists("/usr/include/byteswap.h"):
         MACROS.append( ("MM_HAVE_BYTESWAP_H", 1) )
 elif other_endian:
-    print "Feh! Host is neither little-endian or big-endian"
+    print "Wild!  Your machine seems to be middle-endian, and yet you've"
+    print "somehow made it run Python.  Despite your perversity, I admire"
+    print "your neve, and will try to soldier on."
+    MACROS.append( ("MM_O_ENDIAN", 1)  )
 
 #======================================================================
+from distutils.core import setup, Extension
 
 extmodule = Extension("mixminion._minionlib",
                       ["src/crypt.c", "src/aes_ctr.c", "src/main.c" ],