diff options
author | Peter Stirling <peter@pjstirling.plus.com> | 2021-12-06 12:14:35 -0600 |
---|---|---|
committer | Peter Stirling <peter@pjstirling.plus.com> | 2021-12-06 12:14:35 -0600 |
commit | ebc994b06409829c463b099fe460276cba564d43 (patch) | |
tree | 145824b5febcf0c056913f25f877ed31cb45969a | |
parent | 7160a053fcad7ea8e27769f69807a264de22f5ba (diff) |
eliminate all style warnings on sbcl
-rw-r--r-- | src/aead/eax.lisp | 3 | ||||
-rw-r--r-- | src/aead/etm.lisp | 3 | ||||
-rw-r--r-- | src/ciphers/blowfish.lisp | 39 | ||||
-rw-r--r-- | src/ciphers/chacha.lisp | 1 | ||||
-rw-r--r-- | src/ciphers/salsa20.lisp | 1 | ||||
-rw-r--r-- | src/ciphers/threefish.lisp | 3 | ||||
-rw-r--r-- | src/ciphers/xchacha.lisp | 1 | ||||
-rw-r--r-- | src/ciphers/xsalsa20.lisp | 1 | ||||
-rw-r--r-- | src/conditions.lisp | 1 | ||||
-rw-r--r-- | src/digests/digest.lisp | 2 | ||||
-rw-r--r-- | src/digests/jh.lisp | 1 | ||||
-rw-r--r-- | src/kdf/argon2.lisp | 1 |
12 files changed, 34 insertions, 23 deletions
diff --git a/src/aead/eax.lisp b/src/aead/eax.lisp index 5f55276..0b9c21e 100644 --- a/src/aead/eax.lisp +++ b/src/aead/eax.lisp @@ -52,8 +52,7 @@ mode) (defmethod process-associated-data ((mode eax) data &key (start 0) end) - (let* ((end (or end (length data))) - (length (- end start))) + (let* ((end (or end (length data)))) (update-mac (eax-mac-h mode) data :start start :end end))) (defmethod produce-tag ((mode eax) &key tag (tag-start 0)) diff --git a/src/aead/etm.lisp b/src/aead/etm.lisp index 96a21b9..8c97743 100644 --- a/src/aead/etm.lisp +++ b/src/aead/etm.lisp @@ -23,8 +23,7 @@ (defmethod process-associated-data ((mode etm) data &key (start 0) end) (if (encryption-started-p mode) (error 'ironclad-error :format-control "All associated data must be processed before the encryption begins.") - (let* ((end (or end (length data))) - (length (- end start))) + (let* ((end (or end (length data)))) (update-mac (etm-mac mode) data :start start :end end)))) (defmethod produce-tag ((mode etm) &key tag (tag-start 0)) diff --git a/src/ciphers/blowfish.lisp b/src/ciphers/blowfish.lisp index f1446fa..06240f8 100644 --- a/src/ciphers/blowfish.lisp +++ b/src/ciphers/blowfish.lisp @@ -222,25 +222,6 @@ (mod32+ (s-box-1 s-boxes (third-byte block)) (s-box-0 s-boxes (fourth-byte block)))))) -(defun initialize-blowfish-vectors (key p-array s-boxes) - (declare (type (simple-array (unsigned-byte 8) (*)) key)) - (declare (type blowfish-p-array p-array)) - (declare (type blowfish-s-boxes s-boxes)) - (mix-p-array key p-array) - (let ((data (make-array 8 :element-type '(unsigned-byte 8) :initial-element 0))) - (declare (type (simple-array (unsigned-byte 8) (8)) data)) - (do ((i 0 (+ i 2))) - ((= i (+ +blowfish-n-rounds+ 2))) - (blowfish-encrypt-block* p-array s-boxes data 0 data 0) - (setf (aref p-array i) (ub32ref/be data 0) - (aref p-array (1+ i)) (ub32ref/be data 4))) - (dotimes (i 4) - (do ((j 0 (+ j 2))) - ((= j 256)) - (blowfish-encrypt-block* p-array s-boxes data 0 data 0) - (setf (s-box s-boxes i j) (ub32ref/be data 0) - (s-box s-boxes i (1+ j)) (ub32ref/be data 4)))))) - (declaim (inline blowfish-encrypt-block*)) (defun blowfish-encrypt-block* (p-array s-boxes plaintext plaintext-start ciphertext ciphertext-start) @@ -261,6 +242,26 @@ (setf left (logxor left (aref p-array 16)) right (logxor right (aref p-array 17))) (store-words ciphertext ciphertext-start right left))) + +(defun initialize-blowfish-vectors (key p-array s-boxes) + (declare (type (simple-array (unsigned-byte 8) (*)) key)) + (declare (type blowfish-p-array p-array)) + (declare (type blowfish-s-boxes s-boxes)) + (mix-p-array key p-array) + (let ((data (make-array 8 :element-type '(unsigned-byte 8) :initial-element 0))) + (declare (type (simple-array (unsigned-byte 8) (8)) data)) + (do ((i 0 (+ i 2))) + ((= i (+ +blowfish-n-rounds+ 2))) + (blowfish-encrypt-block* p-array s-boxes data 0 data 0) + (setf (aref p-array i) (ub32ref/be data 0) + (aref p-array (1+ i)) (ub32ref/be data 4))) + (dotimes (i 4) + (do ((j 0 (+ j 2))) + ((= j 256)) + (blowfish-encrypt-block* p-array s-boxes data 0 data 0) + (setf (s-box s-boxes i j) (ub32ref/be data 0) + (s-box s-boxes i (1+ j)) (ub32ref/be data 4)))))) + (declaim (notinline blowfish-encrypt-block*)) (define-block-encryptor blowfish 8 diff --git a/src/ciphers/chacha.lisp b/src/ciphers/chacha.lisp index 9e7a76d..7402683 100644 --- a/src/ciphers/chacha.lisp +++ b/src/ciphers/chacha.lisp @@ -120,6 +120,7 @@ &key (key nil key-p) (initialization-vector nil iv-p) &allow-other-keys) + (declare (ignore initargs key key-p iv-p)) (setf (chacha-keystream-buffer-remaining cipher) 0) (when initialization-vector (when (< (length initialization-vector) 8) diff --git a/src/ciphers/salsa20.lisp b/src/ciphers/salsa20.lisp index c9d1771..e36a34a 100644 --- a/src/ciphers/salsa20.lisp +++ b/src/ciphers/salsa20.lisp @@ -116,6 +116,7 @@ &key (key nil key-p) (initialization-vector nil iv-p) &allow-other-keys) + (declare (ignore initargs key key-p iv-p)) (setf (salsa20-keystream-buffer-remaining cipher) 0) (when initialization-vector (when (< (length initialization-vector) 8) diff --git a/src/ciphers/threefish.lisp b/src/ciphers/threefish.lisp index 321a38a..8abfb88 100644 --- a/src/ciphers/threefish.lisp +++ b/src/ciphers/threefish.lisp @@ -49,6 +49,7 @@ &rest initargs &key (tweak nil tweak-p) &allow-other-keys) + (declare (ignore initargs tweak-p)) (when tweak (threefish-set-tweak cipher tweak)) cipher) @@ -235,6 +236,7 @@ &rest initargs &key (tweak nil tweak-p) &allow-other-keys) + (declare (ignore initargs tweak-p)) (when tweak (threefish-set-tweak cipher tweak)) cipher) @@ -509,6 +511,7 @@ &rest initargs &key (tweak nil tweak-p) &allow-other-keys) + (declare (ignore initargs tweak-p)) (when tweak (threefish-set-tweak cipher tweak)) cipher) diff --git a/src/ciphers/xchacha.lisp b/src/ciphers/xchacha.lisp index bb82abb..13ba51e 100644 --- a/src/ciphers/xchacha.lisp +++ b/src/ciphers/xchacha.lisp @@ -19,6 +19,7 @@ &key (key nil key-p) (initialization-vector nil iv-p) &allow-other-keys) + (declare (ignore initargs key key-p iv-p)) (let ((state (chacha-state cipher)) (buffer (make-array 64 :element-type '(unsigned-byte 8)))) (declare (type chacha-state state) diff --git a/src/ciphers/xsalsa20.lisp b/src/ciphers/xsalsa20.lisp index ef12d10..a75c5cf 100644 --- a/src/ciphers/xsalsa20.lisp +++ b/src/ciphers/xsalsa20.lisp @@ -19,6 +19,7 @@ &key (key nil key-p) (initialization-vector nil iv-p) &allow-other-keys) + (declare (ignore initargs key key-p iv-p)) (let ((state (salsa20-state cipher)) (buffer (make-array 64 :element-type '(unsigned-byte 8)))) (declare (type salsa20-state state) diff --git a/src/conditions.lisp b/src/conditions.lisp index 5f2df95..245c4bc 100644 --- a/src/conditions.lisp +++ b/src/conditions.lisp @@ -97,6 +97,7 @@ for a particular mode of operation but not supplied.")) (define-condition unsupported-argon2-parameters (ironclad-error) () (:report (lambda (condition stream) + (declare (ignore condition)) (format stream "Argon2 parameters not supported. block-count must be at least 8, key-length must be at least 4, salt must be at least 8 bytes long and iteration-count must be at least 1."))) (:documentation "Signaled when invalid Argon2 parameters are provided to MAKE-KDF.")) diff --git a/src/digests/digest.lisp b/src/digests/digest.lisp index 545eab9..4056aa0 100644 --- a/src/digests/digest.lisp +++ b/src/digests/digest.lisp @@ -253,6 +253,8 @@ ;;; more efficient, as well as more obvious about what you're trying to ;;; do. +(declaim (notinline make-digest)) + (defmethod digest-file ((digest-name cons) pathname &rest kwargs) (apply #'digest-file (apply #'make-digest digest-name) pathname kwargs)) (defmethod digest-file ((digest-name symbol) pathname &rest kwargs) diff --git a/src/digests/jh.lisp b/src/digests/jh.lisp index a875dd9..606db84 100644 --- a/src/digests/jh.lisp +++ b/src/digests/jh.lisp @@ -341,6 +341,7 @@ (defun jh-f8 (state) "The compression function." + (declare (notinline jh-buffer jh-state)) (let ((s (jh-state state)) (buffer (jh-buffer state)) (b (make-array 8 :element-type '(unsigned-byte 64)))) diff --git a/src/kdf/argon2.lisp b/src/kdf/argon2.lisp index ccda02e..0dee0e2 100644 --- a/src/kdf/argon2.lisp +++ b/src/kdf/argon2.lisp @@ -264,6 +264,7 @@ (defmethod shared-initialize ((kdf argon2) slot-names &rest initargs &key block-count additional-key additional-data &allow-other-keys) + (declare (ignore initargs)) (let ((no-data (make-array 0 :element-type '(unsigned-byte 8)))) (setf (argon2-block kdf) (make-array +argon2-block-size+ :element-type '(unsigned-byte 64)) |