[crypticl-cvs] CVS crypticl/src

tskogan tskogan at common-lisp.net
Sat Jan 27 17:07:17 UTC 2007


Update of /project/crypticl/cvsroot/crypticl/src
In directory clnet:/tmp/cvs-serv24062/src

Modified Files:
	random.lisp load.lisp keygenerator.lisp aes.lisp 
Log Message:
Get rid of load time warnings by reordering some code.

Becuase the random number generator uses aes, aes must come
before random, but aes depends on the keygenerator for
producing keys which again depends on random; a circle dependency.
Solve this a bit hackish by moving some aes code related to
keys into keygenerator.


--- /project/crypticl/cvsroot/crypticl/src/random.lisp	2007/01/27 11:28:30	1.9
+++ /project/crypticl/cvsroot/crypticl/src/random.lisp	2007/01/27 17:07:17	1.10
@@ -122,7 +122,7 @@
 The input should be high entropy bits, ideally 256 bits of entropy or more,
 given as a bignum or a byte array."
   (unless *random-secure-state*
-    (setf *random-secure-state* (make-SecurePRNG)))  
+    (setf *random-secure-state* (make-SecurePRNG-AES)))  
   (typecase new-seed
     (integer (reseed *random-secure-state* 
                      (integer-to-octet-vector new-seed)))
--- /project/crypticl/cvsroot/crypticl/src/load.lisp	2007/01/18 21:37:02	1.8
+++ /project/crypticl/cvsroot/crypticl/src/load.lisp	2007/01/27 17:07:17	1.9
@@ -21,11 +21,13 @@
 	       "utilities" 
 	       "numtheory"
 	       "common"
-	       "sha"			;used by random
-	       "random"
-	       "keygenerator"
-	       "md5" "aes" "idea" "dsa" "rsa" "diffie-hellman"
-	       "sha256"
+               "sha"
+	       "sha256"               
+               "aes"
+               "random"               
+	       "keygenerator"               
+	       "md5" "idea" "dsa" "rsa" "diffie-hellman"
+	       
 	       "keystore"
 	       "test")))
   (format t "Loading the Crypticl library...")
--- /project/crypticl/cvsroot/crypticl/src/keygenerator.lisp	2007/01/17 22:00:52	1.7
+++ /project/crypticl/cvsroot/crypticl/src/keygenerator.lisp	2007/01/27 17:07:17	1.8
@@ -124,4 +124,9 @@
 
 
 
+(defun aes-generate-key (&optional (bitsize 128) encoding)
+  (declare (ignore encoding))
+  (assert (member bitsize '(128 192 256)) () "AES invalid key size ~A" bitsize)
+  (generate-symmetric-key bitsize "AES"))
 
+(register-key-generator 'AES #'aes-generate-key)
\ No newline at end of file
--- /project/crypticl/cvsroot/crypticl/src/aes.lisp	2007/01/23 23:55:39	1.9
+++ /project/crypticl/cvsroot/crypticl/src/aes.lisp	2007/01/27 17:07:17	1.10
@@ -658,12 +658,6 @@
 (defmethod decrypt ((obj AES) &optional data (start 0) (end (length data)))
   (update-and-decrypt obj data start end))
      
-
-(defun aes-generate-key (&optional (bitsize 128) encoding)
-  (declare (ignore encoding))
-  (assert (member bitsize '(128 192 256)) () "AES invalid key size ~A" bitsize)
-  (generate-symmetric-key bitsize "AES"))
-
    
 ;;;;;;;
 ;;; Test suite
@@ -749,7 +743,7 @@
   "Testing long vector."
   (let ((aa (make-AES))
 	(tmp nil)
-	(key (generate-key 'AES 128))
+	(key #16(2)) ;(generate-key 'AES 128)) Use a fixed key
 	(iv #16(2))
 	(clear #500(3)))
     (format t "~&AES long vector...")
@@ -797,9 +791,3 @@
 
 
 (register-constructor 'AES #'make-AES)
-(register-key-generator 'AES #'aes-generate-key)
-
-		  
-		      
-		
-  




More information about the Crypticl-cvs mailing list