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

[minion-cvs] More testing, docs: some bulletproofing, some bugfixing



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

Modified Files:
	aes_ctr.c crypt.c 
Log Message:
More testing, docs: some bulletproofing, some bugfixing

BuildMessage:
	- Bugfixing, slight doc improvement.
	- Some (not enough) zlib bulletproofing

Main:
	- More verboseness on import failure

Modules:
	- Start of e2e work for exit modules

Packet:
	- Loads of docs; more symbolic consts

test:
	- More tests for e2e message encoding
	- Cache RSA keys and avoid DH retesting to speed tests by a factor 
          of 3 to 4.
	- Make 'Gravity's Rainbow' example more explicit

aes_ctr.c:
	- Remove ancient if-0'd coded

crypt.c:
	- Bulletproof rsa_generate to withstandd silly values of n,e.
	



Index: aes_ctr.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/aes_ctr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- aes_ctr.c	15 Aug 2002 05:26:08 -0000	1.5
+++ aes_ctr.c	16 Oct 2002 23:12:13 -0000	1.6
@@ -45,7 +45,7 @@
 #define SET_U32(ptr,i) (*(u32*)(ptr)) = bswap_32(i)
 #endif
 #endif
-#endif 
+#endif /* if 0 */
 
 
 #ifndef GET_U32 
@@ -77,22 +77,6 @@
 	if (i) return;
 
 	INCR_U32(ctr32,  i);
-#if 0
-	i = GET_U32(ctr32+3) + 1;
-	SET_U32(ctr32+3, i);
-	if (i) return;
-	
-	i = GET_U32(ctr32+2) + 1;
-	SET_U32(ctr32+2, i);
-	if (i) return;
-	
-	i = GET_U32(ctr32+1) + 1;
-	SET_U32(ctr32+1, i);
-	if (i) return;
-			
-	i = GET_U32(ctr32) + 1;
-	SET_U32(ctr32, i);
-#endif
 }
 
 void

Index: crypt.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/crypt.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- crypt.c	21 Aug 2002 15:54:48 -0000	1.12
+++ crypt.c	16 Oct 2002 23:12:13 -0000	1.13
@@ -350,6 +350,15 @@
 					 &bits, &e))
 		return NULL;
 
+	if ((bits < 64) || (bits > 16384)) {
+		PyErr_SetString(mm_CryptoError, "Invalid length for RSA key");
+		return NULL;
+	} 
+	if (e < 2) {
+		PyErr_SetString(mm_CryptoError, "Invalid RSA exponent");
+		return NULL;
+	}
+
 	rsa = RSA_generate_key(bits, e, NULL, NULL);
 	if (rsa == NULL) {
 		mm_SSL_ERR(1);