Coverage report: /home/ellis/comp/ext/ironclad/src/conditions.lisp
Kind | Covered | All | % |
expression | 0 | 200 | 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
;;;; conditions.lisp -- various error conditions
4
(define-condition ironclad-error (simple-error)
7
(define-condition key-not-supplied (ironclad-error)
8
((cipher :initarg :cipher :reader cipher))
9
(:report (lambda (condition stream)
10
(format stream "Cipher ~A requires a key." (cipher condition))))
11
(:documentation "Signaled when a key is not provided at the initialization
14
(define-condition initialization-vector-not-supplied (ironclad-error)
15
((mode :initarg :mode :reader mode))
16
(:report (lambda (condition stream)
17
(format stream "Mode ~A requires an initialization vector."
19
(:documentation "Signaled when an initialization vector is required
20
for a particular mode of operation but not supplied."))
22
(define-condition invalid-initialization-vector (ironclad-error)
23
((cipher :initarg :cipher :reader cipher)
24
(block-length :initarg :block-length :reader block-length))
25
(:report (lambda (condition stream)
26
(format stream "Cipher ~A requires an initialization vector of length ~D."
28
(block-length condition))))
29
(:documentation "Signaled when an invalid initialization vector is supplied to MAKE-CIPHER."))
31
(define-condition invalid-key-length (ironclad-error)
32
((cipher :initarg :cipher :reader cipher)
33
(lengths :initarg :accepted-lengths :reader accepted-lengths))
34
(:report (lambda (condition stream)
35
(format stream "Cipher ~A only accepts keys of these lengths: ~A."
37
(accepted-lengths condition))))
38
(:documentation "Signaled when a key is not the proper length for a cipher."))
40
(define-condition unsupported-cipher (ironclad-error)
41
((cipher :initarg :name :reader cipher))
42
(:report (lambda (condition stream)
43
(format stream "Cipher ~A is not a supported cipher."
45
(:documentation "Signaled when an invalid cipher name is provided to MAKE-CIPHER."))
47
(define-condition unsupported-mode (ironclad-error)
48
((mode :initarg :mode :reader mode)
49
(cipher :initarg :cipher :reader cipher))
50
(:report (lambda (condition stream)
51
(if (cipher condition)
52
(format stream "Mode ~A is not a supported mode for ~A."
53
(mode condition) (cipher condition))
54
(format stream "Mode ~A is not a supported mode."
56
(:documentation "Signaled when an invalid mode name is provided to MAKE-CIPHER."))
58
(define-condition unsupported-padding (ironclad-error)
59
((padding :initarg :name :reader padding))
60
(:report (lambda (condition stream)
61
(format stream "Padding ~A is not a supported padding."
62
(padding condition))))
63
(:documentation "Signaled when an invalid padding name is provided to MAKE-CIPHER."))
65
(define-condition unsupported-digest (ironclad-error)
66
((digest :initarg :name :reader digest))
67
(:report (lambda (condition stream)
68
(format stream "Digest ~A is not a supported digest."
70
(:documentation "Signaled when an invalid digest name is provided to MAKE-DIGEST."))
72
(define-condition unsupported-mac (ironclad-error)
73
((mac :initarg :name :reader mac))
74
(:report (lambda (condition stream)
75
(format stream "MAC ~A is not a supported MAC."
77
(:documentation "Signaled when an invalid MAC name is provided to MAKE-MAC."))
79
(define-condition unsupported-kdf (ironclad-error)
80
((kdf :initarg :kdf :reader kdf))
81
(:report (lambda (condition stream)
82
(format stream "~A is not a supported key derivation function."
84
(:documentation "Signaled when an invalid key derivation function name is provided to MAKE-KDF."))
86
(define-condition unsupported-scrypt-cost-factors (ironclad-error)
87
((N :initarg :N :reader cost-N)
88
(r :initarg :r :reader cost-r)
89
(p :initarg :p :reader cost-p))
90
(:report (lambda (condition stream)
91
(format stream "Scrypt cost factors not supported. N=~A must be a power of two and (r=~A * p=~A) <= 2^30."
92
(cost-N condition) (cost-r condition) (cost-p condition))))
93
(:documentation "Signaled when invalid Scrypt cost factors are provided to MAKE-KDF."))
95
(define-condition unsupported-argon2-parameters (ironclad-error)
97
(:report (lambda (condition stream)
98
(declare (ignore condition))
99
(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.")))
100
(:documentation "Signaled when invalid Argon2 parameters are provided to MAKE-KDF."))
102
(define-condition insufficient-buffer-space (ironclad-error)
103
((buffer :initarg :buffer :reader insufficient-buffer-space-buffer)
104
(start :initarg :start :reader insufficient-buffer-space-start)
105
(length :initarg :length :reader insufficient-buffer-space-length))
106
(:report (lambda (condition stream)
107
(format stream "Buffer ~A cannot accommodate ~D elements starting at index ~D."
108
(insufficient-buffer-space-buffer condition)
109
(insufficient-buffer-space-length condition)
110
(insufficient-buffer-space-start condition))))
111
(:documentation "Signaled when insufficient buffer space exists for an operation."))
113
(define-condition invalid-padding (ironclad-error)
114
((padding-name :initarg :name :reader invalid-padding-padding-name)
115
(block :initarg :block :reader invalid-padding-block))
116
(:report (lambda (condition stream)
117
(format stream "The ~A padding in block ~A is invalid."
118
(invalid-padding-padding-name condition)
119
(invalid-padding-block condition))))
120
(:documentation "Signaled when padding in a block is determined to be invalid."))
122
(define-condition invalid-mac-parameter (ironclad-error)
123
((mac-name :initarg :mac-name :reader mac-name)
124
(message :initarg :message :reader message))
125
(:report (lambda (condition stream)
126
(format stream "Invalid parameter for MAC ~A. ~A."
128
(message condition))))
129
(:documentation "Signaled when an invalid parameter is provided to MAKE-MAC."))
131
(define-condition invalid-signature-length (ironclad-error)
132
((kind :initarg :kind :reader kind))
133
(:report (lambda (condition stream)
134
(format stream "Invalid signature length for ~A." (kind condition))))
135
(:documentation "Signaled when a signature with an invalid length is
136
provided to VERIFY-SIGNATURE or DESTRUCTURE-SIGNATURE."))
138
(define-condition invalid-message-length (ironclad-error)
139
((kind :initarg :kind :reader kind))
140
(:report (lambda (condition stream)
141
(format stream "Invalid message length for ~A." (kind condition))))
142
(:documentation "Signaled when a message with an invalid length is
143
provided to ENCRYPT-MESSAGE, DECRYPT-MESSAGE or DESTRUCTURE-MESSAGE."))
145
(define-condition missing-key-parameter (ironclad-error)
146
((kind :initarg :kind :reader kind)
147
(parameter :initarg :parameter :reader parameter)
148
(description :initarg :description :reader description))
149
(:report (lambda (condition stream)
150
(format stream "Missing ~A ~A for ~A key."
151
(description condition)
152
(parameter condition)
154
(:documentation "Signaled when it is determined that a parameter is
155
missing in a call to MAKE-PUBLIC-KEY or MAKE-PRIVATE-KEY."))
157
(define-condition missing-message-parameter (ironclad-error)
158
((kind :initarg :kind :reader kind)
159
(parameter :initarg :parameter :reader parameter)
160
(description :initarg :description :reader description))
161
(:report (lambda (condition stream)
162
(format stream "Missing ~A ~A for ~A message."
163
(description condition)
164
(parameter condition)
166
(:documentation "Signaled when it is determined that a parameter is
167
missing in a call to MAKE-MESSAGE."))
169
(define-condition missing-point-parameter (ironclad-error)
170
((kind :initarg :kind :reader kind)
171
(parameter :initarg :parameter :reader parameter)
172
(description :initarg :description :reader description))
173
(:report (lambda (condition stream)
174
(format stream "Missing ~A ~A for ~A point."
175
(description condition)
176
(parameter condition)
178
(:documentation "Signaled when it is determined that a parameter is
179
missing in a call to EC-MAKE-POINT."))
181
(define-condition missing-signature-parameter (ironclad-error)
182
((kind :initarg :kind :reader kind)
183
(parameter :initarg :parameter :reader parameter)
184
(description :initarg :description :reader description))
185
(:report (lambda (condition stream)
186
(format stream "Missing ~A ~A for ~A signature."
187
(description condition)
188
(parameter condition)
190
(:documentation "Signaled when it is determined that a parameter is
191
missing in a call to MAKE-SIGNATURE."))
193
(define-condition incompatible-keys (ironclad-error)
194
((kind :initarg :kind :reader kind))
195
(:report (lambda (condition stream)
196
(format stream "The ~A keys are not compatible because they are not in the same group."
198
(:documentation "Signaled when providing keys that are not compatible to DIFFIE-HELLMAN."))
200
(define-condition invalid-curve-point (ironclad-error)
201
((kind :initarg :kind :reader kind))
202
(:report (lambda (condition stream)
203
(format stream "Point not on curve ~A." (kind condition))))
204
(:documentation "Signaled when trying to use an invalid curve point."))
206
(define-condition invalid-public-key-length (ironclad-error)
207
((kind :initarg :kind :reader kind))
208
(:report (lambda (condition stream)
209
(format stream "Invalid public key length for ~A." (kind condition))))
210
(:documentation "Signaled when a public key with an invalid length is
211
provided to VERIFY-SIGNATURE."))
213
(define-condition oaep-decoding-error (ironclad-error)
215
(:report (lambda (condition stream)
216
(declare (ignore condition))
217
(format stream "OAEP decoding of the message failed.")))
218
(:documentation "Signaled when the OAEP decoding of a message fails."))
220
(define-condition unsupported-authenticated-encryption-mode (ironclad-error)
221
((name :initarg :name :reader name))
222
(:report (lambda (condition stream)
223
(format stream "~A is not a supported authenticated encryption mode."
225
(:documentation "Signaled when an invalid mode name is provided to MAKE-AUTHENTICATED-ENCRYPTION-MODE."))
227
(define-condition bad-authentication-tag (ironclad-error)
229
(:report (lambda (condition stream)
230
(declare (ignore condition))
231
(format stream "Bad authentication tag.")))
232
(:documentation "Signaled when the verification of authenticity of a message fails."))