Update of /project/crypticl/cvsroot/crypticl/src In directory common-lisp.net:/tmp/cvs-serv3642/src
Modified Files: aes.lisp common.lisp crypticl-package.lisp des.lisp diffie-hellman.lisp dsa.lisp idea.lisp keygenerator.lisp load.lisp md5.lisp numtheory.lisp random.lisp rsa.lisp sha.lisp test.lisp utilities.lisp Log Message: See ChangeLog for details.
Date: Sun Nov 7 01:17:38 2004 Author: tskogan
Index: crypticl/src/aes.lisp diff -u crypticl/src/aes.lisp:1.1.1.1 crypticl/src/aes.lisp:1.2 --- crypticl/src/aes.lisp:1.1.1.1 Mon Sep 20 21:13:27 2004 +++ crypticl/src/aes.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: AES ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -660,12 +660,12 @@ (error error-msg)))
-(defun aes-test-suite-CLOS ( &optional verbosity) +(defun aes-test-suite-CLOS () (let* ((clear-org ;testing un-aligned, long data - "00112233445566778899aabbccddeeff00112233445566778899aabbccdd") - (key-org + "00112233445566778899aabbccddeeff00112233445566778899aabbccdd") + (key-org "000102030405060708090a0b0c0d0e0f") - (iv-org + (iv-org "01010101010101010101010101010101") (encrypted "a9541c06f1c21125e44013531e18f40682ffe0983d47361887c2b1d2a0bdf077") @@ -673,16 +673,12 @@ "a9541c06f1c21125e44013531e18f406") (final-encrypted "82ffe0983d47361887c2b1d2a0bdf077") - (CLC-verbose *CLC-verbose*) - - (aa (make-AES)) - (tmp nil) - (tmp2 nil) - (clear (hexo clear-org)) - (key (hexo key-org)) + (aa (make-AES)) + (tmp nil) + (tmp2 nil) + (clear (hexo clear-org)) + (key (hexo key-org)) (iv (hexo iv-org))) - - (setf *CLC-verbose* verbosity) ;Turn off debug msg (format t "~&Testing AES CLOS...")
(formatv t "~&Clear text:~%~A" (hex clear)) @@ -717,7 +713,6 @@ (str-check (hex (concat tmp tmp2)) clear-org "AES decryption update + encrypt")
- (setf *CLC-verbose* CLC-verbose) ;Restore verbosity level (format t "OK.")))
@@ -736,26 +731,21 @@ (error "AES on FIPS 197 test vector")) (format t "OK."))))
-(defun aes-test-suite-long (&optional verbosity) +(defun aes-test-suite-long () "Testing long vector." (let ((aa (make-AES)) (tmp nil) (key (generate-key 'AES 128)) (iv #16(2)) - (clear #500(3)) - (CLC-verbose *CLC-verbose*)) - - (setf *CLC-verbose* verbosity) + (clear #500(3))) (format t "~&Testing AES long vector...") - (init-encrypt aa key :iv iv) (setf tmp (encrypt aa clear)) (init-decrypt aa key :iv iv) (setf tmp (decrypt aa tmp)) (assert (equalp tmp clear) () "AES long decryption and decryption") - (format t "OK.") - (setf *CLC-verbose* CLC-verbose))) ;Restore verbosity level)) + (format t "OK.")))
(defun test-AES () (aes-test-suite-fips-197) @@ -794,7 +784,8 @@
- +(register-constructor 'AES #'make-AES) +
Index: crypticl/src/common.lisp diff -u crypticl/src/common.lisp:1.1.1.1 crypticl/src/common.lisp:1.2 --- crypticl/src/common.lisp:1.1.1.1 Mon Sep 20 21:13:28 2004 +++ crypticl/src/common.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Common functionality. ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -11,6 +11,10 @@
(in-package crypticl)
+(defun print-external-symbols () + (do-external-symbols (symbl *package* nil) + (print symbl))) + (defclass Crypto () ((algorithm :accessor algorithm :initarg :algorithm)) @@ -46,33 +50,11 @@ "Common super class for all signature algorithms"))
-(defun make-Cipher-instance (algorithm) - (cond - ((string= algorithm "AES") (make-AES)) - ((string= algorithm "IDEA") (make-IDEA)) - (t (error "No such algorithm ~A" algorithm )))) - - -(defun make-Hash-instance (algorithm) - "Returns a hash object." - (cond - ((string= algorithm "SHA1") (make-SHA1)) - ((string= algorithm "MD5") (make-MD5)) - (t (error "No such algorithm ~A" algorithm )))) - -(defun make-Signature-instance (algorithm) - "Returns a hash object." - (cond - ((string= algorithm "DSA") (make-DSA)) - (t (error "No such algorithm ~A" algorithm )))) - - - ;; Designed for using symbols as keys. Use :test #'equal with strings. (defparameter *constructor-table* (make-hash-table :test #'equal))
(defun register-constructor (algorithm constructor) - "register on both string value and symbol value. To use symbol value from an external package, prefix with 'clc:, i.e. 'clc:AES" + "register on both string value and symbol value. To use symbol value from an external package, prefix with package name, i.e. 'crypticl:AES" (setf (gethash algorithm *constructor-table*) constructor) (setf (gethash (symbol-name algorithm) *constructor-table*) constructor)) @@ -91,7 +73,7 @@ "Main function for getting new instances of an algorithm. " (do ((fun (get-constructor algorithm) (get-constructor algorithm))) (fun (apply fun '())) - (restart-case (error "clc:new-instance: No such algorithm ~A implemented." algorithm) + (restart-case (error "new-instance: No such algorithm ~A implemented." algorithm) (store-value (value) :report "Try another algorithm." :interactive (lambda () @@ -105,7 +87,7 @@
(defun load-algorithm (&optional (path "des.lisp")) - "Dynamic loading of new algorithms. The protocol new code must follow is illustraded in the file CLC_des.lisp." + "Dynamic loading of new algorithms. The protocol new code must follow is illustraded in the file des.lisp." (compile-file path) (load path))
@@ -174,7 +156,7 @@ ;;;;;; ;;; MD5 ;; Included here to bypass compiler error when compiling the -;; md5-function-ffgghhii macro in CLC_md5.lisp. +;; md5-function-ffgghhii macro in md5.lisp. (defparameter *random-sine-table* (make-array 64 :element-type '(unsigned-byte 32) @@ -306,11 +288,11 @@
;;;;;; ;;; DIV -(defparameter *CLC-verbose* nil) +(defparameter *verbose* nil)
(defun formatv (&rest args) - "Handle arguments as format if *CLC-vervose is true" - (when *CLC-verbose* + "Act as format if verbosity is set" + (when *verbose* (apply #'format args)))
Index: crypticl/src/crypticl-package.lisp diff -u crypticl/src/crypticl-package.lisp:1.1.1.1 crypticl/src/crypticl-package.lisp:1.2 --- crypticl/src/crypticl-package.lisp:1.1.1.1 Mon Sep 20 21:13:28 2004 +++ crypticl/src/crypticl-package.lisp Sun Nov 7 01:17:35 2004 @@ -56,16 +56,32 @@ print-external-symbols))
-(defun load-crypticl (&optional (location "")) - "Load the crypticl library. Default location is the current directory." - (let ((files '("load"))) +(in-package crypticl) + +(defun load-package (&optional (path "") (fast-load nil)) + "Load library. Default src location is current directory. If fast-load is true, do quick load without recompiling and running unit tests." + + (format t "Loading the Crypticl library...") + ;; NB! The order of the file names in the list matter. + (let ((files '("utilities" + "numtheory" + "common" + "sha" ;used by random + "random" + "keygenerator" + "md5" "aes" "idea" "dsa" "rsa" "diffie-hellman" + "test"))) (dolist (file files) - (let ((module (concatenate 'string location file))) - (compile-file-if-needed module) + (let ((module (concatenate 'string path file))) + (if fast-load + (excl::compile-file-if-needed module) + (compile-file module :verbose nil)) (load module))) - (crypticl:load-package location)))
+ (unless fast-load + (run-tests)))) +
-(load-crypticl) +(load-package)
Index: crypticl/src/des.lisp diff -u crypticl/src/des.lisp:1.1.1.1 crypticl/src/des.lisp:1.2 --- crypticl/src/des.lisp:1.1.1.1 Mon Sep 20 21:13:28 2004 +++ crypticl/src/des.lisp Sun Nov 7 01:17:35 2004 @@ -1,12 +1,12 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: A void DES implementation. ;;;; Author: Tåle Skogan tasko@frisurf.no ;;;; Distribution: See the accompanying file LICENSE.
;;; DES has not been implemented, but a DES class and some -;;; empty functions are included for use when testing dynamic loading. +;;; empty functions are included to test adding a new algorithm.
(in-package crypticl)
@@ -18,11 +18,9 @@ (make-instance 'DES))
(defmethod encrypt ((obj DES) &optional data (start 0) (end (length data))) - (list data start end) ;avoiding compiler warning - (format t "Entered DES encrypt")) + (declare (ignore start end)))
(defun register-des () (register-constructor 'DES #'make-DES)) -
(register-des)
Index: crypticl/src/diffie-hellman.lisp diff -u crypticl/src/diffie-hellman.lisp:1.1.1.1 crypticl/src/diffie-hellman.lisp:1.2 --- crypticl/src/diffie-hellman.lisp:1.1.1.1 Mon Sep 20 21:13:29 2004 +++ crypticl/src/diffie-hellman.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Diffie-Hellman ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -57,6 +57,6 @@ (list s1 s2)))
- +(register-constructor 'Diffie-Hellman #'make-Diffie-Hellman)
Index: crypticl/src/dsa.lisp diff -u crypticl/src/dsa.lisp:1.1.1.1 crypticl/src/dsa.lisp:1.2 --- crypticl/src/dsa.lisp:1.1.1.1 Mon Sep 20 21:13:30 2004 +++ crypticl/src/dsa.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: The Digital Signature Algorithm (DSA). ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -207,6 +207,83 @@ (return k)))))
+(defclass DSAPrivateKey (PrivateKey) + ((p :accessor p :initarg :p) + (q :accessor q :initarg :q) + (g :accessor g :initarg :g) + (x :accessor x :initarg :x) + (y :accessor y :initarg :y))) + +(defun make-DSAPrivateKey (p q g x y) + (make-instance 'DSAPrivateKey :p p :q q :g g :x x :y y :algorithm "DSA")) + +(defmethod string-rep ((obj DSAPrivateKey)) + (format nil "~A ~A ~A ~A ~A" (p obj) (q obj) (g obj) (x obj) (y obj))) + +(defmethod print-object ((obj DSAPrivateKey) stream) + (format stream "<DSAPrivateKey>")) +;; Long output +;; (format stream "<DSAPrivateKey p=~A q=~A g=~A x=~A y=~A>" (p obj) (q obj) (g obj) (x obj) (y obj))) + +(defclass DSAPublicKey (PublicKey) + ((p :accessor p :initarg :p) + (q :accessor q :initarg :q) + (g :accessor g :initarg :g) + (y :accessor y :initarg :y))) + +(defun make-DSAPublicKey (p q g y) + (make-instance 'DSAPublicKey :p p :q q :g g :y y :algorithm "DSA")) + +(defun make-DSAPublicKey-from-encoding (encoding) + (let ((lst (construct-from-encoding encoding 'DSA))) + (make-instance 'DSAPublicKey + :p (first lst) + :q (second lst) + :g (third lst) + :y (fourth lst) + :algorithm "DSA"))) + +(defun make-DSAPrivateKey-from-encoding (encoding) + (let ((lst (construct-from-encoding encoding 'DSA))) + (make-instance 'DSAPrivateKey + :p (first lst) + :q (second lst) + :g (third lst) + :x (fourth lst) + :y (fifth lst) + :algorithm "DSA"))) + +(defmethod string-rep ((obj DSAPublicKey)) + (format nil "~A ~A ~A ~A" (p obj) (q obj) (g obj) (y obj))) + +(defmethod print-object ((obj DSAPublicKey) stream) + (format stream "<DSAPublicKey>))")) + +;; Long output format +;; (format stream "<DSAPublicKey p=~A q=~A g=~A y=~A>" (p obj) (q obj) (g obj) (y obj))) + +(defclass DSAKeyPair (KeyPair) + ()) + +(defun make-DSAKeyPair (p q g x y) + (make-instance 'DSAKeyPair + :public (make-DSAPublicKey p q g y) + :private (make-DSAPrivateKey p q g x y))) + +(defun dsa-generate-keys () + "Return a DSAKeyPair" + (format t "~&Generating DSA keys, this may take some time...") + (let ((alg (make-DSA :defaultp t))) + (make-DSAKeyPair (p alg) (q alg) (g alg) (x alg) (y alg)))) + +(defmethod get-encoding ((obj DSAPublicKey)) + (get-element-encodings (list (p obj) (q obj) (g obj) (y obj)))) + +(defmethod get-encoding ((obj DSAPrivateKey)) + (get-element-encodings (list (p obj) (q obj) (g obj) (x obj) (y obj)))) + + +
;;;;;;; ;;; Test suite @@ -312,3 +389,4 @@ ;;; (values p q)))
+(register-constructor 'DSA #'make-DSA) \ No newline at end of file
Index: crypticl/src/idea.lisp diff -u crypticl/src/idea.lisp:1.1.1.1 crypticl/src/idea.lisp:1.2 --- crypticl/src/idea.lisp:1.1.1.1 Mon Sep 20 21:13:33 2004 +++ crypticl/src/idea.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: IDEA - International Data Encryption Algorithm ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -627,5 +627,5 @@ |#
- +(register-constructor 'IDEA #'make-IDEA)
Index: crypticl/src/keygenerator.lisp diff -u crypticl/src/keygenerator.lisp:1.1.1.1 crypticl/src/keygenerator.lisp:1.2 --- crypticl/src/keygenerator.lisp:1.1.1.1 Mon Sep 20 21:13:36 2004 +++ crypticl/src/keygenerator.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Key generation and key store. ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -24,7 +24,7 @@ ())
(defmethod print-object ((obj SymmetricKey) stream) - (format stream "<clc:SymmetricKey value:#X~A>" (hex (key obj)))) + (format stream "<SymmetricKey value:#X~A>" (hex (key obj))))
(defclass AsymmetricKey (Key) ()) @@ -44,12 +44,6 @@ (defclass PrivateKey (AsymmetricKey) ())
- - - - - - (defclass Diffie-HellmanKey (Key) ((g :accessor g :initarg :g) (p :accessor p :initarg :p) @@ -86,87 +80,8 @@ (defmethod get-encoding ((obj Diffie-HellmanKey)) (get-element-encodings (list (g obj) (p obj))))
- - - -
-(defclass DSAPrivateKey (PrivateKey) - ((p :accessor p :initarg :p) - (q :accessor q :initarg :q) - (g :accessor g :initarg :g) - (x :accessor x :initarg :x) - (y :accessor y :initarg :y))) - -(defun make-DSAPrivateKey (p q g x y) - (make-instance 'DSAPrivateKey :p p :q q :g g :x x :y y :algorithm "DSA")) - -(defmethod string-rep ((obj DSAPrivateKey)) - (format nil "~A ~A ~A ~A ~A" (p obj) (q obj) (g obj) (x obj) (y obj))) - -(defmethod print-object ((obj DSAPrivateKey) stream) - (format stream "clc:DSAPrivateKey")) -;; Long output -;; (format stream "<clc:DSAPrivateKey p=~A q=~A g=~A x=~A y=~A>" (p obj) (q obj) (g obj) (x obj) (y obj))) - -(defclass DSAPublicKey (PublicKey) - ((p :accessor p :initarg :p) - (q :accessor q :initarg :q) - (g :accessor g :initarg :g) - (y :accessor y :initarg :y))) - -(defun make-DSAPublicKey (p q g y) - (make-instance 'DSAPublicKey :p p :q q :g g :y y :algorithm "DSA")) - -(defun make-DSAPublicKey-from-encoding (encoding) - (let ((lst (construct-from-encoding encoding 'DSA))) - (make-instance 'DSAPublicKey - :p (first lst) - :q (second lst) - :g (third lst) - :y (fourth lst) - :algorithm "DSA"))) - -(defun make-DSAPrivateKey-from-encoding (encoding) - (let ((lst (construct-from-encoding encoding 'DSA))) - (make-instance 'DSAPrivateKey - :p (first lst) - :q (second lst) - :g (third lst) - :x (fourth lst) - :y (fifth lst) - :algorithm "DSA"))) - -(defmethod string-rep ((obj DSAPublicKey)) - (format nil "~A ~A ~A ~A" (p obj) (q obj) (g obj) (y obj))) - -(defmethod print-object ((obj DSAPublicKey) stream) - (format stream "clc:DSAPublicKey))")) -;; Long output format -;; (format stream "<clc:DSAPublicKey p=~A q=~A g=~A y=~A>" (p obj) (q obj) (g obj) (y obj))) - -(defclass DSAKeyPair (KeyPair) - ()) - -(defun make-DSAKeyPair (p q g x y) - (make-instance 'DSAKeyPair - :public (make-DSAPublicKey p q g y) - :private (make-DSAPrivateKey p q g x y))) - -(defun dsa-generate-keys () - "Return a DSAKeyPair" - (format t "~&Generating DSA keys, this may take some time...") - (let ((alg (make-DSA :defaultp t))) - (make-DSAKeyPair (p alg) (q alg) (g alg) (x alg) (y alg)))) - -(defmethod get-encoding ((obj DSAPublicKey)) - (get-element-encodings (list (p obj) (q obj) (g obj) (y obj)))) - -(defmethod get-encoding ((obj DSAPrivateKey)) - (get-element-encodings (list (p obj) (q obj) (g obj) (x obj) (y obj)))) - -
(defclass RSAPublicKey (PublicKey) ((e :accessor e :initarg :e) ;public exponent @@ -179,7 +94,7 @@ (format nil "~A ~A" (e obj) (n obj)))
(defmethod print-object ((obj RSAPublicKey) stream) - (format stream "<clc:RSAPublicKey e=~A n=~A>" (e obj) (n obj))) + (format stream "<RSAPublicKey e=~A n=~A>" (e obj) (n obj)))
(defclass RSAPrivateKey (PrivateKey) ((d :accessor d :initarg :d) ;private exponent @@ -206,7 +121,7 @@ (format nil "~A ~A" (d obj) (n obj)))
(defmethod print-object ((obj RSAPrivateKey) stream) - (format stream "<clc:RSAPrivateKey d=~A n=~A>" (d obj) (n obj))) + (format stream "<RSAPrivateKey d=~A n=~A>" (d obj) (n obj)))
(defmethod get-encoding ((obj RSAPublicKey)) (get-element-encodings (list (e obj) (n obj)))) @@ -276,7 +191,7 @@ (make-DSAPrivateKey-from-encoding encoding)) ((or (equal type 'Diffie-HellmanKey) (string= type "Diffie-Hellman")) (make-Diffie-HellmanKey-from-encoding encoding)) - (t (error "clc:generate-key:Unknown algorithm=~S of type=~A" + (t (error "generate-key:Unknown algorithm=~S of type=~A" type (type-of type)))))
((or (equal type 'AES) (string= type "AES")) @@ -289,7 +204,7 @@ (dsa-generate-keys)) ((or (equal type 'Diffie-Hellman) (string= type "Diffie-Hellman")) (Diffie-Hellman-generate-key bitsize)) - (t (error "clc:generate-key:Cannot generate key of type ~A" type)))) + (t (error "generate-key:Cannot generate key of type ~A" type))))
@@ -584,3 +499,11 @@ (get-public-keys obj user)))
+;; Register all key generators +(register-key-generator 'AES #'aes-generate-key) +(register-key-generator 'IDEA #'idea-generate-key) +(register-key-generator 'RSA #'rsa-generate-keys) +(register-key-generator 'DSA #'dsa-generate-keys) +(register-key-generator 'Diffie-Hellman #'Diffie-Hellman-generate-key) + +(register-constructor 'KeyStore #'make-KeyStore) \ No newline at end of file
Index: crypticl/src/load.lisp diff -u crypticl/src/load.lisp:1.1.1.1 crypticl/src/load.lisp:1.2 --- crypticl/src/load.lisp:1.1.1.1 Mon Sep 20 21:13:37 2004 +++ crypticl/src/load.lisp Sun Nov 7 01:17:35 2004 @@ -8,69 +8,16 @@ ;;TO DO
-(in-package crypticl) - -(defun load-package (&optional (prefix "")) - "Load library. Default src location is current directory." - (format t "Compiling, loading and testing the Crypticl library...") - ;; NB! The order of the file names in the list matter. - (let ((files '("utilities" - "numtheory" - "common" - "sha" ;used by random - "random" - "keygenerator" - "md5" "aes" "idea" "rsa" "dsa" "diffie-hellman" - "test"))) - (dolist (file files) - (let ((module (concatenate 'string prefix file))) - (compile-file module) - (load module))) - - (test-CLC) - - (register-CLC-constructors) - (register-CLC-key-generators))) - -(defun fast-load-package (&optional (prefix "")) - "Note that the order of the file names in the list 'files' matter. Loads without recompiling and testing." - (format t "Fast loading the Crypticl library...") - (let ((files '("utilities" - "numtheory" - "common" - "sha" ;used by random - "random" - "keygenerator" - "md5" "aes" "idea" "rsa" "dsa" "Diffie-Hellman" - "test"))) - (dolist (file files) - (let ((module (concatenate 'string prefix file))) - (excl::compile-file-if-needed module) - (load module)))
- (register-CLC-constructors) - (register-CLC-key-generators)))
-;; Register constructors -(defun register-CLC-constructors () - (register-constructor 'SHA1 #'make-SHA1) - (register-constructor 'MD5 #'make-MD5) - (register-constructor 'AES #'make-AES) - (register-constructor 'IDEA #'make-IDEA) - (register-constructor 'DSA #'make-DSA) - (register-constructor 'RSA #'make-RSA) - (register-constructor 'SHA1withRSA #'make-SHA1withRSA) - (register-constructor 'KeyStore #'make-KeyStore) - (register-constructor 'Diffie-Hellman #'make-Diffie-Hellman))
-;; Register key generators -(defun register-CLC-key-generators () - (register-key-generator 'AES #'aes-generate-key) - (register-key-generator 'IDEA #'idea-generate-key) - (register-key-generator 'RSA #'rsa-generate-keys) - (register-key-generator 'DSA #'dsa-generate-keys) - (register-key-generator 'Diffie-Hellman #'Diffie-Hellman-generate-key)) + + + + + +
+ +
-(defun print-external-symbols () - (do-external-symbols (s 'clc nil) (print s))) \ No newline at end of file
Index: crypticl/src/md5.lisp diff -u crypticl/src/md5.lisp:1.1.1.1 crypticl/src/md5.lisp:1.2 --- crypticl/src/md5.lisp:1.1.1.1 Mon Sep 20 21:13:39 2004 +++ crypticl/src/md5.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: The RSA MD5 message digest algorithm from Internet RFC 1321. ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -40,7 +40,7 @@ ;;;;;;; ;;; Low level MD5 functions
-;; Also included in CLC_common.lisp to bypass compiler error when compiling +;; Also included in common.lisp to bypass compiler error when compiling ;; the md5-function-ffgghhii macro.
(unless (boundp '*random-sine-table*) @@ -447,3 +447,6 @@ (md5-test 'MD5/long (list (list #9999(2) "a373b18167a1abd419ed333afec8ea32")))) + + +(register-constructor 'MD5 #'make-MD5) \ No newline at end of file
Index: crypticl/src/numtheory.lisp diff -u crypticl/src/numtheory.lisp:1.1.1.1 crypticl/src/numtheory.lisp:1.2 --- crypticl/src/numtheory.lisp:1.1.1.1 Mon Sep 20 21:13:40 2004 +++ crypticl/src/numtheory.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Number theoretic utilities, including primality testing. ;;;; Author: Tåle Skogan tasko@frisurf.no
Index: crypticl/src/random.lisp diff -u crypticl/src/random.lisp:1.1.1.1 crypticl/src/random.lisp:1.2 --- crypticl/src/random.lisp:1.1.1.1 Mon Sep 20 21:13:41 2004 +++ crypticl/src/random.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Pseudo random number generation. ;;;; Author: Tåle Skogan tasko@frisurf.no
Index: crypticl/src/rsa.lisp diff -u crypticl/src/rsa.lisp:1.1.1.1 crypticl/src/rsa.lisp:1.2 --- crypticl/src/rsa.lisp:1.1.1.1 Mon Sep 20 21:13:44 2004 +++ crypticl/src/rsa.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: RSA encryption/decryption according to PKCS#1 ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -153,14 +153,14 @@ (defmethod init-encrypt ((obj RSA) key &key mode iv padding) "mode, iv and padding are only included for conformity with other Cipher objects and are not used." (when (or mode iv padding) - (warn "clc:Using mode(~A)/iv(~A)/padding(~A) makes no sense for RSA encrypt. These options will be ignored." + (warn "Using mode(~A)/iv(~A)/padding(~A) makes no sense for RSA encrypt. These options will be ignored." mode iv padding)) (init obj key :encryptp t ))
(defmethod init-decrypt ((obj RSA) key &key mode iv padding) "mode, iv and padding are only included for conformity with other Cipher objects and are not used." (when (or mode iv padding) - (warn "clc:Using mode(~A)/iv(~A)/padding(~A) makes no sense for RSA decrypt. These options will be ignored." + (warn "Using mode(~A)/iv(~A)/padding(~A) makes no sense for RSA decrypt. These options will be ignored." mode iv padding)) (init obj key :encryptp nil))
@@ -418,3 +418,7 @@ (test prime1 exponent) (test prime2 exponent)) result)) + + +(register-constructor 'RSA #'make-RSA) +(register-constructor 'SHA1withRSA #'make-SHA1withRSA) \ No newline at end of file
Index: crypticl/src/sha.lisp diff -u crypticl/src/sha.lisp:1.1.1.1 crypticl/src/sha.lisp:1.2 --- crypticl/src/sha.lisp:1.1.1.1 Mon Sep 20 21:13:46 2004 +++ crypticl/src/sha.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: The SHA-1 message digest algorithm. ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -398,3 +398,6 @@ "f4c046625d9c6672e0356bbe0ed5cd93adfa924b") () "sha1 test for long test vector 200000.") (format t "Done testing long vector.~%")))) + + +(register-constructor 'SHA1 #'make-SHA1) \ No newline at end of file
Index: crypticl/src/test.lisp diff -u crypticl/src/test.lisp:1.1.1.1 crypticl/src/test.lisp:1.2 --- crypticl/src/test.lisp:1.1.1.1 Mon Sep 20 21:13:46 2004 +++ crypticl/src/test.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Test code for the library. ;;;; Author: Tåle Skogan tasko@frisurf.no @@ -7,7 +7,7 @@
(in-package crypticl)
-(defun test-dynamic-load (&key keystore (path "CLC_des.lisp")) +(defun test-dynamic-load (&key keystore (path "des.lisp")) "Testing dynamic loading of new algorithms." (let ((ks (or keystore (new-instance 'KeyStore))) (dsa (new-instance 'DSA)) @@ -47,7 +47,7 @@ (format t "Bad signature for file ~A, aborting load." path))))
-(defun test-CLC () +(defun run-tests() (test-SHA1) (test-MD5) (test-AES)
Index: crypticl/src/utilities.lisp diff -u crypticl/src/utilities.lisp:1.1.1.1 crypticl/src/utilities.lisp:1.2 --- crypticl/src/utilities.lisp:1.1.1.1 Mon Sep 20 21:13:47 2004 +++ crypticl/src/utilities.lisp Sun Nov 7 01:17:35 2004 @@ -1,5 +1,5 @@ ;;;;-*-lisp-*- -;;;; The CLC cryptographic library. +;;;; The Crypticl cryptographic library. ;;;; ;;;; Description: Non-cryptopgrahic utilities ;;;; Author: Tåle Skogan tasko@frisurf.no