Coverage report: /home/ellis/comp/ext/ironclad/src/ciphers/xsalsa20.lisp
Kind | Covered | All | % |
expression | 0 | 110 | 0.0 |
branch | 0 | 2 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;;; xsalsa20.lisp -- implementation of the XSalsa20 stream cipher
4
(defclass xsalsa20 (salsa20)
7
(defclass xsalsa20/12 (xsalsa20)
9
(:default-initargs :core-function #'salsa20/12-core))
11
(defclass xsalsa20/8 (xsalsa20)
13
(:default-initargs :core-function #'salsa20/8-core))
15
(defmethod shared-initialize :after ((cipher xsalsa20) slot-names
18
(initialization-vector nil iv-p)
20
(declare (ignore initargs key key-p iv-p))
21
(let ((state (salsa20-state cipher))
22
(buffer (make-array 64 :element-type '(unsigned-byte 8))))
23
(declare (type salsa20-state state)
24
(type salsa20-keystream-buffer buffer))
25
(when initialization-vector
26
(when (< (length initialization-vector) 24)
27
(error 'invalid-initialization-vector
28
:cipher (class-name (class-of cipher))
30
(setf (aref state 8) (ub32ref/le initialization-vector 8)
31
(aref state 9) (ub32ref/le initialization-vector 12)))
32
(funcall (salsa20-core-function cipher) buffer state)
33
(setf (aref state 1) (mod32- (ub32ref/le buffer 0) (aref state 0))
34
(aref state 2) (mod32- (ub32ref/le buffer 20) (aref state 5))
35
(aref state 3) (mod32- (ub32ref/le buffer 40) (aref state 10))
36
(aref state 4) (mod32- (ub32ref/le buffer 60) (aref state 15))
37
(aref state 11) (mod32- (ub32ref/le buffer 24) (aref state 6))
38
(aref state 12) (mod32- (ub32ref/le buffer 28) (aref state 7))
39
(aref state 13) (mod32- (ub32ref/le buffer 32) (aref state 8))
40
(aref state 14) (mod32- (ub32ref/le buffer 36) (aref state 9))
43
(if initialization-vector
44
(setf (aref state 6) (ub32ref/le initialization-vector 16)
45
(aref state 7) (ub32ref/le initialization-vector 20))
46
(setf (aref state 6) 0
52
(:crypt-function salsa20-crypt)
53
(:key-length (:fixed 16 32)))
55
(defcipher xsalsa20/12
57
(:crypt-function salsa20-crypt)
58
(:key-length (:fixed 16 32)))
62
(:crypt-function salsa20-crypt)
63
(:key-length (:fixed 16 32)))