Coverage report: /home/ellis/comp/ext/ironclad/src/macs/mac.lisp
Kind | Covered | All | % |
expression | 0 | 52 | 0.0 |
branch | 0 | 10 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;;; macs.lisp -- common functions for message authentication codes
9
(defun list-all-macs ()
10
(loop for symbol being each external-symbol of (find-package :ironclad)
12
collect (intern (symbol-name symbol) :keyword) into macs
13
finally (return (sort macs #'string<))))
15
(defun mac-supported-p (name)
16
"Return T if the mac NAME is a valid mac name."
18
(not (null (macp (massage-symbol name))))))
20
(defmacro defmac (name maker updater producer)
22
(setf (get ',name '%make-mac) #',maker)
24
(defmethod update-mac ((mac ,name) (sequence vector) &key (start 0) (end (length sequence)))
25
(check-type sequence simple-octet-vector)
26
(check-type start index)
27
(check-type end index)
28
(,updater mac sequence :start start :end end)
31
(defmethod produce-mac ((mac ,name) &key digest (digest-start 0))
32
(let* ((mac-digest (,producer mac))
33
(digest-size (length mac-digest)))
36
(if (<= digest-size (- (length digest) digest-start))
37
(replace digest mac-digest :start1 digest-start)
38
(error 'insufficient-buffer-space
41
:length digest-size)))
45
(defun make-mac (mac-name key &rest args)
46
"Return a MAC object which uses the algorithm MAC-NAME
47
initialized with a KEY."
50
(let ((name (massage-symbol mac-name)))
52
(apply (the function (get name '%make-mac)) key args)
53
(error 'unsupported-mac :name mac-name))))
55
(error 'type-error :datum mac-name :expected-type 'symbol))))