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

[minion-cvs] Sunday"s hacks, today! More work towards clean, usable...



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

Modified Files:
	aes_ctr.c 
Log Message:
Sunday's hacks, today!  More work towards clean, usable, testable server
logic.

HACKING:
	Bring up to date

Makefile, setup:
	Make it work on macos X

Common:
	Move in createPrivateDirs from servermain
	Document log severities

MMTPServer:
	Track retriable and non-retriable failures better; add failure
	   callback

Modules:
	Document classes
	Add per-module queues
	Begin new processMessage method (incomplete)
	Simplify DropModule
	Switch MBOX to use SMTPlib.
	
Queue:
	Add convenience methods to pickle and unpickle objects
	Add DeliveryQueue class to encapsulate queue/send/retry logic
	Add MixQueue to implement Cottrell mixing.
	
ServerMain:
	Adopt some (but not yet all) of above improvements

aes_ctr.c:
	Fix big-endian *_U32 macros
	Add INCR_U32 macro to improve performance on big-endian machines
	Rewrite code to use INCR_ macros




Index: aes_ctr.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/aes_ctr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- aes_ctr.c	2 Jun 2002 06:11:16 -0000	1.3
+++ aes_ctr.c	12 Aug 2002 18:12:24 -0000	1.4
@@ -15,7 +15,6 @@
  */
 
 #include <openssl/aes.h>
-#include <alloca.h>
 #include <string.h>
 #include <stdio.h>
 
@@ -29,14 +28,16 @@
 #undef SET_U32
 
 #ifdef MM_B_ENDIAN
-#define GET_U32(ptr) (*(ptr))
-#define SET_U32(ptr,i) (*(ptr)) = i 
+#define GET_U32(ptr) (*(u32*)(ptr))
+#define SET_U32(ptr,i) (*(u32*)(ptr)) = i 
+#define INCR_U32(ptr, i) i = ++(*(u32*)(ptr))
 #endif
 
-#if 0  /* On my Athlon, bswap_32 is actually slower.  Surprisingly,
-	 the code in glib/gtypes.h _is_ faster; but shaves only 1%
-         off encryption.  We seem to be near the point of diminishing
-         returns here. */
+#if 0  
+/* On my Athlon, bswap_32 is actually slower.  Surprisingly,
+   the code in glib/gtypes.h _is_ faster; but shaves only 1%
+   off encryption.  We seem to be near the point of diminishing
+   returns here. */
 #ifdef MM_L_ENDIAN
 #ifdef MM_HAVE_BYTESWAP_H
 #include <byteswap.h>
@@ -58,6 +59,7 @@
                              ptr[3] = (i>>24) & 0xff; } 
 #define GET_U32(ptr)   GET_U32_cp(((u8*)(ptr)))
 #define SET_U32(ptr,i) SET_U32_cp(((u8*)(ptr)), i)
+#define INCR_U32(ptr, i) { i = GET_U32(ptr); SET_U32(ptr,++i); }
 #endif
 
 static inline void
@@ -65,6 +67,17 @@
 {
 	u32 i;
 
+	INCR_U32(ctr32+3,i);
+	if (i) return;
+
+	INCR_U32(ctr32+2,i);
+	if (i) return;
+
+	INCR_U32(ctr32+1,i);
+	if (i) return;
+
+	INCR_U32(ctr32,  i);
+#if 0
 	i = GET_U32(ctr32+3) + 1;
 	SET_U32(ctr32+3, i);
 	if (i) return;
@@ -79,6 +92,7 @@
 			
 	i = GET_U32(ctr32) + 1;
 	SET_U32(ctr32, i);
+#endif
 }
 
 void